For almost a year I was playing with various temperature sensors and Arduino. Initially the plan was do use some cheap DHT11 sensors in order to measure soil moisture. After running number of tests I found this method not so reliable. Then, I put a number of DHT11 sensors in the house in order to measure temperature and humidity. Out of 10 sensors, only 2-3 were detecting correct temperatures. Then I tried DHT11's bigger brother DHT22. The results were much better.
The idea for this project was simple and already seen in number of different projects around the Internet:
- install a wireless node in every room of the house and collect temperature and humidity,
- send this data to the central node (using the same (upgraded) central node described in previous posts),
- store data in database,
- display data (web page, iPhone notifications).
System overview is displayed in the picture below:
The node consists of Arduino Pro Mini, DH22 sensor, RFM12B transceiver and LiPo battery (3.7v 600mAh). Construction is pretty simple, there is a small breadboard holding all the components together. Here is the schematics:
What was the biggest challenge with the node is to minimize the power consumption in order for battery to last longer. This optimization was done only in the software part. The more significant improvements could have been done on hardware level, but this I left for the one of the future projects.
The nodes were scattered around the house, and they are covering Living room, Bedroom, Admin room and Balcony for now:
The monitor node
Monitor node is built using a JeeNode, Graphics Board and LiPo battery (3.7V 1200mAh). This node is based on the normal nodes, but there is a LCD screen attached to it. On the LCD screen there is information about temperature from all the nodes.
The central node detects when the monitor node is connected, and in addition to the standard data, it sends back info about temperature in all of the rooms. On every update, LCD background light is activated in order to signalize the arrival of the new values.
The monitor node fits perfectly in one of the boxes of our living room wall clock, so the clock was used to "host" the monitor node:
The central node
The central node got some upgrades during the various projects.
I got the basic idea from excellent Ikea hack by Luc Pionchon - Electrified rat. I had to sacrifice my old friend for this. I put the whole JeeNode inside the rat, but also some red LEDs in rat's eyes as indicators of the activity (scared the hell out of my wife in the first days 🙂 ). Antenna went into the rat's tail which was 20 cm long - enough to hold the 433 MHz whip antenna. Also, I have extracted a connector for charging LiPo batteries (there is charging circuit on JeeNode) and put it bellow the tail.
When it comes to the software, the standard software on the central node was updated to include sending and receiving packages from the nodes and forwarding them to the host PC.
The biggest part of the project was to implement the communication protocol. There were couple of requirements: time synchronization, error detection, data resending and power consumption reduction.
The idea was to have time slots for communicating between a node and the central node. The time slots would come every full 15 minutes, and in meanwhile, a node would go to the deep sleep. Every 15 minutes, a node would send "ping" to the central node; and every full hour, one data package containing temperature, humidity and battery level.
Because of the deep sleep and differences in the oscillator and the components in every node, the sleep duration had to be readjusted once in a while. This is done by response from central node: exact time (internet time) is sent as a response and internal clock is adjusted and sleep duration updated.
With this kind of communication schema, one node can "live" for approximately 2-3 months with single charging of LiPo battery.
The central system
The central system was updated as well. Now, there is whole new functionality for data acquisition, statistics, nodes status overview and exposing data for web view.
In order to have all this working, there are couple of software components that had to be developed in the process:
- Library for Arduino (C++): uses RFM12B library from JeeLabs, and implements additional communication logic for detecting errors, resending of data, detecting duplicated packages, time synchronization. This library is used on all nodes and on the central node,
- Library for the Central System (C# .NET): implements communication schema, parses data from nodes' packages, sending data (proxy-ing) to the data storage,
- Library for data storage (PHP): web based library that defines data structures, stores data, provides data for the view purposes.
The software will not be covered here; there are even more software parts that I haven't mentioned. More about that will come in one of the following posts.
The system described here is already running for a year. There have been multiple upgrades during this period, each of them bringing solution to the problems noticed in the system (error detection, sleep duration adjustment, data duplication, ...).
The focus in the future period will be slightly switched to software aspects of the whole system. Stay tuned.
© 2012 - 2013, quo.vadis.stojkovic.ch. All rights reserved.
14,846 total views, 1 views today