Arduino LED Temperature Indicator

40,983

114

8

Introduction: Arduino LED Temperature Indicator

About: I am here to share what I make. Hopefully, you can learn from watching what I have done and even improve upon it. As an Amazon Associate I earn from qualifying purchases.

Difficulty:easy..Basic breadboard and programming skills

View this project on my website to see a cool simulation of the circuit!

This design is 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.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Get Parts

You will need:

Step 2: Make the Circuit

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

-See the parts needed

Step 3: 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
  Serial.begin(9600);
}
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: ");
  Serial.print(tempF);
  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.");
  }
  delay(10);
}


Open the Serial Monitor in the Arduino program, and watch what happens! You can also visit my website to see a simulation with a built-in serial monitor.

Home Hacks Challenge

Participated in the
Home Hacks Challenge

Robotics Contest 2016

Participated in the
Robotics Contest 2016

5 People Made This Project!

Recommendations

  • Backyard Contest

    Backyard Contest
  • Silly Hats Speed Challenge

    Silly Hats Speed Challenge
  • Finish It Already Speed Challenge

    Finish It Already Speed Challenge

8 Discussions

0
CodyP46
CodyP46

1 year ago

say i wanted to do multiple leds in series? im new to electronics and im wanting something like this in the vents of my car, but i would have to have multiples for each color, one for each vent.

0
Vinicius Abrahao
Vinicius Abrahao

Question 1 year ago

Does this also work with a thermistor?

0
chester45674
chester45674

Question 1 year ago

does this code and method work for an Arduino Nano. any help is appreciated

0
raihanmg38
raihanmg38

1 year ago

If i using arduino nano, would the code be the same?

0
kilixn
kilixn

Question 2 years ago

How can I change it into celsius ?EDIT : I just needed to change TempF to tempC. Thanks for the post this project is really nice and easy!

0
CristinaG52
CristinaG52

Question 2 years ago on Step 3

what if I wanted that in celsius? :)

2
CristinaG52
CristinaG52

Answer 2 years ago

okay I figured it out!

0
s-kiahmgordon
s-kiahmgordon

3 years ago

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!