Introduction: Temperature Controlled Space Heater

This instructable will take you through the steps necessary to build your own simple temperature controlled space heater that will turn on and off at whatever temperature you choose. This will allow a simple space heater to keep your room at a very specific temperature that you choose. It is also easy to build with the following materials.

1 x Arduino Uno

1 x Arduino Temperature Sensor


1 x SPDT Relay (JQX-15F 005-1Z1)

1 x 9V Battery

Wire Stripper


Soldering Iron


Electrical Tape

Extension Chord

Note space heaters are fairly high power (mine is 1500 watts). This means potentially 1500W/120V = 12.5 Amperes. If you are not comfortable working with electronics, this is not a good project to start on. Even if you are experienced, be careful!

Step 1: Attach Your Relay

Use your wire stripper to cut the electrical chord off your space heater. If you have an extension chord that you want to use for this part instead, it will work equally well and you wont have to cut the chord of your space heater if you're worried about damaging your heater.

Strip the casing back on the power chord and inside you will find two insulated wires. Strip the casing back on these as well and solder the contacts of the relay in between two sides of one of these wires. It does not matter which wire you solder it in the middle of, however, it is important that you do not accidentally cross your wires. (i.e. each wire should be re-soldered back together after being cut apart but one of them will have the contacts of the relay in the middle of it breaking the connection.

Remember that in the orientation shown, the bottom two contacts on the relay are the coil contacts. The one on the right is the single pole, and the two on the left are the double poles. We want to connect our power to the contact that is normally open. This means that our space heater will normally be in the off state except when the coil of the relay is energized. The contacts for the coil of the relay will be attached to outputs of the Arduino. We will cover this setup more in two steps.

After you finish soldering everything together, wrap everything in several layers of electrical tape. You should never have live power like this open to the air on the chance that something gets shorted out. This could be a fire hazard and also a shock hazard. Be Careful!

Step 2: Understand What Your Relay Is Doing

A relay is an switch that is controlled by adjusting a voltage. The one that we are using is a 5 terminal device. 2 of the terminals control the coil of the relay. When the voltage across the coil is below the pickup voltage, one connection will be made. When the voltage across the coil is above the pickup voltage, the other connection will be made. This is a SPDT relay, or Single Pole Double Throw.

We need to use this relay because space heaters typically use a lot of power. The space heater that I use requires 1500W. This means that we will need to control 1500/120 = 12.5 amperes. If we tried to control that much power with our MOSFET, it would be destroyed. Instead, we will use the MOSFET to control the voltage across the coil, and let the relay contacts control the larger amount of power.

Step 3: Build Your Circuit

Assemble your circuit according to the attached schematic. Make sure that you physically put your temperature sensor somewhere far enough away from the space heater that the readings it measures are representative of the whole room.

Step 4: Understanding the Circuit

The main challenge in designing this circuit is that we need to control a large amount of power using our Arduino and we don't want to destroy the board. Understand that each pin can only output 40mA of current at 5V. The coil of our relay has a pickup voltage of 3.3V, however, according to the datasheet it will draw 185mA which will easily destroy the Arduino board. For this reason, I decided to use the Arduino to control the gate of a power MOSFET. This will be small enough for the Arduino to be safe and the power MOSFET is capable of controlling enough power to drive the coil of the relay.

Step 5: Program Your Arduino

Copy and paste the code below into your Arduino IDE, or download the attached .ino file.

const int tempPin = A0;
const int gatePin = 2;

void setup() {

Serial.begin(9600); pinMode(gatePin, OUTPUT); digitalWrite(gatePin, LOW);


void loop() {

int tempValue = analogRead(tempPin); Serial.print("Temperature Reading = "); Serial.print(tempValue);

float conversion = (tempValue/1024.0) * 5.0;

Serial.print(", Conversion: "); Serial.print(conversion);

Serial.print(", degrees C: "); float Ctemperature = (conversion - .5)*100; Serial.println(Ctemperature);

if(Ctemperature < 33) { digitalWrite(gatePin, HIGH); } else { digitalWrite(gatePin, LOW); } delay(1000); }

Step 6: Understanding Your Code

In the first two lines of code, we assign the variable names that we will be using for the Arduino pins. We will call the A0 pin tempPin and the digital output pin gatePin.

In the setup() loop, we will begin our Serial output so that we can monitor the data that is coming in off of the temperature sensor. We will also define our gatePin as an output pin and set it to low initially.

Then, in the loop() function, we will be controlling this gatePin as a function of what data is coming in off of the temperature sensor. First, however, we will need to interpret this data in a way that is meaningful. Our temperature sensor can read between 0 and 1024. We can convert this to degrees Celcius by the following formula. (((reading/1024)*5)-.5)*100. If this value is less than 33 degrees, according to the code, our Arduino will do a DigitalWrite to turn the gatePin HIGH and our space heater will turn on. If the temperature is above this value, then our Arduino will do a digitalWrite to turn the gatePin LOW and our space heater will turn off.

Theoretically, our room should reach the desired temperature and then hover around there with our heater turning on when it gets too cold and off when it gets too hot!

Step 7: Testing

Plug in your space heater and attach your Arduino to your computer. Run the program and monitor the temperature using the serial port viewer. You should be able to see a new temperature reading every second. Adjust the temperature in your code to be close to whatever temperature your room is currently at. Then re-upload your code and use your fingers to heat the temperature sensor up so that it passes the threshold. You should be able to hear a click from the relay when the temperature gets above the one you set indicating that the relay has switched off. Now remove your hand and let the temperature go below the threshold and you should hear another click as the heater turns on. Your temperature sensing space heater is now done!


hfransson made it! (author)2016-10-10

You should remember to unplug the element built-in thermostat as it has a tendency to turn off before the desired temperature is reached in the room.

SayntCigol made it! (author)2015-07-06

Wouldn't this end up shortening the lifespan of your space heater, particularly if it uses a fan to move the hot air away from the heating element?

bohmbac2 made it! (author)bohmbac22015-07-06

Hmm could you explain why you think it would shorten the lifespan?

About This Instructable




Bio: I'm a design consulting electrical engineer working in downtown Chicago and I do a lot of small electronics side projects! Passionate about learning new ... More »
More by bohmbac2:Temperature Controlled Space HeaterBuild a Simple Binary Counter using your ArduinoTemperature Controlled Fan
Add instructable to: