Arduino + LCD + PHP, Part 2

The epic adventure with Arduino, LCDs, and PHP continues. I’ve finally made some progress in terms of breaking up the words and lines appropriately. It felt like a huge achievement, since I had been trying to figure out this line-break thing for quite a while.
You can check the majority of the progress in the video below, and all of the steps along the way are below! Don’t mind the nonsensical example texts. So first off, I figured out I needed to send Arduino very specific information to know where to line break.

I used PHP wordwrap to break words appropriately, then sent Arduino a * to identify a line break.

Doing it this way also helped to make it more obvious where words needed to be wrapped, including when there was punctuation.

I used a SwitchCase to do some tests — I did this at first just to test to make sure the Serial port was receiving the appropriate information and to ensure that Arduino could act on receiving letters.

Then, I changed the code to be a bit to actually do what I needed it to do — in this case, set the cursor to the next line.

There was some trial and error along the way, the text wasn’t moving to the appropriate lines.

You can see, I was really just piecing this together from other code examples … but it turned out to help a lot and set the groundwork for this to work how I wanted.

Finally, the text being wrapped like it needed to!!!

A close up of the glory.

This code worked to print out each character.

Another random text, just to make sure this was working and not just a fluke.

I added some more switch cases to start identifying a page break, that is, spanning the text over two screens.

You can see here some of the testing I was doing in PHP.

And some more of the testing, having output into a browser so I could make sure that it was doing what I wanted it to.
And here’s the result — a 140 character message automatically spans across two screens and knows where to break words to span accordingly. Since then, I was speaking with Mike Beauchamp (ex-Windsorite / DIY tech genius) and he provided some interesting ideas in terms of how to work the communication portion of this project. Could be very useful, so I included a couple of those links below.
Next steps that I’ve already begun include working towards using PHP to parse a text file (I figure that’s one possibility to hold the text messages and Twitter tweets), or alternatively using an RSS feed to deliver both to the LCD (that is, assuming the email part of the text message configuration I’m currently considering could do that).
–
Annotated Bibliography
http://www.sparkfun.com/commerce/categories.php?c=66 (ideas from Mike Beauchamp)
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1227581530/0 (ideas from Mike Beauchamp)
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1264895784/9 (serial communication with PHP)
http://www.tizag.com/phpT/php-string-strpos.php (string position tutorial)
http://www.arduino.cc/en/Tutorial/TextString (potential to use Arduino rather than PHP for string manipulation)
http://www.tizag.com/phpT/fileread.php (open a text file and read data from it)
http://veritrope.com/tips/export-apple-mail-messages-and-notes-to-text-files/2 (export mail messages to text file)
http://www.tech-recipes.com/rx/878/check-google-e-mail-gmail-from-an-rss-feed/ (check gmail as rss feed)
http://googlesystem.blogspot.com/2008/03/feed-for-unread-gmail-messages.html (more info on gmail rss feeds, needs feed authentication)
http://davidwalsh.name/gmail-php-imap (php + imap + gmail output)
http://g33k.wordpress.com/2009/02/04/check-gmail-the-python-way/ (gmail + python)
http://www.hashbangcode.com/blog/disemvoweling-php-function-1077.html (disemvoewling PHP)
I would like to thank the Canada Council for the Arts for their generous support.


![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)

