The DHT22, also known as the AM2302 and RHT03 is a relatively cheap combined digital temperature and humidity sensor that with a little manipulation will go straight onto my TinyTX sensor board (or previous stripboard versions) in place of the DS18B20 temperature sensor.
The DHT22 is widely available and costs around £6 on eBay with delivery so not too expensive, don’t be tempted by the cheaper DHT11, in my tests the readings it returned were wildly inaccurate and it will only return integer values and only covers 0-50°C compared to -40 to 125°C for the DHT22. Someone also commented in the previous post that they had the same experience of inaccurate results with the DHT11 so it seems it wasn’t just a one off bad unit that I had.
The DHT22 has four pins but the third (looking at it face on) isn’t used, by bending the unused pin out of the way and bending the fourth in slightly it will fit into the pads for the DS18B20, the only other change required for the hardware is to swap the 4K7 resistor for a 10K. Load the ATtiny with some modified code and we’re good to go.
The gotcha here is that the DHT22 only works down to around 3V, once it dropped below 2.96V in my tests it started to return bad readings. For the moment I am just running one off 2xAA batteries (a starting voltage of 3.19V) and will see how long I can get from it. My ATmega based temperature sensor took 6 months before the voltage dropped to 3V so I should get at least that long and I could then recycle the batteries in one of my DS18B20 sensors. Failing that I could use a boost converter to keep the voltage up at 3.3V or add another battery or two and use a voltage regulator to drop it to 3.3V.
The code for using the DHT22 sensor is available on my GitHub here. The sensor uses a one wire type protocol but is incompatible with the Dallas OneWire system, I’m using the library from here although thanks to a comment from Troels in my last post I realised it has a bug regarding negative temperatures, I’ve fixed that and submitted a pull request but in the meantime you can use my fork here.
I’ve also been looking at other humidity sensors, the Sensirion SHT1x and SHT7x look good, work down to 2.4V and are easily available but they are pricey (~£20+), the HYT131 is a bit cheaper (~£15+) but not widely available. All these use a 2 wire bus to communicate so wouldn’t be as easy to use with this board as the DHT22. Probably something to look at closer for the next version of the TinyTX.
There is now a dedicated page for the TinyTX.