Najad
Published © GPL3+

Remote Controlling Home Appliance Using Your TV Remote

Let’s learn to control our home appliance using the TV or DVD player remotes or smartphones phones like Xiaomi which is having an inbuilt IR

BeginnerWork in progress251
Remote Controlling Home Appliance Using Your TV Remote

Things used in this project

Hardware components

UTSOURCE Electronic Parts
UTSOURCE Electronic Parts
×1
UTSOURCE Arduino UNO
×1
IR receiver (generic)
×1
Grove - 2-Channel SPDT Relay
Seeed Grove - 2-Channel SPDT Relay
×1
IR remote
×1

Story

Read more

Schematics

circuit_hq_ThVJb3CcKK.png

Code

Code snippet #1

Arduino
#include <IRremote.h>
 
int RECV_PIN = 11; //pin at which the OUT pin of IR receiver is connected
 
const int codeRelay1 = 2715722588; //replace your code here for relay1
const int codeRelay2 = 2715706268; //replace your code here for relay2
 
int code;
 
int relay1 = 9; //pin at which relay1 is connected
int relay2 = 8; //pin at which relay2 is connected
 
 
IRrecv irrecv(RECV_PIN);
 
decode_results results;
 
void setup()
{
  Serial.begin(9600);
  // In case the interrupt driver crashes on setup, give a clue
  // to the user what's going on.
  Serial.println("Enabling IRin");
  irrecv.enableIRIn(); // Start the receiver
  Serial.println("Enabled IRin");
  pinMode(relay1, OUTPUT); digitalWrite(relay1, LOW);
  pinMode(relay2, OUTPUT); digitalWrite(relay2, LOW);
}
 
void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, DEC);
    code = results.value, DEC;
    irrecv.resume(); // Receive the next value
  }
 
  if (code == codeRelay1)
  {
    if (digitalRead(relay1) == HIGH)
      digitalWrite(relay1, LOW);
    else
      digitalWrite(relay1, HIGH);
 
    code = 0;
  }
  else if (code == codeRelay2)
  {
    if (digitalRead(relay2) == HIGH)
      digitalWrite(relay2, LOW);
    else
      digitalWrite(relay2, HIGH);
 
    code = 0;
  }
 
  //delay(100);
}

Credits

Najad

Najad

20 projects • 65 followers
Just crazy stuff​

Comments