Build it up to break it down again

arduino, robots, motorcycles, and life

Build it up to break it down again header image 2

Arduino based rss reader - W/Check Facebook Status Updates script.

December 2nd, 2008 · 9 Comments

My last project, the arduino gmail checker really opened my eyes to python/rss/arduino integration. I branched out from there to use feedparser for more conventional rss reading and I ended up with a python script that pulls in your friend updates from facebook. That was cool watching it scroll by in terminal, but I decided to geek it up a bit and make it display out through a serial lcd. Nothing is more distracting than a lcd flickering constantly at your desk! Here's a pic of it doing it's thing.

YouTube Preview Image

Here's how I did it.

1-Python The python code is quite similar to the code from my last project - the arduino gmail checker (thanks J4mie) This time I added a warning to tell you when it doesn't have the right serial port attached, I added the ability for it to scroll text or page text, and I (had to) add the ability for it to cut the string output into manageable bites. I'm quite certain that anyone versed in python would find this bit of hackery laughable. I am literally learning python as I wrote this, but it seems to get the job done. Like the previous example, this requires feedparser. Install it if you haven't. There are a few things to tweak in the script. It is well commented, and should be self explanatory. The most important is filling in your facebook feed. it should start something like http://www.facebook.com/feeds/friends_status.php?id=XXXXXXXXXXX. Figure it out from the FB. Here is the source code in a zip file.

2-Arduino For this bit I used a bit of code from Stephen Wilson, unaltered. It allows the arduino to receive a string, as opposed to looking like there was a println for every character. Upload this, make sure you have auto-reset disabled on your arduino, and move on to the hardware! If you try to upload to the arduino with the lcd attached, then you'll probably run into trouble. Just unplug the rx wire while uploading.

3-hardware Depending on what kind of serial lcd you are using, the hardware may vary. I am using a hd44780 controlled lcd with a lcd117 kit from modern device company. If you are using anything else, then you may need to change the clear screen and position commands to suit your lcd controller. I am using a 4x20 display. If you are using a different display then you may need to make the "LNLENGTH" correct in your python script. I have the lcd117 connected to power, ground, and rx (pin 0) I have the backlight connected through a 10k potentiometer to power and ground. I think the 10k is a bit overkill, but haven't changed it yet.

That ought to be it! Fire up terminal, upload to the arduino. Start up the python script and adjust the backlight for easy reading. There are a bunch of settings you can tweak in the python sketch for scrolling speed, page speed, if scroll is on or off, and screen size and positioning. Play with it. If I have my scroll speed set too fast, or if I have too many commands in a row, then I will reset the lcd controller, but that's an easy fix!

Those eagle-eyed readers out there might have noticed that this one doesn't run a .plist file. I got lazy, and I didn't want it to have any lag time between loops, so I just set up a big 'for' loop in the python file. It runs for a long time now, but it gets the job done.

the cool thing is that this could be expanded with any one of a huge number of feeds. you could have it read your stock quotes, weather report, or twitter status. I'll see which one I get motivated to code first! I would also like to note that there might be lots of other people out there who have done this. It isn't particularly mind-blowing, but the interesting thing is that arduino + rss is one of those ungoogleable things, because every rss feed in the world comes up. Happy hacking!

UPDATE - Here's a new python script I wrote to check the weather

UPDATE 2 - Here is some new code to follow a twitter feed

Tags: arduino · general geek

9 responses so far ↓

Leave a Comment