Friday fun at work…

The other day one of our servers went down, but not all the way down so the monitoring didn’t catch it, plus the monitoring thing only emails me. I wanted to make it better and have it call me by phone. But how do I do that? Some simple google searching didn’t turn up much… then I got an idea..

On a linux system you can just type or send it the command “eject” and the cd tray will open. Also our phones can be set to autodial a number with the push of a single button. Zip tie the phone in front of a server in the office and write a little program that detects if the web site is up. If it is not, eject the cd tray, which hits a button on the phone and gives me a call.

Using my google voice account I can have it ring my work, home and cell phone all at the same time. If I don’t pick up, it goes to voice mail, and google alerts me by email to the new voicemail.

I can’t wait for the day my server room calls me at 3am.

-tim

Comments off

What every Technology Director needs

Another little project with an Arduino and the $1 display from All Electronics. This one using 8 of the displays connected to a iDuino from Fundamental Logic.

I just spent the last 6+ months completely redoing our website here at Democracy for America (http://democracyforamerica.com) and wanted to make sure I could keep an eye on things and know the health of the servers with a quick glance. While a simple web page would have worked, flashing led lights mounted on the wall is much more fun.

There are 4 production web servers I need to monitor which are sent traffic from our load balancer in round robin fashion (web3 is currently removed from this and is used a staging server so you will notice the numbers in the lower left display are lower) Thus the bottom half of the display has 4 modules, one for each server. The entire display cycles between 3 frames showing Ram usage, Load avg and apache requests per sec for all servers. These stats are updated by a perl script running on my local desktop which connects to a perl script on each server every 30 seconds.

The top line of the display is 4 display modules side by side allowing for a 28 character (4*7) line. (You can see the spacing between the 4 displays, but it is not too bad) This line also has 3 frames and can be updated to show anything I like via the perl script. Currently besides showing “Democracy for America”, it pulls some stats from our member database and shows the number of active users in the last 24 hours and the number of signups in the last 24 hours (in our system a signup is not always an active user). When we have ongoing petitions and fund raising drives, I can easily update it to show those stats as well.

The entire displays is a 12×12 shadow box frame (a bit large but the only size I could find) with the darkest window tint I could find over the glass. The tint hides the uglyness of the led displays themselves and cuts down on the orangy brightness and overall makes the setup look very professional. No one in my office realized I had built it until I took it down and opened up the backside. The displays themselves are hot glued to a piece of plexiglass (just what I had on hand) and there is mass amounts of hook up wire running everywhere. (5 pins per display)

While it is done and working, I would like to update the code driving it a bit. Scrolling text as an option for the 28 char line would be nice. Also there are 4 icons on each display that are currently not being used that could be used for some purpose. There are also a number of free pins left on the iDuino.. seems like such a waste when more lights could be lit up.

The stats themselves need a bit tweaking as well. The req/sec is directly from apache status page and seems to be an average as long as the servers has been up. Which means spikes in traffic are not easily reflected, and even less the longer the server is up. I would also like to find some Ruby on Rails specific stats to display.

After all this, the servers seem to be pretty rock solid, so this is pretty much just eye candy for now.


(this picture is a bit dark, you can read the display from the hallway)

Comments (2)

Updates to “Weather Station”

I made a bunch of updates to the previously mentioned “Weather Station”. I put it in quotes as it now shows us much more then the weather. I have added two more modules.

The first being the glowing RGB lamp in the upper left. It displays the amount of bandwidth the household has used in the last 24 hours. Since we are on a satellite connection, we are limited to 420mb a day. It displays 10 different colors in the rainbow, purple being almost no usage, up to red.. warning… download carefully.

The second is 7 lit ping pong balls. 6 colored balls (2 purple, 2 green and 2 blue) are stuffed with white leds, while the seventh is a white ball with a red led inside. These can all be controlled individually, but at the moment the blue balls alert me to new email in general. The green balls mean new email from my mom and the purple balls light up when I have new email from my sister. The red ball is when any website I am in charge of goes down.

In the photo the blue and the green look pretty close, and for some reason one of the purple balls is not lit up.

At this point I have used up all but one of the pins on the Arduino so unless I get a bit more fancy with wiring or some extra chips, I can’t add any more. The code is getting a little hairy and messy at this point, but if anyone wants me to post it, I can clean it up a little and let everyone at it.

Comments off

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)