- Select the most inexpensive, scalable and easily configured components available
- Program and deploy as many temperature sensors as possible and connect to a web gateway
- Use this data for more efficient automations via smart thermostat device, window controller, presence detection, smart lighting, pellet stove controller etc...
- Create master energy record using logged temperature data integrated with smart meter API, weather history etc...
Even for those of us accustomed to living in the cold weather, the past decade has been marked by a combination of extreme cold and unusually high heating prices. It is unsurprising then that alternative fuels like wood pellets and energy saving devices like the Nest Thermostat have been in high demand.
In fact, my own interest in the IOT and OSHW as a whole was inspired in part by a desire to maximize the efficiency of a small pellet burner I installed in my basement a couple years ago. While my interest in the IOT has branched out into new directions, I find myself returning to the original project whenever the weather starts getting colder.
In short, enormous energy is wasted in either cooling or heating individual households and when residents try improving ventilation or insulation, the process relies more on intuition then on scientific data.Isnt this what a Thermostat is for?
Whether they are the standard old "dumb" models, or the programmable "learning" models like the NEST, a thermostat can only provide a general temperature reading based on its immediate vicinity. In order to accurately map how much heat travels from the basement to a third floor bedroom for example, you will need multiple sensors all over the house. On a personal note, the average smart thermostat price of $250 may be more justified than other "Connected Home" gadgets like the Phillips Hue,but its still more than my income allows... At some point I hope to get a hold of one however, so the workflow has been designed to work with or without a programmable thermostat.When quantity has a quality all of its own.
Raw data is like arms production in WW2... In that quality is directly relative to quantity. In this particular case, I've determined I need at least 5 individual sensors deployed throughout the house, for the data to be relevant.
In previous years, the cost or accessibility of available wireless networking components posed the primary obstacle. I've tried using XBee modules and individual WiFi clients in the past but after adding up the Microcontroller(Arduino Pro Mini= $7), temp sensor ($4) and wireless module (XBee=$17) the total cost-per-sensor never allowed for deployments on the necessary scale. Combined with the cost of the gateway and server, a minimal setup could easily run over $250 before factoring in time and expense setting up the server and web services. Various RF Modules like the nrf24l01 were available at very low cost but configuration always proved too complicated using software and code libraries available at the time.The Opportunity.
Several recent developments have made such a network much more feasible than ever before.
- Moore's Law continues to apply to cheaper WiFi components like the ESP8266 in particular.
- Open source community projects like http://www.mysensors.org/ have made low cost devices like the NRF24l01 much easier to work with.
- IOT servers such as NodeRED, home-assistant.io, EasyIOT and many many more can be deployed on a Raspberry Pi (which are now available for as low as $5!), providing easy plug and play networking, automation and connection to other web-based services.
- The Home Automation marketplace has finally gone mainstream, which despite grossly inflated prices for products like the Phillips Hue or the (slightly more justified price of a) NEST Thermostat have recognized the importance of providing a robust API to programmers and hackers.
One lesson I've learned from past attempts is to avoid being dependent on a single type of hardware. The network should be flexible enough to add new components and remove old ones as new opportunities become available. This applies to the various open source modules that account for most of the network as well as to commercial devices like the WINK Hub,
At present my network consists of the following components-
- 4x nrf24l01 RF Modules and 1x MySensors Gateway
- 2x ESP8266 WiFi Modules
- 5x ds18b20 Temp Sensors
- 2x TMP36 Temp Sensors
- 1x Arduino Nano
- 1x Arduino Fio
- 3x Arduino Pro Mini
Temperature sensitive devices come in many different forms and their various collection methods all have benefits and drawbacks. , Their accuracy can range from simple analog thermosisters (top row middle) which calculate temperature based on electrical resistance to super accurate contactless infrared sensors like the MLX90614 (top row right). Other popular options include DHT-11 sensors (in blue below) which measure both humidity and temperature.
In order to achieve the best balance between cost, reliability and accuracy we I've been using two primary sensor types. The DS18b20 Digital Temperature sensor and the TMP36 analog sensor. Like any sensor, both have their disadvantages. Namely the Digital sensor requires more complex code before it can be programmed, while the Analog sensor requires calibration. The best place to learn about these sensors is as usual through Adafruit-. A tutorial for the TMP36 can be found here- https://learn.adafruit.com/tmp36-temperature-sensor while they have lots of information on the DS18b20 here- https://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing
As mentioned earlier, the primary barrier to this project in previous years had been with the wireless communications. Two developments in particular have lowered this barrier significantly.
- The open source online community at mysensors.org has made it much easier to configure a network using super cheap rf modules
- Cheap wifi modules known as ESP8266 have significantly lowered the cost of communicating directly to hardware devices using wifi
In order to make the network as flexible as possible, I've designed my network to incorporate both approaches.NR24l01 RF Network
Super cheap modules using radio frequencies have always been available but they were notoriously tricky to configure and were far from reliable. RF Modules manufactured by Nordic Semiconductor and called NRF24L01 are slightly easier to configure because each module is capable of both transmitting and receiving an RF signal.
This allows for a slightly more complex "tree" network topology as is illustrated in the sketch below from mysensors.org.
Available on Amazon for roughly $10 for 10 pcs, these modules remain some of the least expensive networking options available. However, it is important to note that they don't operate as standalone controllers and require an Arduino-type board to actually process the sensor data.
The network also requires one arduino+rf module to serve as a "gateway" to the internet. If you use one the lower cost generic arduino boards like the Nano the cost per sensor would total out to roughly $12 which should be feasible. The real barrier in the past was in the difficulty of managing the complex code which relied on many different out of date libraries.
That is where http://www.mysensors.org/ made such a huge difference! With MYS setup is as easy as installing their precompiled firmware and api wherein they do much of the complicated work in managing various libraries etc... Perhaps even more importantly is the fact that they have an active user-community in which anyone can usually find help very quickly.The ESP8266
More than enough has been written about the ESP8266 as its popularity has exploded in the span of just a year! For the purposes of this project it is only necessary to point out how its use differs from the RF network we will be using. This can be especially confusing since the most common NRF24L01 modules looks almost identical to the original ESP8266-v01 (above). The fact that they share a similar footprint could actually be an advantage later on as it should be possible to create DIY adapters with voltage regulators that work for both modules.
At present the ESP8266 v01 can generally be found for around $7 each. So the cost-per-sensor would be slightly lower than that of the NRF24. A great example of a standalone temp sensor can be seen in the graphic below-
Perhaps the most significant difference from the RF network is that each individual wifi module connects directly to the internet and doesn't require a gateway. Whether this ends up being more efficient or an unnecessary drain on resources is something I hope to find out in the course of the project.Next Steps
Getting the hardware deployed just barely get's this project started. The next steps are likely going to be the most challenging.Selecting a Controller
Once the sensors start spitting out numbers, the raw data needs to be properly formatted and logged before anything useful can be done with it. MySensors.org has a list of officially supported controllers through which compatibility has already been tested. Most of these are oriented towards home automation of course and at this stage I really need something more basic before setting up a custom room-by-room temperature visualization amongst other things. Out of the most common HA platforms, OpenHAB is the only one that offers a floorplan-based interface. However, I'd long since determined the Java-based OpenHAB to be far too resource intensive for my needs and my needs have since been well served by a combination of Home Assistant and NodeRED. The temperature project is likely no exception in this regard as I could foresee using NodeRED to format the data before sending it to a dedicated database or IOT web service like www.adafruit.io. The data can then be used to trigger more complex automations via Home Assistant and a thermostat.Floor Plan Data Viz
The one missing piece of the puzzle remains any kind of platform which allows for real-time data to be mapped onto a custom designed 3D floor plan. Hopefully there are more up-to-date options beyond OpenHAB and EmonCMS of which I have tried both and ultimately abandoned.Project in-Progress
This project is still very much in progress and promises to undergo continuous revision. As a result I am very much interested in hearing suggestions, questions etc... so please do take advantage of the commenting feature!