![1W3KND: Call for Submissions for a New Writing Residency We want to invite you to participate in our new residency program, 1W3KND aimed at developing essays, interviews, manifestos, critiques, reviews, and other texts around ideas of collaboration, socially engaged works, artist-run culture, and public practices. We’re hoping to publish these in one form or another some time next year. There have been a number [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2012/09/IMG_2759-640-150x150.jpg)
![Planning for 406 Pelissier Danielle and I spent a number of hours last night going through photos of the Parking Garage and starting to imagine new treatments for the infrastructure, space, signage, walls, and streetscape. We’ll be heading down early this afternoon to start getting all of this visual research up on the walls, with the opening tonight at [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/06/img_2608-we-150x150.jpg)
![Tonight, the first iteration of Cross-Border Communication Tonight, we are going to perform the first iteration of Cross-Border Communication. Thanks to the generosity from the University of Windsor’s Faculty of Arts and Social Sciences Research Leadership Chair and Spectrodata, we have the equipment we need to realize this project. Cross-Border Communication was initially imagined through a collaborative effort between Broken City Lab [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/11/IMG_4416-150x150.jpg)
![Micro-Residency #1: CreateHere.org “CreateHere works with one guiding principle in mind: we love our city for what it is, has been and could become.” The non-profit organization started in 2007 and does things like provide over $300,000 in artists grants to area creatives, connecting talented artists to homes in Chattanooga, and asking everyone in their city what they [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/11/web_oct5-createhere-150x150.jpg)
![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)
![Two Tales Of A City: Hamilton History Hunters Michelle and I headed up to Hamilton to continue the research portion of Two Tales Of A City. The three and a half hour car ride gave us plenty of time to develop a working plan of exactly what we wanted to accomplish for the next two days in Hamilton, Ontario. To get a [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2012/02/IMG_5855-150x150.jpg)
![Tuesday Recap: in case you missed it, super jigsaw rig, graphic design in progress & other notes In case you missed any of our spontaneous posts earlier today, here’s a quick recap of all the stuff that we got done! It may look a little strange, but our jigsaw rig Kevin put together has really been a huge help today. Hiba made it through nearly 70 letters — and no wrist pain! [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2012/06/IMG_9174-150x150.jpg)
![The Creation of Place in Abandoned Railway Cuts in Windsor: 1/4 Intro Lee Rodney teaches one of the best courses at the University of Windsor, Border Culture. I took the course in the fall of 2010 and wrote a book: The Creation of Place in Abandoned Railway Cuts in Windsor. The book serves as documentation and comparative analysis of three specific forgotten spaces in downtown Windsor, Ontario, [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/05/cuts-150x150.jpg)

![Researching Ribbons, Preparing for this Week’s Events Tuesday was all about research. We looked up some more details on ribbons and talked more about how we would move forward with the Sites of Apology / Sites of Hope event. We’re also getting ready for Sunday’s event, Listen to the City (remember, 8pm at Phog), and for Thursday night’s projection performance at Propeller in Toronto. We were [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/01/IMG_6776-150x150.jpg)
![Snow, LEDs, Flights, Fill-in-the-blanks, Proofs, and Postcards Meeting twice in a week is awesome. I can’t say that enough. So much time makes us way more productive and makes it a lot easier to be OK with not having everyone there all the time. First on the list, doing some really, really quick tests of the potential of embedding LEDs in ice [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/01/IMG_6483-150x150.jpg)
![Text In-Transit Panels off to the Printers The panels for Text In-Transit have been sent off to the printers. We should be able to install these on Transit Windsor buses in the next couple of weeks!!! We settled on 90 unique panels + 10 title card panels. Again, we can’t thank everyone enough for the support and participation—I’m hugely excited to see [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/05/textintransit-folder-150x150.jpg)
![Production Line: Magnetic Planters After taking a week off, Broken City Lab Office Hours started up again with a focus on getting a number of the shells for the magnetic planters completed. It was a really productive meeting with some more welcomed new faces and a whole bunch of planters now ready for the next step. It wasn’t all [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/04/3485463138_b04e504bb6_o-150x150.jpg)
![Extended Field Trip Day 1: Stable City As part of our Extended Field Trip #001, we’re in Peterborough staying at the artist-run-centre, Artspace. We’re hoping to conduct some intercity research where we’ll attempt to understand the similarities and differences between Peterborough and Windsor and hopefully find some intersection thereof to which we can respond. We arrived in Peterborough in the late afternoon [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/10/IMG_2617-150x150.jpg)
![Making Fortune Cookies In preparation for Art’s 1,000,046 Birthday Celebration this Saturday, January 17, 2009 at Phog (starts at 8:30pm, $3 for students and unemployed and Artcite members, $4 for everyone else), we spent Sunday evening making Broken City Lab fortune cookies from scratch. There’s lots of pictures of our adventures in baking after the jump. The process of making [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/01/img_1964-150x150.jpg)
![Primer: Another Friday Night’s Worth of Collectively Making Things Happen We’re on to priming the letters now, in anticipation of the bright red coat we’ll be giving them in the coming weeks. Things are moving ahead at a good pace, and hopefully will continue to, as we’d love to not be working with these finished letters in snow. While we do get together every week, [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/11/IMG_4165-150x150.jpg)
![SRSI, Day 4: Working 9-5 The start of the week brought two new residents to the Storefronts: Sara Jane French and Jodi Green. There was some crazy changes in the exterior landscape due to construction today as well. Sara was only present at the start and end of the day. For the bulk of it we were joined by Norman [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/06/DSC_0828-150x150.jpg)

I used a SwitchCase to do some tests — I did this at first just to test to make sure the Serial port was receiving the appropriate information and to ensure that Arduino could act on receiving letters.