Just thought I’d write an update to my post “Internet connected computer controlling a dumb fan. Inefficiencies of the modern gas forced-air furnace“. It’s been a while and I’ve been busy. In that post I made the comment “Ideally, there would be a wireless temp sensor in each room, and an independent, discrete, heat source in every room that could adjust to the constant needs of the household.”.
With that in mind I started down a long road of discovery, building and hacking that lead me to where we are now, this screen shot:
What you’re looking at is a shot of the home screen of my Android phone (Galaxy S4). I’d like to direct your attention to the small white text beside the weather widget. This is a little widget I wrote myself last night that displays the temperature from the 6 wireless temperature sensors I build and have around the house.
What I’ve built and put together is a network of internet connected wireless sensors. Let me go through each piece.
1) Wireless Sensor:
Here is what I’ve come up with so far for the final sensor.
I owe pretty much everything to Nathan Chantrell who created what is called the TinyTX. An open source set of PCB diagrams, Arduino code and tons of know-how. You can find all the information about the TinyTX on his post here.
The sensor is pretty simple, it’s:
- a custom PCB I had created in china (with the plans from Nathan Chantrell) (built by seeedstudio.com)
- an ATtiny84 MCU
- the RFM12B wireless transceiver
- the DS18B20 temperature sensor
- a resistor and a battery pack
The best thing about this V3 board design is that it exposes all of the ATtiny84’s IO pins. In this configuration only 2 are being used but it makes it so easy to use the platform to attach pretty much any sensing probe. Temp, humidity, air quality, pretty much anything.
So far I’ve only seen people using this platform to send sensor data back to a base station. I’ve been doing some playing around and have found ways to also have this receive a signal. For instance you could have this setup to read and transmit the temp but also have it connected via the free pins to wirelessly turn on and off an exhaust fan or operate lights. You just need to build a switching circuit that’s triggered by 3.3v. I breadboarded a test of this and had a transistor switching a set of 12v PC fans.
The base code for the ATtiny84 can be found on github.
2) The Base Station (Receiving the sensor data)
The next piece in the puzzle is a way to receive the sensor data, as there is insufficient power and resources for each sensor to be connected to the internet directly.
The base station consists of:
- a Raspberry Pi – Model B
- the RFM12Pi Raspberry Pi Expansion board (you can only get the much improved V2)
The hardware is pretty straight forward. I ordered the RFM12Pi module as a kit and got it up and running pretty quickly. Installed Linux and the RFM12Pi modules.
3) The software
There is a fantastic open source project OpenEnergyMonitor.org that built a system called emoncms. It’s an MVC patterned PHP, MySQL system to log and visualize all the data that comes in through the sensors. As it’s open source, it’s extremely hacker friendly with all its code and modules on Git. I have this running on the Raspberry Pi.
emoncms is extremely flexible and a great way to capture and log all sorts of sensor data. It shows you the raw inputs from the sensors that you then map to a Feed. Allowing you to do any adjustments to the raw data as needed before being logged. In the case of temperature, I’m sending the float temp data as Int through the wireless transceiver, I then multiply the input by 0.01 to arrive back a the original float then log it to a feed.
You can also build dashboard as I did with the screen shot above. It’s very flexible and has been working very well, I did however, start playing with using it to send data back to the sensors. Nothing final yet, but when I have it working I’ll post some code to a forked repo.
4) The Android Widget (pictured above)
The last piece of the puzzle is the quickly hacked together Android Widget I wrote so I could see the temps on my phone all the time. emoncms exposes each feed through a REST API, using that API the app queries for the last feed value and displays it in the widget.
The code is in this Git Repo. It’s very rough but as there are no Apps or widgets for emoncms I’ll probably be building it out a little more over the next little while.
There you have it a full end to end system for monitoring pretty much anything you want wirelessly. It’s awesome and amazing. If anyone has any questions or comments I’m happy to chat. My next steps from here are to expand upon the simple node to base data flow and make the sensors wireless nodes that control things through emoncms. Stay tuned.
The range is about 120 metres (~400 ft) line of sight. I’m running at 433Mhz which is nice and low and penetrates walls well. I have no signals problems anywhere in and around my house. 2 AA batteries will last upwards of 6 months (estimated) as none of my nodes have died yet. In the screen shot for emoncms there is a shot of the dashboard. Under each temp there is a dial is showing the millivolts left in each battery pack.