|Web Interface Version 1 with a Google look and feel|
In this post I’ll go over some of my prototype home energy/automation creations.
Wireless Temperature Sensor
|Wireless temperature sensor with attiny45|
This wireless temperature sensor has Sparkfun’s basic 315MHz wireless transmitter, an ATtiny45, LM335A temperature sensor and a 12mm battery holder. This device lasted a couple of weeks by disabling the brown out detector, enabling internal pull ups on all unused I/O and disabling all peripherals. It periodically wakes up and transmit the temperature to a hub with an ATtiny328.
|Wireless Smart Meter reader with IR LED|
Using an IR detector from Sparkfun to read the IR signals from the Smart Meter it is possible to measure power usage with a resolution of 1 watt-hour. Since my meter was outside I had to build and enclosure to keep the sunlight out. The newer Smart Meters apparently run a mesh network to report the homes power usage back to the power company, but the signals are encrypted. Still might be worth investigating because they appear to use Zigbee. I plan to try with my new Zigduino.
By separately turning appliances on and off and subtracting the before and after meter readings it is possible to get the power usage for each device. This is actually more accurate than current clamps because the smart meter is multiplying the actual voltage and current instead of the estimated voltage. For this reason current clamps can be inaccurate for inductive loads.
Fridge - 180W HDTV TV + cable box - 130W Hot water heater - 70W Hall way spot lights full - 220W Dryer - 5840W Large stove high - 3000W Toaster oven - 1000W Notebook charge - 65W
Wireless Power Bar
|220VAC @ 20A relay and current clamp|
This was part of a wireless power bar, which is at the breadboard stage. This containes an ATmeaga168, Hope RFM12B wireless module, current clamp, 220 VAC relay, which connected to a power bar. The web interface would display the power usage of the power bar and the state of the relay. The state is controllable via the web interface.
|Wireless Thermostat with ATmega328
Blue thing is the temperature and humidity sensor
The wireless thermostat is probably the most important part of this build. It has one relay to control each part of the HVAC system: heating, AC and fan. Like the previous devices it has a Hope RF module for communication and an ATmega328 for control. I replaced the LM35 temperature sensor for a module with a digital interface and humidity sensor. The AVR runs a simple PID controller to moderate the house temperature, but a more sophisticated control methods is definitely needed. In the future it should have safe guards to protect the HVAC from overwork especially when overshoot occurs. This current version works OK, but I am hesitant to continue testing on my house. The best solution would be to build a test chamber like the folks at Nest did.
|Nest’s thermostat test chamber
(via Wired article)
Wireless Hub and Garage Door Opener
Two devices, which I have no pictures for are the wireless hub and the garage door opener. The wireless hub contains an ATmega328, Hope RF module and a usb to serial converter. It’s job was to act as a bridge between the physical devices and the computer. The garage door opener contains a reed switch to determine if the garage door was open and an IR led beam to detect if a car is in the garage.
Web Interface Version 1
|Web Interface Version 1 with a Google look and feel|
The chart is the same one used by Google Finance with a few limitations. The biggest being dynamically updating the chart without refresh. For example, sending 2 years of power data with thousands of points will either kill the browser or take forever to load. A better way would be to reduce the resolution and just get the big picture. It’s possible to hack this together, but there is no API call to refresh the data as the user zooms in without reloading the widget, which produces and annoying flicker.
This version featured:
- Electricity bill based on time of use price
- Realtime cost per hour
- Power and temperature history
- Thermostat controls (far right)
- Power bar switch and power usage (button that says light)
- Garage door controls and state info
- Parking info
The current version of this board only supports 6 current clamps so I attached them to the most power hungry appliances: the stove, dryer, ground floor, top floor, fridge and AC.Installation was fairly simple. Just switch off power coming from the mains. Remove a couple of screws to get the front panel off. Attach the clamps to one side of a wire and route the clamp wires through an existing hole in the case. Put the front panel back on and turn on the power.
For serial communication I’m using PySerial, which does the job well. To receive dynamic updates on the web page like the opening of a garage door I’m using SocketIO and Gevent. Gevent provides asynchronous functions, which wait on events in the physical world in this case. This way the server can do other things like take more requests. SocketIO provides socket like functionality to the web browser so when an event does occur on the server side the user can be notified immediately. I highly recommend this tutorial from Alexandre Bourget to learn how to build a website using these tools.
To reproduce Google’s Finance chart I’m using an awesome JS plotting library called Flot. I adding controls for each plot, a plot overview with controls to zoom and server side code to reduce the data points for large ranges. This might be useful for others so I’ll build a sample app and post on Github soon. Checkout the screen caps below.
|Web Interface version 2 – breaker panel power historical plots|
|Web Interface version 2 – realtime power plots|
|Web interface version 2 – Temperature and humidity plots
(those large spikes are bad data)
The 3 things I would like to improve are the wireless modules, web interface and the hub.
- Replace Hope RF modules with an ATmega128RFA1 with integrated Zigbee for more functionality and simplicity.
- Add user accounts to the web interface and clean up the JS code.
- Develop a hub to connect the devices to the internet. Working on a small Linux board based on the i.MX233.
- Do another revision of the electronics and iron out the bugs