Thermostat Lamp

1,933

53

1

Posted

Introduction: Thermostat Lamp

This is an entry in the
Arduino Contest 2017

Thermostat lamp is a wall lamp designed for outdoor use. This one is able to change color according to the temperature.

Step 1: Assemble Materials

Material required are:

(x1) arduino uno

(x1) Bread Board

(x1) Temperature sensor

(x12) Jumper wires

(x1) LED strip RGB

(x1) Current transformer

(x1) LED’s connector with arduino (cable)

Step 2: Program

The program will measure the temperature and if the temperature is less or equal than the Minimum Temperature, the LED will turn blue, if the temperature is higher than the Temperature_Minimum value but lower than the Maximum_ Temperature value, the LED will turn green last if the temperature is greater than the Maximum_ Temperature value, the LED will turn red. The temperature value will be displayed on the Serial monitor.

Now is time to code the arduino. For this project this code has been used.

const int LM35 = A0;
const int R=4;

const int G=3;

const int B=2;

const int Temperatura_Minima=65;

const int Temperatura_Maxima=75;

float Temperatura;

void setup () { Serial.begin(9600); //Inicializar puerto serial

pinMode(R,OUTPUT);//Inicializar el pin 4 como salida

pinMode(G,OUTPUT);//Inicializar el pin 3 como salida

pinMode(B,OUTPUT);//Inicializar el pin 2 como salida

digitalWrite(R,LOW);

digitalWrite(G,LOW);

digitalWrite(B,LOW);

}

void loop() { Temperatura = analogRead(LM35);//Leer la entrada analogica

//Calcular la temperatura

Temperatura = 5.0*Temperatura*100.0/1024.0;

//Mostrar la temperatura en el monitor Serial

Serial.print(Temperatura);

Serial.println(" ºF");

//Codicion para que encienda el led de color Verde

if(Temperatura>Temperatura_Minima&&Temperatura<Temperatura_Maxima) {

Serial.println("Deberia encender verde");

digitalWrite(R,HIGH);

digitalWrite(G,LOW);

digitalWrite(B,HIGH); }

//Condicion para que encienda el led de color Azul

if(Temperatura<=Temperatura_Minima) {

Serial.println("Deberia encender azul");

digitalWrite(R,HIGH);

digitalWrite(G,HIGH);

digitalWrite(B,LOW); }

//Condicion para que encienda el led de color Rojo

if(Temperatura>=Temperatura_Maxima) {

Serial.println("RED");

digitalWrite(R,LOW);

digitalWrite(G,HIGH);

digitalWrite(B,HIGH);

}

delay(500);

Step 3: Final Product

Share

Recommendations

  • Remote Control Contest 2017

    Remote Control Contest 2017
  • Arduino Contest 2017

    Arduino Contest 2017
  • LED Contest 2017

    LED Contest 2017

We have a be nice policy.
Please be positive and constructive.

Tips

Questions & Answers

Comments

That's a fun unique way to display the temperature :) I like the sleek simple design!