Weather station

weather-station.zip (102672Bytes)

I finally made it: Got my weather station up and running. Well, actually it's been running for about two weeks now but I've been too lazy to post it and I've been making little improvements here and there.

The whole system has remote unit, main unit and a Linux PC. Communication between remote and main units is done with RFM12B RF-modules. Main unit communicates with PC via USB serial connection. And of course there's Twitter connection via http (thanks CtC and Glen the Stove for the idea).

ws-system.png


Weather station system

The system and communications in general:

All communications use datagrams that have 16-bit CRC included. Remote unit sends new measurements to main unit about every 20 seconds. Main unit’s main loop waits until it receives a datagram containing measurement data from remote unit. Then the main unit reads its own SHT15 sensor, adds that data to datagram and sends the datagram to PC. After that the main unit asks min/max values and current time from PC. Min/max values have minimum and maximum temperatures for 12 and 24 hours from both inside and outside (main and remote unit).

RFM12Bs use SPI for communication with ATMegas. Both BMP085 and SHT15 use I2C. Well, SHT15 uses “I2C compatible” protocol that is not exactly I2C but it doesn’t mess up other “real I2C” devices on the same bus. Check SHT15 datasheet for more information.

Remote unit:

Remote unit runs on ATMega168. It has BMP085 pressure sensor and SHT15 humidity sensor. Temperature is measured with SHT15 (BMP085 measures temperature too). LDR is used to measure light level. Battery voltage is measured too. ATMega talks to RFM12B via SPI. Remote unit is power by 4AH lead acid battery.

 

ws-remote_01_small.jpg


Remote unit opened

ws-remote_02_small.jpg


Remote unit closed and ready to go out.

Yeah, I know it looks kinda funny :slight_smile: Those yellow ping pong balls contain BMP085 and SHT15 sensors. The casing for remote unit has a lot of unused space because I was planning to make wind speed and direction measuring thingy too but never got it ready (maybe in V2).

Main Unit:

 

Main unit run on ATMega168 too and like remote unit it has SHT15 sensor for measuring humidity and temperature. RFM12B comms is similar to remote unit. Main unit has FTDI FT232RL USB UART chip for USB serial communication with PC. Main unit’s display is 20x2 character LCD. LCD’s data is transferred via 74HC595 serial-in-parallel-out shift register. 2 direct IO pin connection are used to control LCD (E and RS pins). Main unit gets its power from USB bus.

Main unit has main display, min/max displays and a couple of displays for error statistics.

ws-build-01_small.jpg


LCD in the box

ws-build-02_small.jpg


Solder side on main unit’s perfboard (inside the box)

ws-build-03_small.jpg


Component side of main unit’s perfboard

ws-main_05_small.jpg


Buttons and SHT15 connected

ws-main_06_small.jpg


Main unit front

Main unit’s SHT15 sensor is hanging on its wires because it seemed to show a bit too high temperature is it was placed nicely on the side. Maybe it was the heat from components (or just my imagination).

PC:

PC is running Ubuntu 10.04 server edition. Weatherlogger daemon uses (USB) serial port to communicate with main unit. It logs measurements sent by main unit to Postgresql database and sends min/max and time information back to main unit. PC also updates Twitter status and profile image every 10 minutes.

That’s about it:

Yup, that’s about it. Schematics are missing because didn’t draw them and I think I’m too lazy to draw them afterwards, sorry. Source code package (https://www.robotshop.com/letsmakerobots/files/weather-station.zip) includes README.txt file that has some (very brief) instructions how to compile the source. Source code includes with abraham-twitteroauth (https://github.com/abraham/twitteroauth) that has been patched to support image updating (https://github.com/vsr/twitteroauth/commit/06306eb17c748bfff0215bc7580baf38360a78f0) to handle Twitter’s OAuth. Some BMP085 code has been adopted from examples made by Bosch Sensortec GmbH.

Check out the latest weather here: http://twitter.com/saamies

 

Nuumio !

Great project !  Glad you posted it, have not seen your entertaining posts for a while. And Jeeze it’s COLD where you live (I looked @twitter posts) !

A couple questions :
I have not seen the  RFM12B before, what led you to choose that? I have a couple WRL-08949 and corresponding transmitters.  I have to say I’ve been fighting with Arduino library timer conflicts (not so fun).  I can also see the advantage of a single transceiver. Is it full duplex?  Is the 16 CRC datagrams come as part of a library, or did you roll your own?  

Does the SPI library reserve timers?  Was it relatively painless getting the RF stuff to work?  

WOW ! - 115K kbps?  Have you tested that?  What’s the real range?

I think I know what I’m ordering from Sparkfun next if your response is favorable towards the little devices…

PostGres ?!?  vs MySQL  ??  I’m shocked you went with Berkley vs the Number 1 National Product !  What will you say to Mr. Widenius?


Good Stuff Nuumio !

Been busy

I’ve been busy at work. That’s why I haven’t posted anything for some time.

Some answers:
RFM12B: I found these when I was browsing an online store (http://www.tme.eu). They seemed cheap enough to give them a try. I’m using it as half duplex. I have to admit that I haven’t checked the documentation to see if it could do full duplex. I just assumed it wouldn’t. 16-bit CRC is from AVR libc (http://www.nongnu.org/avr-libc/user-manual/group__util__crc.html#ga1c1d3ad875310cbc58000e24d981ad20). Easy enough to copy the implementation to PC software too.

SPI lib and getting RF to work: Well, there’s no SPI lib. Just my rf12-driver using SPI. But I’m using a timer to handle timeouts. To my surprise RF worked at the first try. But then again I found some examples from the Internets. I’m planning to use more RFM12Bs if I ever need wireless comms (at least with “low speed” needs).

Speed and range: I haven’t tried 115K. I did some range test with 4800 baud earlier (see Update Nov 13, 2010 in here: https://www.robotshop.com/letsmakerobots/node/23423). In short: With a line of sight it works well in about 80-90 meter range.

Now there’s one brick wall/window between main and remote units and they both have casing (and antennas are inside). Distance is only about 3-4 meters. Currently there have been 16949 datagrams successfully received from remote unit and 91 datagrams with CRC error. So it’s about 0.5% error rate. In my initial tests I got no errors but it was with less than 0.5 meter range without any casing. I’m using 868MHz “free-to-use” band so there might be so interference too. I have implemented ACK for successful transmissions but NACK+resend are missing.

About Postgres: Well, MySQL is kinda “default choice”. This time I wanted to try something different and chose Postgres. Mostly because I wanted to learn how to use it.

 

Nice to see you have

Nice to see you have finished you project, nuumio. I’ve followed your blog with interests:)

Lib for the

Lib for the Arduino.

http://jeelabs.org/2009/02/10/rfm12b-library-for-arduino/

and for avr.

http://www.das-labor.org/wiki/RFM12_library/en

 

hacked

youve been featured on hackaday
http://hackaday.com/2011/03/15/wireless-weather-station-obsessively-reports-the-temperature/
 

Thanks for links

Gotta check out that AVR version some day and see how it’s done.

Yay!

Me famous! :wink: Thanks for sharing the info.

Now I feel a bit ashamed because I didn’t finish it with all planned features. At least wind measurement and solar cells are missing. Maybe in v2…

 

Very cool! I mean, cold.

Very cool! I mean, cold. I’ve been thinking of making something similar, but haven’t gotten around to it. I found out about a web service called Pachube that is built for something like your project. It’s pretty much an online weather data graphing setup kind of thing… yeah, I explained that well.