Parsing RSS Feeds for the Arduino + LCD + PHP project
I’ve made some really great progress on this ongoing Arduino + LCD project over the last couple of weeks — some of the two larger hurdles are now out of the way, the results of which you can see in the video above.
Since the video was shot, I’ve improved the PHP script some more to ensure that the text is properly broken up over the appropriate lines on the LCD and I’ve also removed those strange characters, which were resulting from newlines in the Twitter RSS feed, I think.
To back up a bit though, I also made two small changes that have had a huge impact on the project. Hopefully, if there are other people having the same problem (that is, that the Arduino IDE Serial Monitor had to be open to allow any Serial data to be sent along to the Arduino / LCD), I’ve sorted it out with two small changes…
The first change that I made was changing the PHP Serial deviceSet() to /dev/cu.usbserial-A60049S4 from /dev/tty.usbserial-A60049S4. Doing some digging around finally led me to this forum, which notes that “the tty’s are for incoming (to the system) calls; the cu’s are for outgoing (from the system) calls (”cu” == “call unix”);”, citing another mailing list. Anyways, this makes a lot of sense since the Serial is actually listening for outgoing information from PHP, rather than sending incoming information to PHP.
Secondly, I finally also got a hold of the correct resistor, 120 OHMs to disable the auto-reset of the Arduino upon receiving Serial data.
I bought a box of a variety of resistors, which will inevitably come in handy down the road, but for now, I was just happy to get the right resistor to get Arduino and the Serial data working together correctly.
You disable the auto-reset by basically routing from the 5V power to the RESET pin on the Arduino with the 120 OHM resistor in between.
As you can see, I’ve also started running the PHP script from the Terminal, which gives me a lot more flexibility to kill the script if something isn’t going right, whereas before, when I was running it from the browser, the script would have to go the entire way through before stopping.
I’m using the Magpie RSS Parser, which is really great for grabbing data from Twitter, as Twitter just puts its tweets in the title tags in the XML file of the RSS feed.
I was just working on grabbing a variety of different feeds from Twitter to try to make sure I wasn’t going to run into any unexpected character wrapping problems. In this case, I was looking at the hashtag, #Saturday.
You can see that some of the HTML output I had coded into the script is a bit less useful now … though I’m thinking of having this thing write its output to a file just to keep track of it over a long duration install.
I’ve also removed the URLs from the Twitter feeds, replacing them with an ellipses. URLs wouldn’t be much use on a screen like this and they created some difficulties in the line wrapping.
Another test in the browser, showing incoming data from Twitter.
And again, on the LCD, a tweet from the Broken City Lab Twitter feed.
Overall, I’m really relieved to have made those two big steps forward in the project. Next on the list is tackling the wireless aspect of this — that is, having an Arduino and LCD wirelessly receiving information for display, and then moving on to dealing with SMS messages, which I’ve written about previously.
–
Annotated Bibliography
http://www.olate.co.uk/articles/view.php?id=214 (basic Magpie RSS tutorial)
http://www.iknowthe.net/blog/arduino-twitter-lcd-doorsign.html (another example of LCD + Twitter + Python)
http://missionduke.com/arduino-projects/ (some other PHP projects, with some questions about the Serial Monitor problem)
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1262928238 (PHP + Serial pin reset problem)
http://www.arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection (Disabling auto reset on a serial connection on the Arduino)
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1236198283 (wireless LCD Arduino project)
http://rapplogic.blogspot.com/2009/05/arduino-xbee-portal.html (Arduino + LCD + XBee)
http://www.hashbangcode.com/blog/disemvoweling-php-function-1077.html (disemvoweling PHP function)
http://blog.soundsorange.net/2006/08/29/arduino-getting-the-usb-version-up-and-running-on-osx-using-pd/ (distinguishes between cu and tty)
I would like to thank the Canada Council for the Arts for their generous support.















![The Storefront Residencies for Social Innovation: Launching June 11, 2010 For 30 days, this project will call on over 25 different artists, writers, designers, restauranteurs, musicians, architects, archivists, and other interested parties to occupy a space in downtown Windsor for up to one month in June and July 2010 to attempt to intervene with the everyday realities of skyrocketing vacancy rates, failing economic strategies, and a place [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/08/SRSI-storefronts-520-150x150.jpg)
![Moving Along with Flagging Tape and LEDs Broken City Lab Office Hours on Tuesday were hugely productive. We completely finished getting all the resistors on the LED sign, measured out all the letters with flagging tape for the EC Row Project, organized some logistics for the planning stages of a couple other upcoming projects, and figured out the title for our upcoming [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/02/2009-02-04-026-150x150.jpg)
![Nothing like being thorough: how we make decisions, slowly Last night Hiba, Danielle and I met to do some more prep work on the letters for the Letter Library launch on June 21st. We painted another test letter E a different shade of grey and started to populate a wall with some more of the tests. It was excellent to see more than a [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2012/06/IMG_96051-150x150.jpg)

![How to Briefly Describe Amazing Things: A Recap of 30 Days of SRSI We’ve been really lucky. For a couple of years now, we’ve been able to do the work that we’ve wanted to do, make the kinds of changes that we want to see, and create a set of projects that have kept us interested in staying in Windsor. The Storefront Residencies for Social Innovation wrapped up [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/07/IMG_2211-150x150.jpg)
![The (Nearly Complete) Letter Library Archive When the Letter Library was up earlier this month at CIVIC SPACE, each participant had the option to borrow a disposable camera from us, photograph their letters, and bring the cameras back. Well, after developing nearly all the cameras (still a few more to come) here is the nearly complete archive of all the photos [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2012/07/00360010-150x150.jpg)
![Retroreflective Materials Test Earlier this week we received a couple of samples of various retroreflective materials for use on our letters for CAFKA. One material, the one on the roll, is a vinyl (3M Scotchlite Reflective White Vinyl), perhaps most famously used in the Bright Bike project, while the other is an industrial substrate (3M Engineer Grade White [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/04/IMG_9505-150x150.jpg)
![Bio Graff What you need: A good large base canvas. (One on the pavement, preferably). A sweet substance. (preferably with a control spout. I.e. honey, Chocolate syrup). A shitload of ants. (preferably the friendly kind.) we all have experienced this very familar phenomenon take place on the sidewalk, in the corner of a high school hallway, and [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2008/10/Fire-Ants-love-eating-Harper-150x150.jpg)
![Interactive Window Installation, progressing beyond the Max/MSP solution After our post a few weeks ago about a new interactive window installation, we had some interesting and helpful suggestions, but one email in particular stood out. Paul Anderson wrote to us briefly with an offer to help and after a quick introduction of his incredible depth of knowledge of all things electronic shortly thereafter, [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2012/10/wpid20203-IMG_1503-150x150.jpg)
![LEDs in Action The 10mm LEDs I ordered from Evil Mad Science came in and I went out today to get a CR2032 3V battery to start testing. I got 100 super white and 100 blue LEDs. This is the CR2032 battery, I got 6 of them for $2 from the Dollar Store. It would be interesting to [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2008/12/img_0997-150x150.jpg)
![Physics Club + Making Paper It’s been a busy last week, getting back from Victoria, and launching the Text In-Transit Call For Submissions, but we still had time to meet for our weekly Office Hours and continue working with the Massey Physics Club. Our adventures in paper making for an upcoming planters project we have in mind, and in learning [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/03/img_3378-150x150.jpg)
![SRSI, Day 24: Imagination Lab & Disco Balls 424 Pelissier was a fun space for kids to be creative all day on Sunday as part of Imagination Lab. Merry Ellen set up her baking station over in that space. Later Sunday night, I accompanied Laura to do some more installations. The kids had a lot fo fun interacting with each other and learning [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/07/DSC_0650-150x150.jpg)
![Evolve or Die: CMA Conference I’ll be heading up to London, Ontario on Thursday, April 14 to speak on a panel with some incredible people as part of the Canadian Museum Association’s Annual Conference, appropriately titled, Evolve or Die!. I’m pumped to get to reconnect with Andrew Hunter and Andrew Lochhead, and to finally meet Yael Filipovic. Not familiar with these [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/04/Screen-shot-2011-04-13-at-9.24-150x150.jpg)
![Save the City: an overview The Save the City project aims to create a concentrated series of positive community-based activities facilitated by Broken City Lab in collaboration with community members. The project will address a number of issues and ideas specific to Windsor, Ontario through various collaborative community-based activities. As Windsor is situated in precarious economic, cultural, and geographic positions, the [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/01/BCL-STC-Jan-5x7-back-website-green-150x150.jpg)
![Designing Promo for “Save The City” I’ve been mulling over some potential designs (the 8.5×11 pictured above is just one sketch of an idea) for the promo for our upcoming Broken City Lab: Save The City project, which will start at the very end of January, 2010. There’s still much to finalize, in terms of dates and locations, and we’ll need [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/12/IMG_5849-sm2-150x150.jpg)
![XBees, Arduinos, Serial Data I made some huge progress over the last week or so on this ongoing Arduino / LCD project — it’s finally gone wireless! With some more silly mistakes behind me, I’m finally getting a better handle on how to break down the problems I run into and solve them a lot faster. I remember back [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/05/IMG_9593-150x150.jpg)
![Reading List Thinking about a good collaborative weekend project, the idea of starting a reading list came up. I have a fair collection of books and blogs in my reader that touch on a number of things that seem pertinent to Broken City Lab, but I wondered what’s out there that I’m missing. I’ll make a quick [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/02/img_9092c-150x150.jpg)
![Homework Prep! Resampled Notebooks We’re gearing up for Homework. It’s going to be fun and you should really consider attending! There’s a few spots left. If you do decide to attend, you can look forward to receiving one of these fine sketchbooks. Designed by Liisa Salonen, the sketchbooks are recovered paper sample books, rewrapped. They still need to be stamped, maybe [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/10/IMG_4871-150x150.jpg)
hi there
here some question about how u pull the data from database.
u made 1 .php file to get the data, and then u also add some code to the arduino C program right? is it the idea how u send database to the arduino?
thanks in advance :)
Amy, in this case, I’m not pulling any data from a database, just working off of the Twitter feed’s RSS. I haven’t written any code to pull from a MySQL database, just from a text file and then used the Magpie library for the RSS.
On the Arduino side, yes, there is some code that receives data from the serial port, formats it in terms of starting new lines when appropriate, new pages, and clearing the screen. When the project is done, I’ll post the Arduino code as well.
Nice post mate, any chance of the source code ?
I am starting with arduino and learn the best way to integrate Twiiter and Arduino using php and API.
Thanks
I posted all the source code here: … Basically, I was just pulling from a Twitter RSS feed, didn’t get into the API stuff.
Bottom line, you need to pass PHP through serial port. You could certainly use the API or any source really after that you get the basic communications down.