Introduction: Read the Remot Control Using IR Sensor

About: someone who likes electronics

Hello, all

In the previous article I wrote about how to use the "IR Obstacle Avoidance Sensor".

And in this article I will write another function of this IR sensore.

IR Obstacle Avoid Sensor has 2 main parts, namely IR emitter and IR Receiver. And in this article I will only enable the IR Receiver.

I will use it to read data sent by Remote control.

Step 1: Require Components

Required components:

Required library:

  • IRremote

Read this article to find out how to add libraries to Arduino "Add Library"

Step 2: Connect the IR Sensore to Arduino

IR Sensore to Arduino

VCC ==> +5V

GND ==> GND

OUT ==> D2

Step 3: Programming

Before you begin sketching, make sure the "IRremote" Library is installed. So that no errors occur when you try the Sketch that I gave.

Below is a sketch that you can use:

#include

int RECV_PIN = 2; IRrecv irrecv(RECV_PIN); decode_results results;

void setup() { Serial.begin(9600); irrecv.enableIRIn(); // Start the receiver }

void loop() { if (irrecv.decode(&results)) { Serial.println(results.value); irrecv.resume(); // Receive the next value } delay(100); }

If you need the file, you can download it below:

Step 4: Result

Point the remote control towards the IR receiver. Then press a few buttons.

Serial monitor will display data from the remote button that is pressed.

The data we get from this experiment can be used for other cool things. For example, controlling the LED with the remote, turning on the fan, etc.

thank you for reading, goodbye in the next article