Keeping with the tradition of doing temperature related things with the Arduino, I decided that I was going to finally get my LCD display working and make it extra fancy by hooking it up to the internet.
Unlike with the Twilio project, we will be fetching information and displaying it on our device. To fetch the information, we use World Weather Online's API. One limitation I quickly discovered was the Arduino does not have enough RAM to be able to download the entire XML response and parse it out. To get around this, I introduced a PHP middleware script that parses out the information we want from the XML response and returns them in a format that is more manageable for our Arduino (the format is pipe delimited). All of the code associated with this project can be found in this github repo.
Here is what our circuit looks like:
The ethernet shield that I'm using uses the SPI bus which consists of pins 10-13. Even though they're physically available they are being used by the ethernet shield. It should also be noted that I'm using a 4 line LCD display. The 4 line LCD has the same pin layout as the 2 line LCD and uses the same functions from the LCD library.
Our process can be described as:
- Connect to internet
- Grab output of PHP middleware
- Use cURL to access the World Weather Online's API
- Parse the XML
- Return the information we want in a format more digestible for the Arduino
- Parse the output and display on the LCD
- Go to 2
Again, all of the code can be found in this github repo. Rather than adding much explanation on the blog post, I tried to be as descriptive as possible in the comments.
Here is what the finished hardware looks like: