Arduino Projects: IR Receiver

One of the most used types of wireless communication for TV remote control is IR (Infrared). This Arduino project is going to be about using IR.

One of the places you will also always find an IR controlled device is in AC (Air Conditioning system) and projectors.

Infrared is the perfect low energy technology, it works on short distances. It’s easy to build and cheap to add to your project. You can use it to control robots, smart home devices, or relays.

In this session, we will learn how to read hex codes of some remote buttons and use them to control LEDs.

Components needed

We also need an additional library for our IR receiver to work properly. You can simply type “IR remote” in the library manager and select IR remote by Shirriff. If you don’t know how to add a library to your sketch, I will suggest you read this article.

There will be 2 codes for this project but one schematic.

We will connect LEDs now but they wouldn’t be used in the first code. We will use them in the second one. If you use a different IR receiver, it is possible that you will need to add resistors, you should check the datasheet of the IR receiver.

When everything is ready, we can upload the first code. It will display the data that have been received by IR receiver on the serial port. You need to copy those code and save them in a text file, we will use them later.  The code is in HEX format, don’t worry if they do not make sense to you at first sight.

Now we can upload the second code that will control the LEDs that we’ve connected previously. To do so, we have to copy the codes from the remote buttons we’ve saved in the text file. Paste them into the command1, command2, command3 variables. After doing so, we can upload the code to the Arduino board.

The LEDs should turn ON and OFF when you press the button we’ve mapped earlier on the remote control.

You can check the video above to have a glimpse of how our sample worked.

You might also like:

X