Smart Home Lights project for kids

Smart Home Lights project for kids

Overview

This project is about smart home lights which are going to be the future as in these homes we don’t have to switch ON/OFF the lights as whenever the button is pressed remote lights will turn ON/OFF.

In these smart home lights whenever you press the button on the remote the lights will get ON/OFF in the future world of automation everything must be automatic.

Hardware required 

  • Arduino Uno R3
  • Resistor
  • Jumper Wires
  • IR Remote
  • Led
  • IR Sensor
  • Breadboard

Schematic Diagram

Fig 1.  Circuit Diagram

Arduino Code : 

#include <IRremote.h>

int voltage[12];
unsigned int i = 0;

IRrecv irrecv(12);
decode_results results;
unsigned long key_value = 0;

void setup(){
  Serial.begin(9600);
  SetUpPins();
  irrecv.enableIRIn();
  irrecv.blink13(true);
}


void loop(){ 
  TranslateIR();
}


void ToggleLED(int pin) {
  if (voltage[pin]) {
    Serial.print("LED ");
    Serial.print(pin - 2);
    Serial.println(" was turned off");
    digitalWrite(pin, LOW);
    voltage[pin] = 0;
  } else {
    Serial.print("LED ");
    Serial.print(pin - 2);
    Serial.println(" was turned on");
    digitalWrite(pin, HIGH);
    voltage[pin] = 1;
  }
}
void SetUpPins() {
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW);
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
}
void TranslateIR() {
  if (irrecv.decode(&results)){
 
        if (results.value == 0XFFFFFFFF)
          results.value = key_value;

        switch(results.value){
          case 0xFD00FF://power
          break;
          case 0xFD807F://vol+
          break;
          case 0xFD40BF://func/stop
          break;
          case 0xFD20DF://|<<
          break;
          case 0xFDA05F://>||
          break ;  
          case 0xFD609F://>>|
          break ;               
          case 0xFD10EF://down arrow
          break ;  
          case 0xFD906F://vol-
          break ;  
          case 0xFD50AF://up arrow
          break ;  
          case 0xFD30CF://0
          ToggleLED(2);
          break ;  
          case 0xFDB04F://eq
          break ;
          case 0xFD708F://st/rept
          break ;
          case 0xFD08F7://1
          ToggleLED(3);
          break ;
          case 0xFD8877://2
          ToggleLED(4);
          break ;
          case 0xFD48B7://3
          ToggleLED(5);
          break ;
          case 0xFD28D7://4
          ToggleLED(6);
          break ;
          case 0xFDA857://5
          ToggleLED(7);
          break ;
          case 0xFD6897://6
          ToggleLED(8);
          break ;
          case 0xFD18E7://7
          ToggleLED(9);
          break ;
          case 0xFD9867://8
          ToggleLED(10);
          break ;
          case 0xFD58A7://9
          ToggleLED(11);
          break ;      
        }
        key_value = results.value;
        irrecv.resume(); 
  }
}

Precautions

  1. Connections should be done properly.
  2. Arduino is case Sensitive so code accordingly.
  3. Give different and appropriate colors to the wires.
  4. Use resistors for sensors and LCDs.

Do you have questions regarding our STEM program?

Contact us anytime.

Take your first step into the magical world of coding for kids

Share:

More Posts

Send Us A Message

Coding For kids

Coding Courses for Kids Online

Our courses which are tailored for grades 1 to 12, and our hands-on curriculum seamlessly integrates, preparing students for challenges and inspiring the next generation.

STEM Labs

STEM LAB for Schools

If you are a school searching for a cutting-edge makerspace solution that goes beyond conventional education, look no further. Partner with Makers’ Muse to unlock a world of innovation and transformative learning experiences for your students. 

Coding Toys

STEM LAB for Schools

Discover a revolutionary coding journey for students with our cutting-edge educational toys. Partner with us to unlock innovative learning experiences that transcend traditional education.

Leave a Reply