October 19, 2013

Wireless HVAC Sensors (temperature and humidity)

As I've been working to transition control of my HVAC systems over to my Raspberry Pi there has always been one big hurdle to overcome: how to I get the temperature reading from the room I'm interested in to the Raspberry Pi in the basement?

When I first set up my Raspberry Pi thermostat project, I was collecting temperature on an Arduino with RN-XV wifi module for communicating with the Raspberry Pi. This worked well enough to get things started, but was far from ideal. First off, the RN-XV put off some heat that would show up by as much as +5 degrees on the temperature sensor (significantly less when putting the module to sleep). Second, the price of the RN-XV was somewhat prohibitive, coming in at $35 each from Sparkfun, and that's not even including the supporting Arduino. I'd like to monitor temperature in multiple rooms and maybe even set up zones, so a minimum of $35 in each room is a tad steep. Third, powering the thing meant having it tethered to an outlet somewhere.

I wanted a cheap, wireless, battery operated sensor that I could place anywhere in the house. In addition, I wanted it to look more or less like it belonged there. So I've been putting in a fair amount of time recently to develop a new circuit board.

For wireless communication, I'm using the easy to find and unbelievably cheap nRF24L01+ module (black daughter PCB in images above). I found on eBay a set of 10 for a little over $12. The micro controller is an ATTINY84 running on the 1MHz internal oscillator. On the sensor side, I have space for a DS18B20 and TMP36 temperature sensors (presumably you would only use one or the other) and a HIH5030 humidity sensor. For power, I use a single LR44 button cell battery with a MCP1640 boost converter to boost the voltage to 2.7V. I have estimated the battery life to be somewhere in the 6 month to 1 year range using sleep modes where ever possible, but that's yet to be confirmed. I have set up the micro to be able to read the battery voltage to be able to send out a low battery warning.

You may be wondering about the shape of the PCB. Like I said above, I wanted this to look like it belongs in my house when installed. The various holes on the ends allow it to mount inside a standard electrical box under any of the common size face plates (I would not recommend putting it in the same box where house mains power is present). When used with a light switch face plate, the sensors are positioned to be directly behind the small rectangular opening to allow for good air flow to the sensors.

Software on here was a lot more difficult than I was planning on, mainly due to the wireless module. The ATTINY84 does not have a dedicated SPI bus, so I was forced to learn how to communicate to the nRF24L01+ in software via bit-banging. I did get it figured out, though, and things seem to be working fine now. As far as the programming language, I found this site that explained how to get it up and running in the Arduino IDE, and most Arduino functions work on the ATTINY84 as expected. It does require an ISP programmer to upload the code. I would highly recommend buying a dedicated programmer, but a spare Arduino can be made to work in a pinch.

There are about $10 of components on the board including the wireless module, but not including any of the sensors (a TMP36 is fairly cheap, but the other two are pricey). This is my first version of this PCB and its far from perfect (as you can see in the images above), so I'm not going to put this one for sale just yet. I do have a load of these boards though, so if you want to play with it send me a message and we'll work something out.


  1. Any updates on this project? I've been thinking of doing something along the same lines. Your other posts are very interesting. We tried out Sous Vide as a result, and got one of your relay boards and built it up as part of building a raspberry pi based HVAC controller.

    1. Just a few days ago I ordered a new batch of circuit boards to fix the jumpers I had to add, and also to up size the batteries to two AAAs.

      My estimate of battery life was grossly off. This is my first time ever playing with sleep modes on a microcontroller, so it's probably just that I didn't get it set up right. But regardless, AAA batteries are much more available and probably a better choice for this application.

      I'll write a follow up post once I receive the new boards and test them out.

    2. Any chance you would share the code you're running? I have the same hardware bread-boarded, but I've been having problems getting the spi comms to run reliably. Thanks

    3. The code is available here:

      It's still a work in progress, you may find a few errors or some places where the comments aren't clear. But it should send you in the right direction.

      I just received the new batch of circuit boards today. I'll be doing some more testing and blogging over the coming days.

  2. Just to let everybody know, I will be writing a followup to this post very soon, hopefully within the week if I can set aside the time to do it.

  3. The website is looking bit flashy and it catches the visitors eyes. Design is pretty simple and a good user friendly interface.
    National Air Warehouse

  4. The problem is that even if you have several air purifiers running, even air purifiers with UV light, the air still has to get to the air purifier to be cleaned, and many times you breathe the unpurified air before it can be cleaned.
    central air systems

  5. A HVAC authentication is fundamental for each HVAC specialist and also HVAC design that is required for taking care of and buying refrigerants. The U.S. Natural Protection Agency manages a test to different offices, and the distributed appraisal covers 3 vital areas heating repair somers,ny

  6. When any appliance starts making noises it's never made before, especially if the noises continue for a period of time or even get worse, you can benefit from calling in an appliance repair technician. Your air conditioneris no exception. Toronto Air Conditioning Repair