0% found this document useful (0 votes)
93 views2 pages

07 Remote Decode With HEX Code Using IR Sensor TSOP1838

This document provides instructions for using a TSOP1838 IR receiver sensor with an Arduino UNO to decode signals from an IR remote. It includes a component list, circuit diagram, and two sketches of Arduino code for receiving and interpreting IR signals. The code examples demonstrate how to print the received HEX codes and identify specific button presses from the remote control.

Uploaded by

dibakardutta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views2 pages

07 Remote Decode With HEX Code Using IR Sensor TSOP1838

This document provides instructions for using a TSOP1838 IR receiver sensor with an Arduino UNO to decode signals from an IR remote. It includes a component list, circuit diagram, and two sketches of Arduino code for receiving and interpreting IR signals. The code examples demonstrate how to print the received HEX codes and identify specific button presses from the remote control.

Uploaded by

dibakardutta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Remote decode with HEX code using IR sensor TSOP1838

Component List:
1) TSOP1838 IR Receiver Sensor -1
2) Jumper Wires
3) Bread Board-1
4) Any IR Remote (NEC Protocol)-1
5) Arduino UNO R3-1

Circuit Diagram:

Sketch: #01

#include <IRremote.hpp>

int IR_RECEIVE_PIN=12;

void setup()

Serial.begin(9600); // // Establish serial communication

IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK); // Start the


receiver

void loop() {

if (IrReceiver.decode()) {

IrReceiver.printIRResultShort(&Serial); // Print complete received data


in one line

unsigned long code=IrReceiver.decodedIRData.decodedRawData;

Serial.println(code, HEX);

delay(500);

IrReceiver.resume(); // Enable receiving of the next value

}
}

—-----------------------------------------

Sketch: #02

#include <IRremote.hpp>
int IR_RECEIVE_PIN = 12;
void setup(){
Serial.begin(9600);
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK); // Start the
receiver
}
void loop(){
if (IrReceiver.decode()){
unsigned long code=IrReceiver.decodedIRData.decodedRawData;
switch(code){
case 0xFC03E31C:
Serial.println("Button 1 is Pressed!");
delay(500);
break;
case 0xF609E31C:
Serial.println("Button 2 is Pressed!");
delay(500);
break;
case 0xFE01E31C:
Serial.println("Button 3 is Pressed!");
delay(500);
break;
case 0xF807E31C:
Serial.println("Button 4 is Pressed!");
delay(500);
break;
case 0xFA05E31C:
Serial.println("Button 5 is Pressed!");
delay(500);
break;
default:
Serial.println("Unknown button is Pressed!");
delay(500);
break;
}
IrReceiver.resume();
}
}

You might also like