![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbzzpZ5e7KVN6BlC27dY7LuMa4pZHIfRZ9Wupp8nYN5gSxxD1Cl96qn8giLbXh3AEl_dietwhmMzFOFyKwZA52mlHUZ8F8mC_ofrvnkxSok9AqOspwxgho3CfTNHf2kpNL_nOe/s400/2016-01-08.jpg)
My apartment's thermostat uses a very simple mechanism to control the heater:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAbus-B14fCTu-XVZWDg2nFRnXtnyzYuHgk-3rfYQbQFfivl0udp9LM3jwYQ2P_PwRl51vHne632Q6-FliqzkoGW0D5mpRiijQZf0hsE9HN8-i3JJdUBnIcLxpKxJ8G80rZFNG/s400/2016-01-09.jpg)
Connecting the red wire to the white wire turns on the heater. Near the center of the thermostat is a glass vial containing some mercury. If the vial tilts to the right the mercury creates a connection between the wires. I attached the two black wires on the bottom and use the Raspberry Pi to control the connection between the wires. The original thermostat remains fully functional: the heater will turn on if either the Raspberry Pi or the original thermostat signal it to turn on.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0YkHUBwOLMEP4NuEIqo_IR_6stEiXIxed6_YU6_L_O9Re6_pWJ4JKnO_3wZoJCwDbkwUPpreuNpl7uhd1Gk1Xdj4i8ewzoLsYE_usIcwz7Sx6QTIDHd6ahM7oX30y8yt5BepR/s400/2016-01-09+%25281%2529.jpg)
Materials used: The relay module controls the connection between the two heater wires. GPIO output from the Raspberry Pi can turn the connection on/off. The connection is off by default - even when the Raspberry Pi is powered off. I SSH into the Raspberry Pi to control the GPIO pin over the Internet.