For around a decade I've had an LED sign above the door to our deck that I've run by computer. I had to reverse engineer the RS-232 serial protocol it used, but I've been able to extend it. Recently I wanted to get rid of the computer that was running by it, and switched to X-Bee modules for wireless RS-232. But since doing that, it's been having issues.
It worked great, I was able to add things like the temperature (after seeing a clock with a weather station on it at an office, that's the yellow "43" in the image above), and make it turn red if the Internet Weather Report shows significant issues, I've hooked caller-ID into it, and even changed it to report seconds since epoch for our billenium party.
But, I decided I wanted to try replacing it with something else... Read on for information about the prototype of the new one.
I've got an extra 1080p 22" monitor with a VESA mount and I was thinking it would make a nice information display. A week or so ago I wrote a small Python program using pygame that would allow me to put text on the display rotated, so I could mount the monitor sideways and have a long display.
However, the pygame program was kind of a pain. Every change in text and placement was pretty labor-intensive to do. It did work very well though.
I decided to try something else: set up a system to automatically log in, and run a browser in full screen mode, giving me the ability to display pretty much anything, including fonts, colors, graphics, even videos if I wanted to do that.
That's what I've come up with so far. I'm not sure about the forecast, I really was only thinking about conditions for today and tomorrow at most, so maybe I'll just put them next to the temp. The "North 3 > 23" text next to the temperature is the wind -- from the north at 3MPH gusting to 23MPH. It's very windy today.
So, I wrote a small Python CGI that uses a simple "%" formatted templating out of an HTML layout file. The reason I did it as a CGI was primarily so that I could send a refresh header that tells it to update on the first second of a new minute, otherwise I probably would have written the file as a cron job that runs every minute.
The weather information is obtained in two ways. The current temperature and wind is gathered from a personal weather station around half a mile away via the WeatherUnderground API. WeatherUnderground is a wonderful thing.
The forecast is grabbed using the pywapi Python package which pulls the forecast from google into a nicely formatted dictionary. That is the lower portion of the display right now, which has weather icons and shows the predicted low and high temps. And we still have some space to include additional information, once we decide what to add. Maybe a sparkline graph of bandwidth use at home, or weather/news alerts, where we're going to dinner on Tuesdays, if there are upcoming events on our calendars...
The styling is all done with CSS. I struggled a bit with that because I'm not a very good web developer, but eventually I got it to do exactly what I wanted. The table of weather stuff was the hardest, I almost gave up and used a table, but I was able to get it to look as I wanted.
I was going to use firefox as the browser with it's extensions to reload the page (in case I put up a bad CGI, make it reload to get the fixed one), and another extension to make it start up full screen. However, the fully screen startup wasn't working reliably in my testing. I may need to go back and revisit that if Chromium proves to have issues.
So, I ended up using Chromium. I nearly gave up on it, because it seemed like you had to press F11 to get it to go full screen, but then I found reference to running it with the "-kiosk" option, and that seems to work great.
However, it does sometimes start up with a "sorry we crashed, do you want to resume" stripe across the top of the display. I may "fix" that by wrapping the startup in a scrip that blows away the chromium settings and resets it to a specific set of data when the system boots.
So far, so good though. I'm sure I'll need to fix some of the formatting, but I'm very happy with it now.
The cables are all because it's a prototype. I didn't want to buy a little tiny computer until I was happy with it, so I'm currently using a mini-ITX Atom system (sitting behind the picture of Elvis on the mantel). I figure I'll probably get a book-sized lower-power Atom system to run it after I've decided I like the prototype. Then I'll tuck the cables all away and hide them in some of that white plastic stick-on molding.comments powered by Disqus