Control your home’s heating and cooling from anywhere.
BY ERIC MERRILL
At my hackerspace, i3 Detroit, we have
programmable thermostats that frustratingly
reset your settings at fixed times. At home,
our old thermostats just have a setting lever,
and our power company has started time-of-day metering. So I decided to replace the
thermostats at both i3 and home with smarter, programmable, networked versions.
Standard forced-air HVAC systems are
surprisingly easy to control. The standard
thermostat cable in the walls contains color-coded wires with the following functions:
R — Red — 24V AC power
Y — Yellow — Cooling
W — White — Heating
G — Green — Fan
C — Black — Common/ground, optional
The 24V AC power comes from a 5: 1 transformer at the furnace. To turn on the cooling,
heating, or fan, you simply connect power
(R) to the corresponding wire, Y, W, or G. If
you program an internet-connected microcontroller to drive relays that switch these
connections, then you have full local and
networked control over these functions, and it
can respond to data captured online.
You may find Rh and Rc wires (hopefully
labeled with stickers) instead of an R wire.
These are heating- and cooling-specific power
sources that should connect to the W and Y
wires separately. The fan wire lets you switch
the fan manually at any time, and a standard
HVAC system also automatically turns the fan
on when needed for heating and cooling.
The Arduino has a limited number of pins, so
I used the I2C protocol to control the 24V
relays that switch the system’s heating and
cooling. I could’ve driven these 2 circuits from
dedicated Arduino pins, but the I2C protocol
lets you control multiple devices with just 2
wires, which means I can add more devices
to my system, like for fan control or a heat
pump/dual stage HVAC, without needing
more Arduino output pins. Conveniently, an
Arduino I2C library lets you run I2C’s 2 wires,
Serial Data Line (SDA) and Serial Clock Line
(SCL), off analog pins 4 and 5, and make easy
program calls to each device.
I2C runs multiple devices off its 2 shared
wires by giving each a unique address.
Components designed specifically for I2C
have jumpers or switches that configure this
address, and you can give I2C addresses to
simple, switchable devices (like my heating
and cooling relays) by using an I/O expander
chip like the MCP23017-E/SP. The protocol’s
SDA and SCL lines connect to one side of this
chip, and each device connects to one of 8
control lines (GPA0–GPA7) on the other side.
To enable time-based thermostat controls,
I included an I2C real-time clock (RTC) module, which carries a DS1307 RTC chip and a
lithium battery that can supposedly power
it for 9+ years. To simplify the hardware,
you could omit the RTC module and use the
Ethernet interface to fetch the time, although
54 Make: makezine.com/30