muhammed shameel k.v
Published © GPL3+

Using TSOP or IR Receiver with Arduino

In this project I am going to show how to connect a tsop to an Arduino board and have a bi-colored LED lit up according to the key pressed.

BeginnerProtip9 minutes19,495
Using TSOP or IR Receiver with Arduino

Things used in this project

Story

Read more

Schematics

connect like this

wire everything shown in this

Code

Paste this code in your arduino idle and upload if not working go to sketch and include library

Arduino
TSOP code
#include <boarddefs.h>
#include <IRremote.h>
#include <IRremoteInt.h>
#include <ir_Lego_PF_BitStreamEncoder.h>

int receiver = 11; // Signal Pin of IR receiver to Arduino Digital Pin 11

IRrecv irrecv(receiver);     // create instance of 'irrecv'
decode_results results;      // create instance of 'decode_results'

void setup()   
{
  Serial.begin(9600);
  Serial.println("IR Receiver Button Decode"); 
  irrecv.enableIRIn(); // Start the receiver
  pinMode(13,OUTPUT);
  pinMode(12,OUTPUT);

}


void loop()  
{
  if (irrecv.decode(&results)) // have we received an IR signal?

  {
    translateIR(); 
    irrecv.resume(); // receive the next value
  }  
}/* --(end main loop )-- */

/*-----( Function )-----*/
void translateIR() // takes action based on IR code received

// describing Remote IR codes 

{

  switch(results.value)

  {

 
  case 0x14EB18E7:digitalWrite(12,LOW); digitalWrite(13,HIGH);  break;
  case 0x14EB30CF:digitalWrite(13,LOW); digitalWrite(12,HIGH); break;
  //   ^here your hex code that you got in irdumpv2 or irdemo

  default: 
    Serial.println(" other button   ");

  }// End Case

  delay(100); // to not get immediate repeat


} 

Credits

muhammed shameel k.v

muhammed shameel k.v

0 projects • 10 followers
I am a great at electronics. I have programming knowledge and some projects of my own

Comments