Room Sensor Package



As I continue to slowly add more functionality to my home automation setup, one area that I’ve found could use some improvement is climate control. I only have a single Nest thermostat providing temperature/humidity data for the entire house, but both of those are noticeably different in the basement vs. the main floor so any intelligence I build in for regulating climate wouldn’t really have enough data to do it properly. Google DOES make a $50 temperature sensor for Nest that would provide that capability to the thermostat itself but I wanted a little more control over how the data is gathered/processed, the feature set available, and the price – the challenge of doing something new was also a factor! I already had some cheap ESP8266-based boards sitting around from a previous abandoned project, so all I had left to do was decide exactly which sensors would be the most useful. I settled on a BME680 board for temperature/humidity/pressure (it does gas sensing too, but I’m not currently interested in that data so I’m not using that feature for now) and a VEML7700 for light levels/quality. The climate data is the most important for me, but the light sensors are very cheap and can have future uses like detecting day/night, or alerting if non-automated lights are left on. There are also handy Adafruit libraries for both, so that was a factor when deciding on those board specifically.

Making it actually work was fairly straightforward; the code required a little trial and error but with the available libraries and a little bit of research there wasn’t really a lot to it. I already have an MQTT broker set up to handle communication with the WiFi outlets, so I opted to use that here as well. The sensors publish separate topics for climate and light data, with the data itself sent as a JSON packet – again this is the same as my setup for the outlets so reading it all in OpenHAB will mostly be copy/paste.

I also needed some sort of box to put everything in! I researched a few examples of other similar projects and modeled/printed a few different prototypes trying to find the right balance between size, ease of assembly and external access for the sensors. I eventually settled on the design you can see in the photos; it could likely be a little smaller, but it does provide plenty of room inside for easy assembly and the protruding temperature sensor area reduces the impact of the heat generated by the electronics on the temperature reading. Assembly was just a matter of screwing the NodeMCU to the standoffs and using a little hot glue to secure the sensors in place. You’ll probably notice that the spaces for the sensors are much larger than they need to be – I ended up doing that because on one set of sensors I soldered on right-angle connectors as an experiment with a previous prototype that I thought was going to work, so I left the additional space to make it easier to connect those. Making the sensor areas the appropriate size for the sensors would be one easy way to reduce the overall size of the enclosure!

All in all I’m fairly pleased with how this turned out; I get a ton of useful data for minimal time/money. In the end the total cost for one of these sensors is probably not much less than the one Google provides, but I’m also getting way more data for that price so I still consider it a more cost-effective option – you could ditch the lux sensor or probably find cheaper sensor/ESP8266 options to lower the cost even further. I’ll include a link to the code, STL files and basic wiring diagram in case anyone wants to make this themselves or use any of that as ideas for another project.

© Dave Parsons Creative Commons License