Welcome to my latest instructable to build a self contained information station!
This awesome device uses an Arduino Uno with an ethernet shield to connect to the internet and pull down latest news and local weather and display it on an LCD display. This project is relitavely inexpensive and has many options for expansion and further work. You can just build the whole thing out on breadboard but if you want to use a nice clean housing there is some soldering required..
So lets get started with the list of components that you will need:
- 1 Arduino Uno
- 1 Ethernet Shield. (I use the hanran shield here)
- 1 4x20 LCD display like this one. mine has a blue backlight but there are various options
- 1 Push button (push to make)
- 1 Switch
- 1 22 Ohm resistor
- 1 47K Ohm resistor
- various wires
- headers (pins)
- a small piece of veroboard and solder
- 1 housing (optional) and nylon m3 bolts / nuts
Tools: (only really needed if you chose to put you project in a nice enclosure)
- small file (and even better a dremmil)
- soldering iron
Use safety glasses with the dremmil and drill. You will need a few hours and probably several cups of tea also.
Step 1: The Circuit
As with most of my projects I highly recommend you build this project out on breadboard first before planning the physical layout in an enclosure and any soldering.
The first picture above shows the circuit drawn out and this is what you should follow.
Start by mounting the Ethernet shield on top of the arduino.
Next add the LCD display to the Arduino Uno. There are a few things to note about this
- The pins used are not the same as in most of the online examples. This is because the ethernet shield reserves the use of several pins and in particular: D4, D10, D11, D12, D13 so we cannot use those.
- There is no potentiometer used. To be honest this because it is unecessary, instead we control the voltage to the Vo pins with Arduino digital pin 9. This controls the brightness of the text and we will see later how to get this right.
Next you can add the push button and the switch.
With the switch the 220 Ohm resistor is a pull down resistor to make sure the voltge is 0 when the switch is open
lastly add the other 47k Ohm resistor which limits the brightness of the LCD backlight
Once your circuit is complete you should probably have something similar to the second picture
Step 2: The Code
The code controls both the ethernet shield and the display. The attached file (instructablesIScode.txt) here is what you need to get up and running but there is some configuration needed.
The code should work as is with the configuration below. The algorithm is basically:
- Initialize the Ethernet shield and LCD
- read the switch state and display "News" or "Weather"
- read the RSS 1 character at a time
- look for "<titl"
- save until "</titl" is found
- abbreviate / correct selected strings to accommodate the limited display length
- display the last saved story / weather to display
Download the code and open it in a text editor or the arduino editor. Then edit the following:
- IP and MAC address: This instructable gives good information on how to set these correctly
- The weather location. The example file pulls back a 3 day forecast for Manchester, UK but you will probably want to configure this for your local area.
- Go to this page from the BBC and enter your town or city as if you are looking up your weather from your browser.
- now look at the address bar and note the number at the end of the URL (highlighted in the example picture above)
- Search for "2643123" in the code and replace it with your value
- Search for this line of code: lcd.print(" (Manchester) "); and replace "Manchester" with your town or cities name
- This line of code: analogWrite(9,40); is the part that sets the brightness of the text. The 40 is the only bit to change but 40 is probably quite good so try it first
- Finally this line of code: delay (6000); Sets the amount of time the code displays each news story or weather snippet. It is in milli-seconds so this is 6 seconds but if you are fast reader you can make it less and if you are a slow reader you can make it more
I uploaded here an improved version of the code that also displays the day of the week and the date before the weather or the news (combinedwithDate.txt)
Step 3: The Physical Build
As I said previously you do not need to house your project but it looks better if you do.
I bought a 150x80x50mm Clear ABS box which is ample space.
I soldered a 16 pin hearer into the display if you have not done so already.
Then on the lid I drilled out a rectangle as a hole for the display (see picture). I then used a dremmel to break through and connect the holes (you can see this on the left hand side of the picture. Once this was done all the way around I filed the hole back until the display fit in and drilled 4 additional holes to affix it with 4 m3 bolts
With the display in the lid it will give you a better idea of where the arduino can go. I used nylon M3 bolts to bolt the arduino and shield to the base.
Cut a small piece of veroboard about 40x30mm and drill 3 holes in it. Create the 3 holes in the housing so it fits in the remaining space. Do not bolt it in just yet though as wires need soldering into it still. Basically this board just holds the (+) and (-) rails so we can reuse them and the 2 resistors.
Next I soldered wires to one side of a row of header pins twice, once for each side of the shield then pushed these into the board top. Consider where the wires go on the circuit diagram. the ones that go straight to the LCD should have female connectors on them so they can be pushed straight into the headers on the LCD. The others will be soldered into the Veroboard.
connect the wires and solder the wires into the veroboard following the circuit diagram. Once this is done I recommend checking again each wire at least once to ensure it goes where it should. It is also good to use a circuit tester to check there are no shorts between the ground and power rails on the vero board.
Next you can power on the board via the printer usb cable. depending on the position of the switch it shold load the news or weather. If it works you are done!!
Step 4: Troubleshooting
If nothing works or if something works but not all of it the best thing to do is go back to basics.
The most obvious thing to say is to check all the wiring again and make sure no wires are loose.
Next check that the display works on its own. You can do this by copying the code and stripping it back to just the lcd commands and commenting the rest
If it is the ethernet that is failing you can first try the urls in firefox browser in this format to see if they come back with information.
If it does come back with information check that the url is exactly correct in the code. Next you can try to add debug statements with the serial monitor. This is too much for this article but there is alot on the web about it including this instructable.
One very important point about the serial monitor is to remove that code before using the information station standalone because otherwise it will be trying to connect to your laptop!
Step 5: Further Work
There is a lot of scope for expansion or further work on this project, some examples and ideas are:
- using other RSS feeds to suit your interest, there are lots out there
- extend the station to include selection of more that 2 'channels'
- adding custom channels (such as next upcoming birthday in the family or a Christmas countdown)
- switching to a wireless shield