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.
Related posts:
Thursday, November 6 @ 7pm...
Friday was Robin's big day...
Big text made out of match...
Part of our research for H...













![Things Worth Saving Recap Though we’ve received a few of the postcards back because of a faulty address, for the most part, the 150 postcards sent out for Things Worth Saving, as part of our ongoing Save the City project, have likely now arrived to their destinations. I must admit that when I first laid eyes on the stacks [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/05/IMG_4651-150x150.jpg)
![LED Sign Construction Tuesday night’s Broken City Lab Office Hours were successful, but as usual, all too short. Spending the majority of the time in Lebel’s wood shop, we started working on our LED sign, but still have a long ways to go with it. We cut plexiglass, drilled holes, and started soldering—I think we’ll continue next Monday [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/01/img_2074-150x150.jpg)
![SRSI, Day 30: Em’s Little Book of Friendly Services Over the weekend, Emily Colombo wrapped up Miss Em’s Friendly Services with an awesome zine-like handout. Lots of food was prepared and shared. On Saturday, Emily made a tasty fruit soup using fresh berries from the Downtown Windsor Farmer’s Market. Joe has been a regular, visiting SRSI almost daily. He knows a lot about the [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/07/DSC_07312-150x150.jpg)
![Artists-in-Residence Announced for Homework! We are very pleased to announce the following artists in residence for our upcoming Homework: Infrastructures & Collaboration in Social Practices project. These artists were selected from over 120 applicants and represent an incredibly diverse range of practices, interests, and backgrounds: Andrea Carvalho Montreal, QC Brennan Broome and Chloé Womack Portland, OR Brett Randall Jones & Jack Forinash Oakland/San Francisco, CA [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/07/ArtistsInResidence-150x150.jpg)
![Conflux 2009 Day 2 Day 2 of our trek to New York was filled with excellent adventures, some more great lectures, and lots of discussion. It was amazing to get to see some of the artists we’ve talked about before right here on the blog, and it continued to inform what we were continuing to try to define as [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/09/IMG_02913-150x150.jpg)
![“Alive & Well” viewable on Google Maps Our project for the 2011 Windsor Biennial, Alive & Well, was created with the hope that it would be captured on Google Maps to make a monument or announcement of sorts to the rest of the world about Windsor as we near the end of the year and ahead of being torn up for the new Aquatic [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/12/aliveandWellscreenshot-2-150x150.jpg)
![A New Project Begins: Cardboard, a projector, and lots of editing In what feels like the first time in months, we got together and worked on making something (that is, as opposed to planning something). We’re getting started on what is going to be an epic project, time-wise. We’re making a bunch of large 3D cardboard letters. Collaborative Apartment Studio is very fun. Danielle and I [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/07/DSC_07931-150x150.jpg)
![Scavenge The City SCAVENGE THE CITY: An Algorithmic Walk with Broken City Lab is happening on Sunday, March 29th at 6pm. Starting at Phog Lounge, we’ll be handing out a custom algorithm (a set of instructions), using a fancy computer program that we write, to take you and whomever you want to walk with, around the downtownish area [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/03/scavengethecityposter-v1-150x150.jpg)
![How we use this site for research (in-part) Over the last week or so, we’ve added a few new things to our little website here. It’s funny because there’s a lot of research that goes on in the background, in terms of things we come across and don’t blog about, ideas that we email to one another, and documenting our process and posting [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/12/bcl-sidebar-dec09-150x150.jpg)
![iPhone app development (on paper) I’m starting a new project in creating a series of iPhone applications for Surviving Windsor. Some of these applications will be absurd, some useful, but all will be focused primarily on the specific conditions and realities found here in South Detroit. This suite of applications takes the city as its conceptual backing, generating a set of small [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/10/IMG_3934-150x150.jpg)

![Eric Boucher Micro-Residency Iteration 3/5 In order to keep things moving with Eric Boucher’s Micro-Residency project, I invited Eric to interview my oldest (in terms of age) friend Terry Marentette yesterday afternoon. I met Terry two years ago in an Art History class at the School of Visual Arts and was immediately astonished by his immense knowledge of Windsor’s past. [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/12/042-150x150.jpg)
![Two Tales of a City: Interview with Ariane from le Centre Français Below is the transcription of the interview Rosina and I had this fall with Ariane from the Centre Français in Hamilton. While going through what was discussed around the topics of francophonie in Hamilton, I came across a good amount of ideas and phrases that could be interestingly interpreted when paired in context to the [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/12/IMG_5336-150x150.jpg)
![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)
![Making Things Happen, Day 1 Today was a great start to the Making Things Happen (For a Week Straight) show. We got the gallery basically put together, showing some of our existing projects and making it into a big studio of sorts. The major projects of the day were painting the title wall, getting a new adapter for our LED [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/03/img_3000-150x150.jpg)
![We Learned Electricity! We’re in week 3 of this LED sign project, and we now know how to finish it up. We had previously soldered all the anodes on the LEDs, but we were a bit confused about the connections of the cathodes and resistors. As we had been working off of a MAKE video, which breezed over [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/01/dsc_1920-150x150.jpg)
![Projector Tests: Day 2 of 2 We met to do another round of projection tests, this time outside. While we still only had two projectors to work with for the test, we definitely verified an increase in brightness on outdoor surfaces (both with ambient light and without), though this increase is not equal to the amount of light we’re throwing at [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/09/IMG_9933-150x150.jpg)
![SRSI, Day 25: Bookmobile & Friendly Services Monday saw the last new residents move in to the SRSI spaces; Lee Rodney’s Bookmobile Reading Room and Emily Colombo’s friendly services. To get footage for the SRSI documentary, Daragh followed Norman around, who was on his A game all day. Norman’s logs present a personal perspective on his security guard experiences. Lee Rodney arrived [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/07/IMG_1470-150x150.jpg)
![Attending Homework is Free! HOMEWORK: Infrastructures & Collaboration in Social Practices is four-day residency, two-day conference, and collaboratively-written publication aimed at generating conversation around the following: alternative infrastructures, radical collaboration, social practice, art implicated in social change, neighbourhood-level activities, city-wide imaginations, site-specific curiosities, tactical resistance, new models for art education and research. Facilitated by Broken City Lab, HOMEWORK calls on artists, scholars, writers, thinkers, [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/08/register1-150x150.jpg)
![Windsor-Detroit Border Crossing Micro Grant Broken City Lab is launching a new micro-grant program and we need you to apply. As a part of our upcoming publication, How to Forget the Border Completely, The Windsor-Detroit Border Crossing Micro Grant gives you the opportunity to cross the Windsor-Detroit border. We’re looking for a variety of experiences gained from crossing the border, [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/07/microgrant-v21-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.