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.
Related posts:
Thursday, November 6 @ 7pm...
We've been working on pape...
We spent another Monday ni...
We're in Calgary working w...

![Brainstorming Community Gardens Darren, Josh, and I met with some folks from the Sandwich Community Health Centre and Maya from FedUp to start discussing community gardens. The meeting went well, serving as a good starting point to start figuring out what we might be able to do in Sandwich. The SCHC is working on a site on Prince Road, [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/02/communitygarden-aerial-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)
![Eric Boucher Micro-Residency Iteration 5/5 Yesterday, Eric Boucher met with my uncle, Lou Tortola, to interview him for his Micro Residency. Lou immigrated to Windsor from Italy in the seventies, when he was about ten or eleven, and is now a successful entrepreneur, established writer, and CEO of eliquidMEDIA. Over some espresso and biscotti, he talked with Eric about his first impressions [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/12/DSC05858-150x150.jpg)
![SRSI, Day 7: A Blooming Cactus & Making Potato Stamps Another day went by quickly here on the 400 block of Pelissier. I met another member of the Department of Unusual Certainties through Skype, The Breakroom celebrated its last day, Leesa painted some chalkboard paint on a few walls for her project, we found a blooming cactus in Andrea’s space and made some potato stamps [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/06/DSC_06461-150x150.jpg)
![BCL Report – Oct 9, 2008 On Thursday night, on what was supposed to be a test run for projecting on the side of the Jackman Building (the new drama building at the University of Windsor), Broken City Lab ended up exploring a number of locations on campus armed with a projector, a laptop, and a really long extension cord. Originally, we [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2008/10/Broken-City-Lab-is-on-the-wall-of-the-new-drama-building-at-the-University-of-Windsor-150x150.jpg)
![Extended Field Trip #001: Artspace in Peterborough Broken City Lab is heading up to Peterborough, Ontario for all of next week (October 12 – 17, 2009) for an extended field trip to collaborate with Artspace for a series of community and inter-city research initiatives, workshops, and interventions to understand the city of Peterborough, its infrastructures, and its communities. We’ll be blogging extensively [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/10/peterboroughmap3-150x150.jpg)
![A Set of Informal Questions about London, Ontario We want to know about London, Ontario. We’re doing an exhibition at Forest City Gallery, opening in September, and we’re looking into the wide range of narratives that go into constructing a place — the architecture, the headlines, the people, the memories, the relationships, the rumours — and we’re hoping you can help us out. Whether you’re [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/08/ATTC-London-150x150.jpg)
![BCL Report: Feb 18, 2011 (Maps & Portals) Around the maps, we’re beginning to imagine two cities collapsing into one. As part of How to Forget the Border Completely, we’re doing and planning all sorts of things — border portals, border etiquette classes, new maps, new tourism guides, interviews, stories, and imaginary architecture. Michelle and our dear friend, Lee Rodney, spoke about HFBC [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/02/IMG_8729-150x150.jpg)
![SRSI, Day 6: Arrival of Department of Unusual Certainties, Playing Badminton Games We had a very productive day over here on Pelissier Street. Chris Pandolfi joined Simon Rabynuik to form the Department of Unusual Certainties and began setting up shop in 410. Jodi Green’s knitting machine was in motion for most of the day, and Andrea Carvalho arranged a game of Badminton on Eric Cheung’s interior sod. [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/06/DSC_0973-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)
![Flagging Tape 300′ of bright orange flagging tape, $5.97 + tax. It’s fairly thin, but should be really easy to work with. We might have to double it up to make it visible on the fence, that is, double the width of each letter. We should test at Lebel later this week, or maybe on Monday before [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/01/img_1697-150x150.jpg)
![A Visual Reference for a New Year Project Based on a conversation at our last meeting on Thursday morning, I think it’s safe to say that we’re going to start on some new projects in January focused back on Windsor. Seeing at this mason jar was at the core of our conversation, it seemed like a good idea to post it on here, [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/12/masonJar-150x150.jpg)
![Urban Discovery in Calgary with Truck’s CAMPER We’re in Calgary for 9 days as part of Truck Gallery’s CAMPER 2011 Urban Discovery Project. Here’s what’s going to be keeping us busy for the next week: July 21 (Thurs): CAMPER Day 1: Exploding Calgary (interviews & storytelling) (12pm-3pm) 222 8 Avenue SW July 22 (Fri): CAMPER Day 2: Spatial & Temporal Narratives of Calgary (public mapping) [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/07/camper-150x150.jpg)
![The International Hyper-local Exchange Monday night we met with some new friends from Detroit and had an amazingly good conversation about some of the very specific differences between our two cities. Maybe unsurprisingly, much of what we perceive about each other’s cities isn’t entirely correct, and it is exactly those strange assumptions about these two border cities that continue [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/11/IMG_5195-150x150.jpg)
![Community Garden Site I went out to the site for our proposed community garden to take some photos yesterday. It’s looking fairly likely that this will be the site for our community garden starting this summer. This park is located at Russell and Mill near the Sandwich windmill. We’re still working out all the details, but everything has [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/04/img_4065-150x150.jpg)
![SRSI, Day 3: Quiet Sunday, but things were still happening It was a bit of a quiet Sunday, but things were still happening down at SRSI. In particular, Julie and Jefferson were hard at work all day, preparing their project, “The Peoples Museum & Fabulations de Windsor.” Above, and in between visits from some neighbours and friends, Julie preps a large piece of paper for [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/06/IMG_9890-150x150.jpg)
![Scavenge the City Recap A week ago, on an incredibly cold, rainy, snowy evening, we headed out on an exploration of Windsor’s downtown guided by a randomly assembled algorithm for Scavenge The City. We only made it through the first 20 steps (we stopped checking them off though), plus a couple others we skipped to by the end, but for [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/04/algorithm-original-used2-150x150.jpg)
![A Consultancy Installed Last night was the opening for a couple of shows connected to the Parking Garage on the corner of Pelissier and Park, including our project, Broken City Lab: A Consultancy. Danielle, Steven, Leesa, and I spent the better part of the afternoon (attempting to dodge the rain) in the space setting up. Along with this [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/06/img_2636-web-150x150.jpg)
![BCL Report – Sept 29, 2008 We spent a couple hours on Monday exploring some specific sites around the city to start planning some upcoming projects. Getting out and documenting and talking about these places really helped to solidify how important it is for some creative intervention/interaction with the city and how excited we are to do it. The clear view [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2008/10/Welcome-to-Windsor-sign-on-Dougall-just-off-the-401-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.