Sunday, August 30, 2015

Wireless temperature and humidity sensors

Our house has a crawlspace which has had some humidity problems in the past. Instead of crawling in there to check every spring and fall, I wanted to place instruments there which would do the monitoring year round. Looking online, all the available devices were either much too expensive or do not really meet my requirements (they had dubious calibration, poor battery life and so on). Partly due to this reason I started developing my own sensors. I had played around with the idea of home automation before, so this seemed like as good a starting point as any other function. Some part of me also thought that I might make a few bucks in the process, but this is yet to happen.

I wanted the devices to be small, cheap and have a long battery life. So that one could just scatter them around the house and basically forget about them. I had played around with low power electronics as well as radio communication before, so I kinda knew what I was doing. I decided on using an Atmel Atmega328P for the CPU and a Silicon Labs Si4432 as the radio IC as I had previous experience with both and knew that both of them are very low power devices with broad voltage ranges (1.8V - 3.6V for the Si4432). Also, instead of playing with all the passives required for the operation of Si4432 on the 433MHz band, I used a complete module called the XL4432 available on both eBay and AliExpress from several vendors. The big question, however, was what to use as sensors.

Figure 1. AM2302 (DHT22) on the left and DHT11 on the right.
Initially I had thought of using either Aosong AM2302 or DHT11 digital temperature and humidity sensors. As these require greater than 3 volt power supplies, and I needed to be able to run down to 2 volts, I needed to power them through a charge pump voltage doubler, which proved successful. While prototyping however it became obvious that these sensors could not be used, as they drew a lot of current at power-on. They could not be left constantly on either, as although the quiescent current was much lower that startup current, it was still far too great for a battery powered device with any significant battery life (say greater than 5 years).

Figure 2. First revision of wireless sensor boards. These use the Aosong HR202L (white box seen in the leftmost and rightmost images) humidity sensor as well as an NTC thermistor (reddish glass bead seen in the middle image).
The second idea was to use an Aosong HR202L passive resistive humidity sensor and a precision NTC thermistor. The resistances of the sensors were measured against reference resistors using the on chip ADC of the microcontroller. This idea proved successful in prototyping and I ordered a batch of PCBs from The total parts cost ended up around 6 euros per board, which wasn't too bad. I built 9 boards, which have now been measuring around the house for more than half a year. I wasn't completely satisfied with the calibration of the sensors though. They are still reasonably correct, with an error of around 1 degree Celsius in temperature and maybe slightly worse than 5 percent points in relative humidity. Of course they could be further calibrated manually, but that is a hassle I don't want to go through.

Figure 3. Second revision of the wireless sensor boards at different levels of assembly. These use the Sensirion SHT20 (marked as U2 on the lower right board) as the temperature and humidity sensor.
The third iteration uses a Sensirion SHT20 digital sensor, which has a respectable typical sleep mode current of 150 nA. This model is the low accuracy model in the line, but it is still accurate enough for me with a typical temperature error of less than 0.5 Celsius and typical relative humidity error of less than 3 percentage points. I ordered once again a batch of boards and have so far built 4 of them, which are still undergoing development and testing. So far I'm very happy with this change. SHT20 is slightly more expensive than the old solution, but the total parts cost is still only around 7 euros. I'll have my batch of 10 wireless sensors soon assembled.

No comments:

Post a Comment