Open Source BASIC code for LED "Weather Clock"

Open Source BASIC code for LED "Weather Clock"

Postby Janke » Fri Apr 21, 2017 1:49 pm

Here's a first iteration of the code for the LED Matrix "Weather Clock" described in the previous topic -

I made a few changes after experimenting with the graphic display; it really made no sense without a scale, so instead, I added a second DHT22-type sensor (acually an AM2302) in order to display both inside and outside temperature and humidity simultaneously. A small arrow indicates internal vs. external measurements. The photo shows the new displays, without the confusing graphics. I also re-built the font a bit, in order to fit the complete word "Wednesday" into 40 pixels... :P

The barometric pressure is only measured inside (it's basically the same as outside), but there, I have an indication on whether it is falling, steady or rising. The sensitivity of that function is easily set with the deltaP variable; I've chosen a value of 0.5 millibar/hour to trigger a change in the "trend" display.

Please note: The code is in no way streamlined, and may still contain some bugs.

As described in my previous topics/posts, the hardware is really simple, just an EzSBC1, a bunch of MAX7219 modules, some 74ACT-type IC gates as level converters, and the sensors themselves, two DHT22/AM2302 and one BMP180. They are all connected in accordance with the instructions in their respective data sheets. Additional info can be found in the REM comments in the BASIC code.

Note that the sensors are powered by the 3.3 volt output on the EzSBC1 (current draw is minuscule), while the MAX7219 modules need 5 volts. Hence the 74ACT level converters, which are powered from 5 volts, but have 3.3 volt compatible inputs. Any non-inverting gates can be used, mine are OR gates with both inputs connected together. Using plain hex buffers, one IC would suffice, 3 gates for each row of MAX modules (clock, data and load/CS).

Total cost was around $ 50 - not bad for such a fun (and useful?) project! :lol:

Feedback appreciated!
Attachments
Weather Clock.txt
ControlBASIC code
(15.87 KiB) Downloaded 20 times
newdisplays.jpg
Janke
 
Posts: 19
Joined: Mon Feb 20, 2017 11:48 am

Re: Open Source BASIC code for LED "Weather Clock"

Postby Janke » Tue Jun 27, 2017 4:28 am

Note: You should use ControlBASIC version 0.82 for this project - in older versions, there is a subtle bug in the DHT routines that will freeze the temperature and pressure displays after a few days of running.
Janke
 
Posts: 19
Joined: Mon Feb 20, 2017 11:48 am

NEW VERSION of the code

Postby Janke » Thu Jun 29, 2017 2:06 pm

I enlarged the "Weather Clock" display by two modules (a whopping $ 1.50 each ;-), and it will now display the time with seconds, in the large, condensed, fat font described in another thread.

The LED display now consists of 12 modules, 2 rows of 6, i.e. 16x48 pixels, or a total of 768 LEDs. The enclosed code expects the MAX7219 modules to be connected "straight", not diagonally. Thus, it includes a conversion routine which takes about one second. If you connect the modules diagonally, you can remove the convertupper and convertlower subroutines and their gosubs.

Note that the RTC oscillator crystal on the EzSBC1 board has a frequency tolerance of +-20 ppm, which amounts to a little under two seconds per day.

If your RTC is spot on, great, but if not, you might want to add an adjusting routine which corrects any large discrepancy - once a month should be OK if the clock is just a little fast or slow, once a week if the difference is larger. It all depends on how exact you want the display to be! Just let the clock run for a week or so, and compare it with any exact atomic clock website to get an idea of the necessary adjustment.

I'd be happy to answer any questions, or iron out any bugs you might find... ;-)
Attachments
12-module LED clock w seconds.txt
(18.93 KiB) Downloaded 11 times
Janke
 
Posts: 19
Joined: Mon Feb 20, 2017 11:48 am


Return to EzSBC1

Who is online

Users browsing this forum: No registered users and 1 guest

cron