Muhammad_Munir
Published © GPL3+

Switch ON Bulb with TV remote

Control your home appliances with TV remote.

BeginnerFull instructions provided889
Switch ON Bulb with TV remote

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Arduino UNO
Arduino UNO
×1
IR receiver (generic)
×1
IR receiver (generic)
×1
Relay (generic)
×1
Relay (generic)
×1
BD139 Transistor
×1
BD139 Transistor
×1
2.2k Resistor
×1
2.2k Resistor
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
TV remote
×1
TV remote
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Code

Control bulb with IR

Arduino
#include <IRremote.h>


//Relay PIN
#define relePIN 12

//IR sensor PIN
int RECV_PIN = 3;

//Control LED PIN
int LED_PIN = 10;

IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
  pinMode(relePIN, OUTPUT);
  pinMode(LED_PIN, OUTPUT);
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop()
{
  if (irrecv.decode(&results))
  {
    Serial.print(results.value, HEX);
    Serial.print(" - ");
    Serial.println(results.value);
    if (results.value == 4294967295){
      digitalWrite(relePIN, HIGH); // Relay ON
      digitalWrite(LED_PIN, HIGH); // LED ON
    } 
    if (results.value == 16769565){
      digitalWrite(relePIN, LOW); // Relay OFF
      digitalWrite(LED_PIN, LOW); // LED OFF
    } 
    irrecv.resume(); // Receive the next value
  }
}

Credits

Muhammad_Munir

Muhammad_Munir

77 projects • 48 followers
I am Arduino programmer, also expertise in ESP32 and 8266 wifi modules.

Comments