What I Want to Do
- 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.
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.
Initial Hardware Requirements.
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.