Marc Vandenhende

METAR weather station based on AN3518 - check it out!

Discussion created by Marc Vandenhende on Jul 20, 2008
Latest reply on Aug 24, 2008 by Marc Vandenhende
Hello fellow coldfire users,

I created a small weather station based on application note AN3518 written by Eric Gregori, and which runs on the M52233DEMO board. What it does is to download the actual (aviation) weather data from a given location (hard coded in the program) and display this data in readable form on the LCD display. There are a couple of sample images of my prototype with a screen shot in the attached ZIP file. This ZIP file also contains the complete source of the project and a schematic diagram of the complete setup.

The program may need some adaptation to the location where you live. First, you will probably use a different weather location than the one currently used in the program. You'll have to change the ICAO code and the location name, both of which are located in the source file metar_reader.c. A complete list of all ICAO codes can be found here:

The time stamps used inside METAR data use universal time. This is most likely not the time at your location. The program uses a conversion routine that adjusts the universal time to the local time, but is written for my personal location (GMT+1) and also takes daylight savings into account. You may want to change that routine to reflect your own time zone. The routine that does this is called adjustDateTime and is also located in metar_reader.c.

Then there is another important note: you NEED to change the MAC address of the board to avoid everyone to use the same MAC address, which is not allowed! Change the MAC address to the address of an old network card for instance. The MAC address is located in the file ifec.c. I intentionally put an error in that source file, at the point where the MAC address is located. That way you can easily find what to change.

This version of the program only displays the current weather readings on the display. I also have a version of the program available that also displays forecasts. The display of that version is somewhat different as it needs to display much more data. It uses a scrolling text display. If people are interested in this I may publish that too.

There's another thing... I am currently trying to implement a relative humidity readout based on air and dewpoint temperature. But this requires floating point math and the use of the EXP function. I'm still struggling with this as it always results in linker errors. If anyone can help, please do!

And there's more: It may be required to use CodeWarrior 6.4 to successfully compile the program. I have tried using CW7 in the past and it compiled file, but for some reason it didn't run as expected. If you know the solution, I'll be glad to know it!

Success! - Marc

P.S. the source and documentation are available in attachment.

Message Edited by Marc VDH on 2008-07-20 05:31 PM

Message Edited by Marc VDH on 2008-07-20 05:32 PM

Message Edited by t.dowe on 2009-10-21 02:00 AM