Muhammad_Munir
Published © GPL3+

Control AC load with TV Remote

Control AC load with TV Remote by using Arduino

IntermediateFull instructions provided47
Control AC load with TV Remote

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
IR receiver (generic)
×1
Relay (generic)
×4
BD139 Transistor
×4
2.2k Resistor
×4
Jumper wires (generic)
Jumper wires (generic)
×1
TV Remote
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Code

Control AC load with IR

Arduino
#include <IRremote.h>
#define irPin 3

IRrecv irrecv(irPin);
decode_results results;
#define r1 5
int relay1 = LOW;
#define r2 6
int relay2 = LOW;
#define r3 7
int relay3 = LOW;
#define r4 8
int relay4 = LOW;
void setup() 
{
    Serial.begin(9600);
    irrecv.enableIRIn();
    
    pinMode(r1, OUTPUT); 
    pinMode(r2, OUTPUT);
    pinMode(r3, OUTPUT); 
    pinMode(r4, OUTPUT);
      
}
void loop()
{
   if (irrecv.decode(&results)) 
   {
    Serial.print(results.value, HEX);
    Serial.print(" - ");
    Serial.println(results.value);
      switch (results.value) 
      {
            case 284158740:
            digitalWrite(r1,0);
            digitalWrite(r2,0);  //all off
            digitalWrite(r3,0);
            digitalWrite(r4,0);
            delay(250);
            break;        
            case 284141910:
            relay1 = ~ relay1;
            digitalWrite(r1,relay1);
            delay(250);
            break;
            case 284137830:
            relay2 = ~ relay2;
            digitalWrite(r2,relay2);
            delay(250);
            break;
            case 284145990:
            relay3 = ~ relay3;
            digitalWrite(r3,relay3);
            delay(250);
            break;
            case 284126100:
            relay4 = ~ relay4;
            digitalWrite(r4,relay4);
            delay(250);
            break;
           }
 
   irrecv.resume();
   }
}

Credits

Muhammad_Munir

Muhammad_Munir

1 project • 2 followers

Comments