Let's Make Robots!

Weather station project, the beginning

I've been thinking about making a weather station for a while. My goal is to have it running when I go for a two week trip at the end of the year so I can check how cold it is back here in Finland :-) To put it simply, the idea is this (the usual weather station stuff I think):

  • Remote unit outside checking the weather and transmitting data to main unit
  • Main unit inside showing temperature and stuff and also measuring room temperature
  • PC logging data
  • Remote access over Internet (or Twitter feed, or Facebook thingie, or something...)

Last Saturday I finally got started and it's been going pretty well so far. I got FT232R USB UART chip working, Hope RFM12B transceiver modules are handling wireless data just fine, SHT15 is giving me temperature and relative humidity readings and my LCD is displaying those readings. Of course it's all just a big mess on breadboard at this point. Well, actually on two breadboards and a piece of perfboard. This is how it looks like (click to get the big picture):

Would you believe there's wireless connection between remote and main units?

Here's a small explanation of the picture above:
Upper left: FT232R USB UART connection from PC to main unit
Upper right: Remote unit with ATTiny2313, RFM12B rf-transceiver and SHT15 temperature and humidity sensor
Lower part: Main unit with ATMega168, RFM12B rf-transceiver and LCD

What's missing? Well, at least nice casing for all the stuff, wind measurement thing (although I don't have good place for that), rain gauge (won't need this until spring), barometer and lot's of software. I can probably (hopefully) deal with those. One thing I'm not so sure about is how to power the remote unit. Lithium batteries would probably be the simplest approach (and my plan B). What I really would like to do is to have solar power for it. Only problem is the long, cold and dark winter here in Finland. That means I must have some kind of battery for the remote unit and that battery has to stand -40°C (temperatures below -30°C are not uncommon here in winter). So far only thing that I can think of is lead acid/gel battery and charge that with solar panels when it's sunny. I have to do some more digging around the Internet because I'm really not a battery expert. Any good suggestions for batteries are welcome :-) Anyway, if I can't figure out the power problem I'll make a forum post later.

What I'll do next: Maybe (try to) build a wind measurement thingy. And browse the Net for batteries.

 


 

Update Nov 12, 2010:

I just added a snapshot of my current code. Some things to note:

  • ATTiny-rf12-transmitter-v0 is for ATTiny2313
  • ws-main-unit-v0 is for ATMega168
  • Both ATTiny and ATMega use internal oscillator @8MHz
  • Main unit code uses floating point math so make sure you use correct libm (at least AVR Studio+WinAVR uses wrong one by default)
  • Bugs expected. Don't fry your chips if you try my code :-P

And here's a list of some (not all) resources I found useful:


Update Nov 13, 2010:

Another update for those who are interested about RFM12B's range. I did some testing and got some results even though the weather wasn't very good (at was snowing) and it was already getting dark until I got my test software ready.

Here's some estimates of ranges I got:

  • Main unit placed inside by a window. Remote unit outside with me: I got maybe 40-50 meter range without problems. At that range I had to stop and "get out of the way" myself. Holding the remote unit steadily and keeping myself out of the way I was able to get about 70-80 meter range. I wasn't able to test it further away because at that point another building was starting to get to the way.
  • Both units placed outside and trying to keep line of sight: I got maybe 80-90 meter range without any hiccups then I occasionally had to stop get a clean signal. I was able to get transmission as far as 170-180 meters away but then I really had to search for a good place for reception and align the remote unit "correctly".

[Ranges are estimated using my "gut feeling" and a 1:2000 scale map. Laser range finder would be nice toy here :-)]

So, RFM12Bs are definitely good for my weather station and at least short range remote control. I used really simple "send and wait for ACK" protocol in my test and there wasn't much data to be transferred (15 bytes back and forth every 1 second or so). Using a bit more sophisticated protocol with resend and other nice stuff would take care of some hiccups at smaller ranges. Also, I used my transceivers at 4.8kbps speed. Higher speeds may or may not work at the ranges I got.

I've also updated attached code to the version I used in my tests today.

 

AttachmentSize
ATTiny-rf12-transmitter-00.zip10.37 KB
ws-main-unit-00.zip8.89 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

@nuumio Please upload a schematic diagram for ATTiny-rf12-transmitter- and main unit. Thanks in advance.

other sensors that might be nice to have out there would be a light sensor to record when it gets dark or sunny, and barometric pressure - as it goes lower you can predict rain or snow.   but obviously those would place more demand on your power source.

an oversized deep-cycle marine battery will sustain you through numerous cloudy days, as they are made to be charged and discharged fully many times.   whereas a typical lead-acid car battery is not designed to be discharged fully at all.  in fact, after 3 or 4 times they are ruined.   but they are designed for the cold weather.   deep-cycle marine batteries will loose some charge in cold weather.    to charge a 12v battery, give it 14.5v.

size your solar panels to be 3 or 4 times the amps (or more) you need to operate your station so you store enough juice for night time.   make sure you use a diode to prevent solar panels from draining batteries at night.

Barometer is on my shopping list already. Light sensor is a good suggestion. Didn't even think about that. Luckily I have some extra LDRs. I just have to use RC circuit or some other trick to read it because ATTiny doesn't have ADC.

