Treebug842
Published

Simple IR Reciver

A simple IR receiver setup controlling 2 LED by a relay board

IntermediateProtip583
Simple IR Reciver

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×25
Breadboard (generic)
Breadboard (generic)
×1
IR receiver (generic)
×1
LED (generic)
LED (generic)
×2
Relay (generic)
×1
JustBoom IR Remote
JustBoom IR Remote
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Digilent Screwdriver
Digilent Screwdriver

Story

Read more

Schematics

Diagram

A diagram for the IR Receiver, this does not include the rest of the circuitry
Irreceiver xcizghlild

Code

Code for IR Receiver

C/C++
It is a custom made code for the IR Receiver made from IR Receive Demo.
/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
//code added to decode buttons from Duinotech remote
// only slightly modified from Library example
#include <IRremote.h>
#include <IRremote.h>
int RECV_PIN = 9;
IRrecv irrecv(RECV_PIN);
IRsend irsend;
decode_results results;
void setup()
{
 Serial.begin(9600);
 irrecv.enableIRIn(); // Start the receiver
 pinMode(2, OUTPUT); // Set pin to output
 pinMode(4, OUTPUT); // Set pin to output
 Serial.println("Starting"); // Print "Starting"
}
void loop() {
 if (irrecv.decode(&results)) { // If results are decoded
   Serial.println(results.value, HEX); // print result value
   switch(results.value){
   case 0xFF629D: 
   Serial.println("UP"); 
   irsend.sendSony(0xA32AB931, 12);
   break;
   case 0xFF22DD: Serial.println("LEFT"); break;
   case 0xFF02FD: Serial.println("OK"); break;
   case 0xFFC23D: Serial.println("RIGHT"); break;
   case 0xFFA857: Serial.println("DOWN"); break;
   case 0xFF6897: 
   Serial.println("1"); 
   digitalWrite(4, HIGH);
   break;
   case 0xFF9867: 
   Serial.println("2"); 
   digitalWrite(2, HIGH);
   break;
   case 0xFFB04F: Serial.println("3"); break;
   case 0xFF30CF: 
   Serial.println("4"); 
   digitalWrite(4, LOW);
   break;
   case 0xFF18E7: 
   Serial.println("5"); 
   digitalWrite(2, LOW);
   break;
   case 0xFF7A85: Serial.println("6"); break;
   case 0xFF10EF: Serial.println("7"); break;
   case 0xFF38C7: Serial.println("8"); break;
   case 0xFF5AA5: Serial.println("9"); break;
   case 0xFF42BD: Serial.println("*"); break;
   case 0xFF4AB5: Serial.println("0"); break;
   case 0xFF52AD: Serial.println("#"); break;
   break;
   {
delay(3000); //delay for 3 seconds
   }
 }
  irrecv.resume(); // Receive the next value
 }
 delay(100);
}

Credits

Treebug842

Treebug842

4 projects • 3 followers
Contact

Comments

Add projectSign up / Login