Archive for February, 2008

Arduino Powered Weather Station

This is my first real Arduino project and my first blog post/tech write-up, so I hope everyone can follow along ok.

Recently while looking for something to do in my down time, I came across the Arduino and it looked to be the perfect item for me to play with. I like to tinker and build things. I am memorized by pretty blinking lights, and I code write code that left the screen. So I asked for one as a gift.

Browsing the web one day I came upon this post from RobotRoom.com that explained in some detail about a 14-segment led display that could be driven with just 5 pins, and best of all it was just $1. Figuring you can never go wrong for a $1, I ordered 4. Using the details laid out in the Robot Room article, I was amazed at how simply I was able to control the leds on the display. After a bit of trial and error, I left a nice scrolling message for my girlfriend to see the next morning and went to bed.

At that point, one display was nice, but I had 3 others, and if I could drive 1 display, how hard could 4 be. I decided to mount them together and mount them into a 4×6 frame and have it display me the weather. The 7 segment alphanumeric characters on the first line is perfect for displaying the conditions, while the 4 digit numeric characters on the 2nd line would be good for temperature. 4 displays means I can show todays forecast, plus the forecast for the next 3 days.

Onto the technical stuff.

Each display has 5 pins. one ground and power, one reset pin, a data pin and a clock pin. Only the data pin per display needs its own unique Arduino pin, the ground, power, reset and clock pins from each display can all be tied to each other. As mentioned in the Robot Room write-up, each display has 5 scan lines each with 36 bits of data. This means only about 1/5 of the display can be lit at any time, but updating faster then the eye can see makes the entire display look “always on”.

The first code I wrote to update all 4 displays, 5 scan lines of the first display, moved on to the 2nd display and updated all 5 lines and so on. While this worked, the 5th line of each display was “on” while the other displays were being updated. This caused the other 4 scan lines to flicker and the 5th to burn bright. Scan lines 1-4 of each display were on 1/20 of the time, while the 5th line was on 16/20 of the time. To solve this, I rewrote the code to update the first scan line over all 4 displays, then the 2nd scan line over all displays and so on. Making each line on the same 1/5 of the time. I also realized since the clock line where all tied together, it was silly to send 36 bits to the first display, toggling the clock between each bit for all 4 displays, when I could send a bit for all 4 displays and toggle the clock and do that 36 times. Thats 36*3 less clock toggles per line.

After getting the 4 displays to show anything I wanted, it looked a bit boring just static, so I decided to enable it to have a few different frames. Switching between 2 or 3 frames of different text. This would allow me to show which date the forecast was for and switch between high and low temp for the day. After getting that to work, the problem was now that it wasn’t dynamic. All the text to show was stored in the Arduino program. Time for some trusty Perl.

I’m not sure if I did this the best way or what, but it works. I decided to create my own little protocol for a serial connection to update the displays. It goes something like (display)(line)(frame)(text)\n Display, line and frame being numerals. So if I wanted to update the 7 characters that make up the 3rd displays 1rst line and 2nd frame with “ARDUINO”, I would send over the serial line 312ARDUINO\n The Arduino code picks that up and displays it in the proper position and time. The Arduino code itself knows nothing about weather, it can show anything you send it. It just happens the perl script sends weather data.

Issues:

I hate that it is tied to a computer. I can’t see spending the money on a xport or wireless solution just yet. And it is now using my $30 arduino that I still want to play with for other projects. I need to make it quick disconnect for now, or get a boarduino.

From here:

I need to mount it in the frame a bit better and somehow hide the whiteness of the leds when off. I think smoked Plexiglas would be nice. There are still free pins on the ardunio. I’m fairly certain it could handle another 4 displays. All the code would need is a few variable changes. Or I could arrange the new 4 in a line and have a 28 character display that I could scroll text across. Or I could use the three PWM pins to add some glowing ambiant orb that displays another vairable.

Code

Arduino code
Perl: weather_station.pl

Comments (6)