With current setup the power consumption isn't a big problem. If my calculations are correct I get about 0,6mW average power consumption (~0.18mA @ 3.3V) if I do one measurement and update per minute. This includes SHT15 temperature and humidity sensor, RFM12B, ATTiny2312 and 5 IR leds (wind direction and speed measuring with homemade encoders). SHT15 and RFM12B will be in sleep mode when not used, leds will be on only when measuring and ATTiny will be sleeping when nothing is happening.

I've been thinking to try a 6V lead acid battery. I have two 4.8V/108mA solar panels and I'm hoping I could use them in series to recharge the battery. Those panels seemed to have somewhat higher voltage than rated when tested them. Unfortunately I don't remember the exact value. I'll have to test them again later (when the sun comes out again). If I have understood correctly I'll have to make sure the charging voltage stays below gassing voltage. To make things even more complicated the charging voltage seems to be temperature dependent. (I found some info here: http://www.powerstream.com/SLA.htm). I just have to find a 6V battery that can stand -40°C and has relatively small self-discharge rate.

Thanks for suggestions and information :-)

yes, those 2 panels in series (9.6v) would be great to charge the 6v battery.   I wouldnt worry about gas levels.   I just bought these batteries, 6v, 4.5aH, $10.  I wasnt planning on using them outside, but I think they would be alright.

how many times per winter season do you expect to see the extreme of -40c ?  

the current of 0.18mA seems very little for a chip and sensors which are measuring and transmitting every minute.  (my little compass bot consumes about 25-75ma.)     if thats right, you will easily be able to live off a battery and those panels charging.   if its really 0.18a, your going want to double those panels, or more.

how do you wake ATTiny?

Ok, if gassing shouldn't be a problem then this is easier. Anyway, I was looking for relatively cheap battery (like your $10 one) at least for starters just in case it gets killed :-)

During the winter we get below -30°C maybe one to two times, but not necessarily every winter. As far as I remember it has never gotten to -40°C. Coldest winter I remember was 2 or 3 years ago. Back then we got -36°C at one night (It was fun trying to start a diesel car at morning when it was still that cold). Long term average temperature during winter season (Dec-Feb) is about -8°C (according to Finnish Meteorological Institute). So freezing shouldn't be a problem if I can just keep the battery (almost) fully charged. Lead acid batteries freeze around -40°C when fully charged if I've got it right. If the battery I choose can just take it physically, meaning no nasty cracks or anything like that because of the temperature changes/extremely cold temperatures, then I guess I should be fine. I've seen some cheap 6V batteries around but they were rated for temperatures above -20°C.

SHT15 and RFM12B both consume 0.3μA (yup, microamp) when in sleep mode and 0.55mA (SHT15) / 25mA (RFM12B) then measuring/transmitting. SHT15 is on about 500ms per measurement and RFM12B about 40ms per update. That is of course assuming I get power management going as planned. I haven't done that yet. And of course there's going to be some power loss at the system (3.3V regulator for example) and at least barometer must be added but the power consumption should still be quite low.

My plan to wake ATTiny is to use its watchdog timer which is running even if the chip is in power-down mode (consuming max 6μA). I haven't tried that yet so I'll have to do some testing to see if my plan is going to work.

 

all sounds good

I've never heard of gassing.  I assumed you meant overcharging.    if the sunlight is in short supply, you would be lucky to have that problem :-)

 

Interesting project nuumio! I`m also curious as to the real world range of those RFM12Bs.

It shouldn`t be hard to find an alternative source of sustainable energy. Your whole setup should only need 10s of mA when transmitting. When not transmitting put the attiny into low power mode and use the watchdog to wake periodically for readings. The RFM12B may have a low power mode too, or you could turn it off with a fet when not used. Do you get enough breeze for a wind generator? If you have frequent rain what about a small bucket and water wheel generator? Piezo crystals near a busy road could get enough vibration and noise to generate.

I just tried those RFM12Bs with little longer range than 10m. Now the range was maybe 30-35m with couple of walls between transceivers and still working fine. Not a real range test yet but it's looking good. Note that I'm using only 4.8kbps speed. If the weather is fine I'll try to do some real range tests during the weekend.

You are right about the power requirements. RFM12B data sheet says 25mA max in TX mode using 868MHz and 0.3μA in sleep mode. Right now in my tests powering up TX, sending 15 byte datagram and powering down TX takes about 35ms. I can probably use lower power on TX than the maximum so there's not too much power required for one update from the remote unit.

Thanks for alternative power source suggestions. Wind generator could be useful although there are many windless days too. Could be worth trying if I can find affordable one. Water wheel is a no go in the winter (not much water in is liquid form :-) Piezo crystals... Maybe... there's a road close by but it's not that busy.

If you had a compost bin you could use the heat inside it to cycle water around a pipe :) Or a laser pointer connected to an AC adapter in the house and aligned to hit your weather station on a small solar cell. Actually I`m not even sure solar cells work with lasers.

I'll have to ask my neighbors if they could so kind and dump their biowaste to my backyard ;-)