Introduction: Arduino LED Temperature Indicator

Picture of Arduino LED Temperature Indicator

I entered this instructable into both the HOME HACKS Contest and the ROBOTICS Contest. So please vote for it!

This is a design of mine, made to keep track of the temperature in a room.

You give it the parameters you want and it will light a blue LED if it is too cold, a red LED if it's too hot, and a green one if it's just right.

Try this Simulation (click on the sensor to adjust its reading):

Step 1: Get Parts

Picture of  Get Parts

You will need:

>Arduino board


>Jumper wires

>3 220Ω resistors (red-red-brown)

>3 LEDs (colors of your choice)

>A temperature sensor (mine is an LM35, but most should work)

Buy specialty parts:

Temp sensor -

Step 2: Put Parts in Place

Picture of  Put Parts in Place

Not much explaining to do on this step, just follow the picture.

Step 3: Wire It Up

Picture of  Wire It Up

Wire it up:

>Red LED goes to digital pin 4 through one of the resistors, and ground

>Green LED goes to digital pin 3 though a resistor, and ground

>Blue LED goes to digital pin 2 through a resistor, and ground

>Pin one (the pin on the left) of the temperature sensor goes to 5v

>Pin two (the pin in the middle) of the temperature sensor goes to analog pin A2

>pin three (the pin on the right) of the temperature sensor goes to ground

Step 4: Coding

Picture of  Coding

Connect your Arduino to your computer and upload this code:

const int hot = 87; //set hot parameter
const int cold = 75; //set cold parameter
void setup() {
pinMode(A2, INPUT); //sensor
pinMode(2, OUTPUT); //blue
pinMode(3, OUTPUT); //green
pinMode(4, OUTPUT); //red
void loop() {
int sensor = analogRead(A2);
float voltage = (sensor / 1024.0) * 5.0;
float tempC = (voltage - .5) * 100;
float tempF = (tempC * 1.8) + 32;
Serial.print("temp: ");
if (tempF < cold) { //cold
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
Serial.println(" It's Cold.");
else if (tempF >= hot) { //hot
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, HIGH);
Serial.println(" It's Hot.");
else { //fine
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
Serial.println(" It's Fine.");

Open the Serial Monitor in the Arduino program, and watch what happens!


s-kiahmgordon (author)2017-01-18

I had a few complications at first with this project, but eventually I figured them out and this is a very cool project, you did a good job designing it!

zorstorer made it! (author)2016-05-25

Thanks for the nice write up, my first completed project on here!!

theoriginalrage made it! (author)2016-04-23

This was a fun build.

As you can see from my pic I incorporated a DHT22 instead of the LM35. The reason being was, while I was working on it I accidentally sheared off one of the legs from my LM35. Swapping the code wasn't difficult, here is a link to what I did,

Thanks for sharing!

kturpin made it! (author)2016-04-22

In an insane coincidence I built this same circuit yesterday but coded the colors backwards to simulate a thermostat, red is heating and blue is cooling.

My LEDs are super dim but it might be my temp sensor sucking too much juice.

millerman4487 (author)kturpin2016-04-22

what happens if you connect your temp sensor through a resistor?

it might throw off your reading, but you could account for that in the program.

About This Instructable




Bio: Oh hey, look, a bio section! In case you actually cared enough to look here, I'm millerman4487, and I like waffles and robots. I ... More »
More by millerman4487:Detailed Wallpapers With SnapseedPlant Moisture Sensor w/ ArduinoProvide Power With an Old USB Cord
Add instructable to: