Instructables

Google Weather on graphical display with Arduino

Featured
Picture of Google Weather on graphical display with Arduino
In this project, I am using an Arduino board to show forecast of the weather from Google Weather service on a VGA screen. The display is obviously graphical one, with icons and some colorful text. It is one of those gadgets I wanted to have for some time now – A weather forecasting display that is there just like the wall clock. Yes I know you got nicer looking things on your angry-birds machine... I simply enjoy doing it myself. Had some challenges to overcome, like Arduino has only 2KB of RAM limitation, pretty small for parsing XML data…

Features
• Current and Forecast weather information graphically displayed
• Time display from the internet, using NTP protocol
• Does not require any PC to be involved
• Indoor temperature and humidity display
• Easy to connect and assembly, only Ethernet cable and power
• Supports DHCP for network connection
• Supports both VGA screens and small 3.2" screens
• Daylight-Saving support through a user button

Some more features include change of background color between night and day for the clocks and change background color of the weather data areas depending on temperatures.

I have a newer version of this athttp://www.instructables.com/id/Weather-Underground-on-graphical-display-with-Netd/

 
Remove these adsRemove these ads by Signing Up

Step 1: What is required to build this gadget?

Picture of What is required to build this gadget?
1. Arduino Ethernet Pro (http://www.sparkfun.com/products/10536) or Arduino with Ethernet Shield
2. 4D Systems display (uLCD-32PT) http://www.sparkfun.com/products/10089 or display adaptor (uVGA II)http://www.sparkfun.com/products/10329
3. Arduino I/O headers socket
4. 5x Jumper wires (only 4 required for operation), note the display and display adaptor have male pins and Arduino typically takes female headers.
5. 2GB or less micro-SD (only needs about 150KB)
6. Power Supply
7. Ethernet Cable
8. DHT-22 Temperature and humidity sensor (optional, only if you want indoor temp)
9. Push button (optional)
10. 2x 10K Ohm resistor (optional, only if you want indoor temp)

Also for building the gadget, you will need the following
1. FTDI board, better use 5Volts one like this http://www.sparkfun.com/products/9716 one.
2. PC for programming
3. A micro-SD reader device
4. Soldering Iron

Step 2: Where to buy?

Picture of Where to buy?
All of the items can be purchased at Sparkfun or your favorite electronic components store. As for the display or display adaptor, they come pre-loaded with one of the firmware types SGC or GFX. It doesn't really matter which one you buy, as converting from one firmware flavor to the other is very simple task performed by a tool on the PC.

Step 3: How to assembly?

Picture of How to assembly?
Workshop.JPG

Please read this thoroughly as there could be notes on changes that you might want to do.
1. After purchasing the goods, download software to your PC including:
a. Arduino IDE (I use version 022)
b. 4D Systems tools for programming their adaptors or displays from http://www.4dsystems.com.au/prod.php?id=149
c. Arduino libraries including: NewSoftwareSerial, Arduino Time Library, Ethernet Library
2. Connect your display or display adaptor to the FTDI (Vcc to 5V, GND to GND, Rx to Tx and Tx to Rx, DTR on the FTDI to Reset pin) and the FTDI to USB on your PC
3. Upload the right firmware onto the LCD using PmmC Loader tool from 4D Systems (you need the GFX version)
4. Open the 4D systems Workshop tool; open the program file in the code\4D subdirectory of the ZIP file in this publication. Follow the steps as also shown in the picture for this tool to:
a. Select the right display or adaptor model
b. Select the right COM port (the one the FTDI generates)
c. Select destination as "Flash" and not "Ram" (don't forget this!)
d. Compile and Load the program to the display/adaptor
5. Place all the necessary Arduino libraries in the right location (if do not exist already)
6. Connect your Arduino to PC
7. Edit the Arduino files to match your time zone and place
a. Edit the file NTPAndTime.cpp and change variable timeZoneSeconds to reflect the difference of your time zone from GMT. If you are west to GMT then use negative values.
b. Change the variable dsSeconds to reflect the standard change from your time-zone
c. Edit the file NetArduino.pde and change the variable weatherDataGetString to match you location (change Tel-Aviv to be your city). I recommend checking in the browser that it works by typing: http://www.google.com//ig/api?weather=yourcity in your browser address field. You should see some XML reply in return if that works.
8. Open the Arduino sketch NetArduino.pde, compile and load the program to your Arduino
9. Connect your micro-SD reader to your PC with the micro-SD in it
10. Save all the files from the microSD subdirectory into the root directory of the micro-SD
11. Safely remove the micro-SD from the reader and place it in the display or display adaptor
12. Disconnect the display and Arduino from PC
13. Connect the display or display adaptor to your Arduino as following:
a. Vcc of the display/adaptor to +5V of Arduino
b. GND of the display/adaptor to one of the Arduino GND connections
c. Connect the Digital I/O pin 5 of Arduino to Rx pin (3rd pin from the right on the adaptor when VGA connector is on the top)
d. Connect the Digital I/O pin 4 of Arduino to Tx pin (2nd pin from the right on the adaptor)
14. Build a small circuit for the push button (see optional DHT sensor circuit too for schema) as following:
a. Push button connects to Vcc on one side and to resistor of 10K ohm on the other side.
b. Other side of the resistor connected to ground
c. Connect Arduino pin 2 to resistor/push-button junction
15. Connect the Ethernet cable to the Arduino
16. Connect the VGA display to the adaptor if you chose to use adaptor
17. Connect power supply to Arduino
18. Enjoy the weather

Step 4: Completing the assembly

Picture of Completing the assembly
If you also want the indoor temperature and humidity, follow these steps:
1. Build a small circuit with DHT22, Vcc goes to Arduino Vcc, GND to the Arduino GND and a 10K Ohm resistor from Vcc to the data pin.
2. Connect the data-pin of DHT22 to pin 3 of the Arduino

Step 5: Are you using Celsius or Fahrenheit?

This program displays temperatures in Celsius. If however you are using Fahrenheit degrees, here are the changes you need to do (pretty simple)
1. Edit the 4GL display program file and change the function ShowCelsiusSymbol and change putstr("C"); to putstr("F");
2. Change the thresholds of temperatures for Hot and Cold indicators (TEMP_THHOT and TEMP_THCOLD constants) to what you think is good for you (89 and 68 is the equivalents of my current Celsius settings)
3. Edit the Arduino file NetArduino.pde and change the function _ProcessWeatherXMLLine so that instead of the line:
if ((location = matchXmlTag(ptr, PSTR("<temp_c data="))) != 0)
You will have
if ((location = matchXmlTag(ptr, PSTR("<temp_f data="))) != 0).
That is take the XML tag temp_f instead of temp_c
4. Change the function Far2Cel in the same file to basically return t; instead of all the lines in there.
5. Compile and load the programs to the devices

Step 6: Adding or changing icons

Picture of Adding or changing icons
I downloaded many images, including snow.gif (last snow in Tel-Aviv was in 1950). However, it is possible that there are conditions I do not know about. Since the API of Google Weather is not documented, I honestly don't know if there are more. If you come across a missing one, here are the steps required to add an additional icon (see also pictures for using the tools):
1. Get the missing icon from Google by following these steps (see picture too):
a. Open your browser and point it to Google service by typing http://www.google.com//ig/api?weather=yourcity in your browser
b. See missing icon should be listed there in the XML in an entry similar to this: <icon data="/ig/images/weather/foobar.gif"/> with icon name instead of foobar of course.
c. Download the image by typing the following in the browser:  http://www.google.com/ig/images/weather/foobar.gif, right click on the image and save it to the folder with the images (microSD folder).
d. Launch the 4D systems tool called Graphics Composer, open the file goowea.gcs
e. Push the Add button below the list of image files and add your new icon file
f. Save the file using the save button
g. Write down where the new icon file was added (before what and after what other file)
h. Push the build button (looks like a chip with red legs)
i. Exit the tool
2. Connect the micro-SD reader to your PC and save the folder of microSD on it again
3. Modify the 4D display program to know about the new icon and place the name in exactly the same place of order as saved from step 1.g above. So if the new icon name is foobar.gif then edit the file WeatherScreen.4dg in the 4D directory (assuming foobar.gif is the name and placed between coudy.gif and haze.gif. Change the lines:
byte i_Cloudy  "cloudy.gif",0
byte i_Haze    "haze.gif",0
To:
byte i_Cloudy  "cloudy.gif",0
byte i_FooBar "foobar.gif",0
byte i_Haze    "haze.gif",0
And the lines
word IconNames
        i_coRain, i_coSnow, i_coStorm, i_Cloudy, i_Haze, i_mCloudy, i_mSunny, …
To
word IconNames
        i_coRain, i_coSnow, i_coStorm, i_Cloudy, i_FooBar, i_Haze, i_mCloudy, i_mSunny, …
4. Send me the data, please
1-40 of 47Next »
zmashiah (author) 2 years ago
After some period of time, I found few missing icons of weather and added those to the code. See the file GoogleWeather.zip

bbustin7 months ago
This is an extremely impressive project. Thanks for sharing it! The LCD display is so cool!
zmashiah (author)  bbustin7 months ago
Thanks you! After some time, I built a different one: http://www.instructables.com/id/Weather-Underground-on-graphical-display-with-Netd/ that uses a Netduino but same video card and screen. Got several more improvements there over time too.
harishp1 year ago
Really great work thanks for instructions.

I'm also doing one application which may need to use some of your ideas. I'm not using any ethernet support in my application so i'll go with Arduino Uno and uVGA II.
In my application i've to write code for Arduino and connect to VGA monitor through uVGA.

The catch here is data which is going to display on monitor ll be data transfered by some other system to my main Arduino board (may be via wireless media) and one more thing is i need to produce output with resolution 1024*768 or higher...

Any one can help me out. Will the same setup support my requirements?????.

Thaks
harish
zmashiah (author)  harishp1 year ago
From what I know the uVGA does not have such high resolution.From their site you will see the supported resolutions:
Supports the following resolutions,
- 320 x 240 (QVGA)
- 640 x 480 (VGA)
- 800 x 480 (WVGA)
If the required resolution is a strong requirement, go for Rasbery PI (but it has HDMI connection not VGA).
Is any other vga controllers avilable with 1024*768 or higher resolution compatible to any other boards????
zmashiah (author)  harishp1 year ago
Not that I know of. Please remember you have ONLY 2KB of RAM on Arduino (unless you are using Arduino Mega). There is very little you can do with it for driving a detailed 1024x768 resolution screen.

Rasbery PI is a nice embedded board, cost in same range of Arduino and running Linux. I think it is the best choice if you need to drive hi-res screen.
Tanks for suggestions.

Can we interface other modules like zigbee, sensors etc?????

I'm checking http://www.raspberrypi.org/, but i'm not getting any datasheet or full specifications.

last but not least, my application can run on any 16/32 bit controller. But getting output in monitor with high resolution is my first constraint.

zmashiah (author)  harishp1 year ago
Given Rasbery PI is Linus there will be support for Zigbee through open source libraries. I know there is at least one such library. You need to have UART support on the board to interface with these modules.
qlfecv2 years ago
Thanks for the great work.

I am using the LCD-43 and does not update the data on the screen.

I changed the rx and tx pins but still not working, any ideas?

Thks
Jose
zmashiah (author)  qlfecv2 years ago
Hi Jose,
Are you using GFX or SGC firmware of the display?
Please see the instruction on how to set it to GFX firmware.
Please see that the baud rate of the Arduino and that of the display are the same.

Do note, I made a new version of this with Netduino Plus, that takes data from Weather Underground service instead of Google. Now in my living room I am using the newer version of this with few more fixes I found along the way.
qlfecv zmashiah2 years ago
I'm use GFX firmware. I compile and upload WeatherScreeen.4dg file
I see the screen but no data. not update any data.

I am using Arduino ethernet board and do not know if it supports Netduino Plus.

Thanks
Jose
zmashiah (author)  qlfecv2 years ago
Let's start with "debugging" the situation. First, modify the 4GL program so that it uses 9600 Baud Rate. You will see the line in setup() function that is commented out. So uncomment the line of 9600 and put comment to the current baud rate.

Download the new revision of the program after modifications above to the screen.

Next, from the 4D Workshop application, use "Tools | Terminal connect 9600" to connect to the Display from the PC.

Type the following (all characters, including the square brackets)
[ICFooBar]
The outcome should be the display showing FooBar on the top of the screen for "Current Weather". If that happens, something is broken in the Arduino side.

If that does not happen, then something is broken in the serial communication of the display.
qlfecv zmashiah2 years ago
One question, what is the new version?

Jose
zmashiah (author)  qlfecv2 years ago
See here regarding the new version:
http://www.instructables.com/id/Weather-Underground-on-graphical-display-with-Netd/

And did you do this terminal test?
qlfecv zmashiah2 years ago
I test it and work .

The problem is arduino, serial port software does not work. I changed pins (4,5) for (8,9) and does not work.

I use the library NewSoftSerial SoftwareSerial because I have not

Tkns
Jose
qlfecv qlfecv2 years ago
Solved, I had to add:

pinMode(rx, INPUT);
pinMode(tx, OUTPUT);

Thanks
Jose
zmashiah (author)  qlfecv2 years ago
Good!
Not sure why is that required, but happy it got resolved. Enjoy the weather :-)
qlfecv zmashiah2 years ago
I have another problem :(

In the screen no show sunny.gif icom, only show 'sunny.gif'.

I copied directory SD in SD card.

Thanks
Jose
zmashiah (author)  qlfecv2 years ago
Does the SD contain the files "goowea.dat", "goowea.gc", "goowea.gci" and "goowea.gcs"?

Please try to format the SD (quick format is OK) and reload that content to it.
The .gif files are not really required on the SD as the 4D does not open any of them.
qlfecv zmashiah2 years ago
Where are the files?, In the zip file are not included.

Thks

Jose
zmashiah (author)  qlfecv2 years ago
In the file GW Work.zip in here you will see the microSD directory with all files I mentioned above
qlfecv zmashiah2 years ago
I am using ver 3.0 the 4D firmware no version 0.95.

I'll try to use the version 0.95.

Thanks
Jose
zmashiah (author)  qlfecv2 years ago
Ok keep me posted
qlfecv zmashiah2 years ago
working fine with v1.3 :)

Have you thought about modifying the code to work with Weather Underground?

Thanks
Jose
zmashiah (author)  qlfecv2 years ago
Yes I did. Actually I built one similar unit that works with Weather Underground and published it's code in Instructables.
As the Arduino only has 2KB of RAM it is extremely challenging to do, so I moved to a different board called Netduino. It is similar to Arduino but being programmed with C# instead of C/C++. The exact board used is Netduino Plus that has Ethernet controller embedded on the board. See this:
http://www.instructables.com/id/Weather-Underground-on-graphical-display-with-Netd/

Also note the 4D display program was modified too to include much more information I can grab from the Weather Underground service, like sunrise/sunset, moisture and barometric pressure for each day in the forecast.
zmashiah (author)  qlfecv2 years ago
OK, now that we know it is on the Arduino side, lets have the following:
What Arduino IDE version are you using? I built it with 0022 one and did not port it Arduino IDE 1.0 or 1.01

It is possible to switch between debug console and the display. In the file utilfuncs.h
change #define serialDisplay to be Serial and # define Console to be secondSerial

The the connection to the display will be digital pins 0 and 1.
On the Arduino side pin 0 is Rx, so connect it to Tx on the display
And Pin 1 on the Arduino side is Tx, connect it to Rx on the display.

zmashiah (author)  qlfecv2 years ago
One more thing:
Make sure that on the "Workshop" you set the programming to screen Flash and not to Screen Ram as in the picture below.
Capture.JPG
qlfecv zmashiah2 years ago
Yes, i programming to flash.

Jose
Thanks for the great idea! Although I don't have the ethernet pro or an ethernet shield, I made a version of this on my computer and set it up as a screen saver.
pic.jpg
zmashiah (author)  bobthebanana2 years ago
Nice! It is definitely cold in Vancouver :-)
Funny thing is I built this because I saw a sample desktop (Vista / Win7) gadget that takes Google Weather and thought I should do it with Netduino/Arduino.
bartonkt2 years ago
Hello, I am trying to come up with a complete parts list based on the above. The two big questions I have are:

1. What do you mean by "Arduino I/O Headers socket" - this? http://www.sparkfun.com/products/10434

2. Do we also need to purchase 5x "Jumper Wires"? You don't mention how many pins they need to be, or if these are single pin?? http://www.sparkfun.com/search/results?sort_by=price_asc&per_page=50&term=jumper+wires&what=products

This is the full parts list, with cost, I came up with:
3.2" LCD, $84.95, http://www.sparkfun.com/products/10089
or
VGA Adapter, $54.95, http://www.sparkfun.com/products/10329

Arduino Ethernet Pro, $54.95, http://www.sparkfun.com/products/10536 FTDI Breakout board, $14.95, http://www.sparkfun.com/products/9716 DHT 22 Temp & Humidity sensor, $9.94, http://www.sparkfun.com/products/10167
2 GB Micro SD, $6, Amazon.com
Push button, optional, $1.95, http://www.sparkfun.com/products/9339 Power supply: Free, probably have one around the house
Ethernet cable: Free
2 x 10k ohm resistors: Free, or $0.25 each from Sparkfun
Jumper wires: ???
Arduino I/O Headers: $2.50, if I'm right above. 

Total Cost (without shipping charges): $175.25 or $145.25
zmashiah (author)  bartonkt2 years ago
Both VGA or LCD is shipped with male 0.1" headers that you need to connect to the Arduino board. The board itself, if you buy the Ethernet Pro comes with holes and no wires or headers. Total number of pins you need to connect is 5. You can choose to use wires to connect them or using jumper wires and socket. I chose to use male headers like this one: http://www.sparkfun.com/products/116 but it is really up to you.
The jumper wires in this case are female-female ones like this one:
http://www.sparkfun.com/products/8430.
Y
ou will need 5 wires only and cost for a pack of 10 is $ 3,95.
Since I build a lot of stuff, I bought a stock of those in local shop for much cheaper. Try Fry's or something if you are on the west-coast.

Buying either the VGA or the LCD at at 4D systems can save you few dollars.

Ethernet Pro is a nice and compact, but if you want to save few dollars, you can buy an Arduino Uno and Ethernet Shield (Uno is ~ $23 and shield is ~ $ 15 in ebay). I did not test it with those shields, but assume it should work too. If you are not ready to do the adaption in case needed, go for the Ethernet Pro. One more comment on this, since you asked: If you go for the shield based approach, you will not need headers (those ship with female headers), but you will need a male-female jumper wire instead. 

FTDI is required (can be spared if you go for Uno+Shield) to program the units. Not required after assembly work done. That too is something I have at home...

DHT-22 is optional. But I noticed you did not include a small experimental or prototyping board to assemble it on together with the resistors and push button. You will need something like this or much simpler one you can buy at local shop that will be large enough to host multiple projects. It cost around $ 4 to have a large board that is about 10x the size required in this project (and you simply cut the size you want each time).

As for the SD, if you don't have a 1GB micro-SD somewhere from an old cell-phone or something, go for the 2GB. I think even a 1MB one would be enough, if there was such thing.

Yes, it is an expensive one, but the joy of doing it was worth every cent, penny or Shekel in my case :-).
Nick_de2 years ago
http://www.nuelectronics.com/estore/index.php?main_page=index&cPath=1
zmashiah (author)  Nick_de2 years ago
Hi Nick,
It might be possible to do this with "standard" LCD module. The code that I have here on the Arduino is basically scrapper of the XML data from the weather service (Google weather) and the entire graphics is handled by the display controller. I did not do much of graphics really (basic tiles with hand-made shading, text with variable font size and color, rectangle fills and bitmap display). All this graphical part is done in the 4GL code for the 4D systems VGA display adapter. I used it also on their LCD display (uLCD 32PT unit and it works).

The challenge will be with memory. The Arduino has enough of memory for code (about 24K used out of 32K it has) but the big shortage will be of RAM. The code already puts strings into program memory (using PROGMEM and PSTR). Not sure exactly how much memory really left, but can tell you that if you move some of the strings back to data the Arduino will reboot or behave very strangely, meaning data segment is really at the edge. Not a surprise, since overall it has only 2KB of RAM for data. Add to that the bitmaps are about 3K each, then loading those from SD to display will require working in small chunks, which is not fun. It might be more realistic to use the Mega flavor of Arduino that has 4KB of RAM for data for this type of application. The display controller has about 10KB for code and data, and I use about 5 or 6KB of it, again 3K for bitmap transfer from SD (it has its own micro SD socket), so not a big surprise. For the record, I tried this also with FEZ Panda-II (a Netduino flavor ARM board), their LCD module and Ethernet Shield. While I was able to complete the code in fraction of the time, the board was running out of memory irregularly, even before using NTP for time updates. I added aggressive garbage-collection calls but in vain. Once a day, out of nowhere the memory was eating up in one round of update from the Web service and the application will do the exception. That board has 62KB or RAM and the application code (it is C#) was weighting about 54K, so again on the edge of the resources, not exactly what you want to do with C#. I guess if I worked harder (not using XML library and stuff like that, but do it more specific as in the Arduino), it would fit, but then what is the point of using C#?
WOW, thanks a lot for the very detailed response! I always wanted to make a system to display when the next bus or tram is coming to my stop...
But to make a nice colourful & fancy display will take time and money so in the end I'm afraid I'll just use a simple text-only LCD display.
Again, nice work and thx for the reply!!
Nick_de2 years ago
Nice Ible!
Do you think also the LCDs present on this page would work?
Excellent work ! I will definately look more closely at this in the future...nice ...very nice!
Thanks for the ible!
Build_it_Bob
Thanx for the url: http://www.google.com//ig/api?weather=yourcity. I can add that to my page scraping project.
zmashiah (author)  Computothought2 years ago
Replace "yourcity" by the name of the city you live in.
So for me, living in Tel-Aviv the string looks like:
http://www.google.com//ig/api?weather=Tel-Aviv
1-40 of 47Next »
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!