Intro: LittleBits DIY Smart Thermostat
Monitor and control the temperature of your home remotely. Transform your average household thermostat into a smart thermostat, kind of like nest. Now you can use your smartphone to get real time temperature readouts from your home and change the temperature from anywhere, whether you are across the world or sitting on the couch.
*Note: The temperature sensor is coming soon. Stay tuned!
Make this project with littleBits
littleBits is the easiest and most extensive way to learn and prototype with electronics. We are making hardware limitless with our award-winning, ever-growing library of electronic modules, ranging from the very simple (power, sensors, LED) to the very complex (wireless, programmable). This project uses the littleBits cloudBit (TM). The cloudBit lets you connect any device to the internet, turning any object into an internet connected device in a snap – no soldering, wiring or programming required. Instructions for setting up the cloudBit can be found here.
How it works:
There are two number modules in this circuit, one which displays the the current temperature in your home, and the other which displays the desired temperature you set. The current temperature in your home is read by the temperature sensor and transmitted through the first Arduino module to the cloudBit. In Cloud Control, you can view the temperature readout under the “receive signal” tab.
The desired temperature can either be controlled through Cloud Control with the cloudBit or manually with the dimmer. Because these two inputs will often be set to different temperatures, the second Arduino module decides which input was most recently changed by you and sends that signal to the first Arduino. This module compares this value to the analog value coming in from the temperature sensor. Based on the difference of this comparison, the Arduino will either tell the servo to turn on or off. The servo activates the mechanism in a traditional thermostat that controls the temperature in your home. For example, if the current temperature of your home is 80 degrees Fahrenheit, and you set it to be 70 degrees Fahrenheit, the Arduino will turn the servo on until the current temperature comes down to 70 degrees Fahrenheit, thus equalizing the inputs.
Use IFTTT to program your thermostat to maintain certain temperatures throughout the day. IFTTT is a service that lets you connect to different web apps through simple conditional statements. For example, when you are away from home during the day, it is ok if the temp reaches up to 80 degrees Fahrenheit, but when you are home after 5 pm, you want it to stay around 70 degrees Fahrenheit.
The button, latch, and LED at the top of the circuit act as an on/off switch for the thermostat. When this part of the circuit is on, the Arduino runs its program. When the button turns the latch off, the Arduino stops adjusting the servo (but you can still read the current temperature from the number module or from Cloud Control).
Bits You Will Need:
littleBits cloudBit™ x 1
littleBits Latch x 1
littleBits Servo x 1
littleBits Wire x 4
Other Materials Used:
Files You Will Need:
Step 1: Set Up Your CloudBit
You'll find the instructions for setting up the cloudBit here.
Step 2: Assemble the Circuit
Step 3: Load Your Code Onto Each Arduino
Input_Control should be loaded onto the Arduino labeled #1 in the diagram. This Arduino will decide whether to read the set temperature from the dimmer or from the cloudBit. Essentially, the code chooses whichever input was most recently changed.
Temperature_Control should be loaded onto Arduino #2. This Arduino reads the current temperature, compares it to the set temperature, and then turns your heater or AC on or off.
Step 4: Prepare Your Thermostat
You have two basic options for how to use the circuit you just built to turn a simple thermostat into a smart, internet-connected one.
The simplest way is to use the servo to adjust the temperature switch like we did in this image. If your thermostat doesn’t have an easily accessible switch (or if you just like to open things up and take them apart) you can also replace the switch with a servo. See the next step for how we did that.
Step 5: Prep Your Thermostat (part 2)
We used a very basic thermostat from the hardware store. It uses a temperature responsive metal coil to turn your AC/heater on and off (see image).
This kind of thermostat is perfect for this project because the metal coil is essentially just an on/off switch. We replaced the metal coil with our servo so we could control the thermostat with our new circuit.
Step 6: Remove the Coil
First, open up your thermostat and remove the metal coil and any levers attached to it.
There should be a contact on the end of the metal coil that is attached to a wire. Keep this piece connected to the wire. It’s what turns the switch on and off when the coil moves.
Step 7: Add the Servo
Connect a power module to the servo so that it will go to its 0% power position and hold there.
Attach the swing arm (template included above) to the servo with a screw and washer. Run a 3mm machine screw through the swing arm and then attach the thermostat’s contact to the end of it as shown in the images.
Glue the servo to the thermostat so that the contact can swing from one end of the switch to the other.
Step 8: Adjust the Servo Swing in Your Arduino Code
To change how far the servo turns, adjust the variables servoTempHigh and servoTempLow in the Temperature_Control code. If you try to turn the servo too far, it will wear them out over time, so only turn them as much as you need to touch each of the ends of the switch.
Step 9: Attach Thermostat to the Wall
Wire your thermostat to the wall according to the manufacturer’s instructions and you’re ready to go!