Project showcase
Switch on the Light - SOL

Switch on the Light - SOL © GPL3+

Simple project using TSOP.

  • 2,898 views
  • 3 comments
  • 3 respects

Components and supplies

About this project

Basically it is a simple remote controlled Light system. It uses IR receiver to calculate the hexadecimal values when we click the button.

Hexadecimal values are then coded to the Arduino using the if-else condition!

For a beginner who wants to automate their home can try this project!

First we have to send a serial read code to the Arduino and read the values when each button is pressed.Each button in the remote will read different values.Depending on the hexadecimal values they show, they are coded using the if condition and necessary light is switched ON when the remote is pressed !

Enjoy!

Code

Light controlArduino
Simple code to control Lights using T.V Remote and TSOP receiver
#include <IRremote.h>
 
int RECV_PIN = 11; // 
int output1 = 2;
int output2 = 4;
int output3 = 6;
int itsONled[] = {0,0,0,0};

#define code1  0x4FF807F // 
#define code2  0x4FF40BF // 
#define code3  0x4FF20DF // 
 
IRrecv irrecv(RECV_PIN);
 
decode_results results;
 
void setup()
{
  Serial.begin(9600);   // 
  irrecv.enableIRIn();  // 
  pinMode(output1, OUTPUT);
  pinMode(output2, OUTPUT);
  pinMode(output3, OUTPUT);
}
 
void loop() {
  if (irrecv.decode(&results)) {
    unsigned int value = results.value;
    switch(value) {
       case code1:
         if(itsONled[1] == 1) {        // 
            digitalWrite(output1, LOW);   // 
            itsONled[1] = 0;           // 
         } else {                      // 
             digitalWrite(output1, HIGH); // 
             itsONled[1] = 1;          // 
         }
          break; 
       case code2:
         if(itsONled[2] == 1) {
            digitalWrite(output2, LOW);
            itsONled[2] = 0;
         } else {
             digitalWrite(output2, HIGH);
             itsONled[2] = 1;
         }
          break;
       case code3:
         if(itsONled[3] == 1) {
            digitalWrite(output3, LOW);
            itsONled[3] = 0;
         } else {
             digitalWrite(output3, HIGH);
             itsONled[3] = 1;
         }
          break;          
    }
    Serial.println(value); // you can comment this line
    irrecv.resume(); // Receive the next value
  }
}

Comments

Similar projects you might like

Bluetooth Controlled Light Switch

Project showcase by Team The Instrumentation Crustaceans

  • 23,402 views
  • 4 comments
  • 26 respects

How to control your light switch from your smartphone?

Project in progress by Mahmoud Ahmed

  • 22,607 views
  • 3 comments
  • 15 respects

Wireless Light Switch Manipulator

Project tutorial by Becky Button

  • 4,758 views
  • 7 comments
  • 17 respects

Controlling LED light intensity using smartphone light senso

Project tutorial by Nikola Travis

  • 2,239 views
  • 0 comments
  • 3 respects

Control Your Light Switch with Your Smartphone

Project tutorial by Alasdair Allan

  • 13,534 views
  • 1 comment
  • 33 respects

TV remote controlled Light and Fan

Project tutorial by Rishabh

  • 18,184 views
  • 13 comments
  • 63 respects
Add projectSign up / Login