Weather Updates

This is a quick update on my activities hacking the WH2 outdoor temperature and humidity sensor from Fine Offset Electronics. If you’d like to catch up on the earlier posts, here they are: part 1, part 2, part 3.

Read on to find out about an improved Arduino sketch, a Nixie thermometer project, superhets vs super-regens, and adapting the code to work with the Digitech XC0346 weather station…

Improved Arduino Sketch

I’ve written an improved Arduino sketch for decoding packets from the WH2 outdoor temperature and humidity sensor from Fine Offset Electronics.

Download Arduino Sketch (GitHub)

Compared with the old code, the new version has the following advantages:

  • The code implements timeouts, so it’s less likely to get stuck on a noisy signal.
  • More packets are successfully received. I’d say that on average, about 96 to 97% of packets sent are received. This is a pretty good outcome given the poor noise immunity of the AM modulation and the fact that the channel is open to interference from many other devices operating in the 433.92MHz band.
  • The timer interrupt now fires 5000 times a second. i.e. 4 times less often than the old code. This frees up substantial CPU time for other tasks.

In order to simplify tweaking, I’ve backed off from the library approach and included everything in the one sketch. There are advantages and disadvantages to this change in approach.

Nixie Thermometer - a work in progress

My motivation for rewriting the sketch came from my desire to build a nixie thermometer. The concept was to display temperature and humidity recieved from WH2 sensors on the nixies.

But my nixies were running multiplexed and in order to have enough CPU cycles to maintain a high refresh rate, I had to make the WH2 packet decoding more efficient. Hence a fourfold reduction in timer interrupt frequency.

The nixie thermometer remains a work in progress…

I recommend a good superheterodyne receiver…

The 433MHz receiver module I use is a unit sold by Jaycar, catalogue number ZW3102. This turns out to be a good choice.

The Jaycar unit is a superheterodyne receiver. Out of interest, I substituted some cheap super-regenerative receivers I purchased off EBay. While they worked, the number of packets successfully decoded dropped dramatically. Moreover, the reception range was significantly reduced.

The design of these units from EBay (about $1 delivered) is really primitive. Just two transistors, an op-amp, and not a crystal in sight. The front end in this circuit diagram looks close to the modules I received. Very simple and prone to noise and temperature drift.

It may just be possible that the code can be tweaked to interact better with these ultra-cheap receivers. But a crystal-locked superhet design will inevitably beat a super-regen. So if you’re having trouble receiving packets, give a superhet module a try.

The Digitech X0346

Craig Spry has reported success adapting the code to work with the Digitech XC0346 wireless weather station sold by Jaycar. This appears to be another rebranded offering from Fine Offset Electronics.

He has kindly made his XC0346 Arduino sketch available.

Craig noted that:

When I uploaded your sketch the humidity and station ID worked out of the box and and a wrong temperature value came out. After a bit more digging I found that to decode the temperature I needed to apply this formula (t-400)/10 (see link at the bottom) and then that was right. Next I worked out that the packet was 9 bytes long and once I adjusted the timeout and array lengths the CRC worked. From there is was a matter of working out how and where the rain and wind speed was stored, wind was different to the link below. I also had to change the code a bit to work with the freetronics 433 shield, changed the input pin mainly.

Link to decoding

I haven’t worked out where and how the battery low information is transmitted yet.