IR Remote with Arduino

What are infrared signals?

Remote controls such as those used for your TV, DVD/Blu-ray or Cable box use infrared transmitters and receivers. The transmitter is basically nothing more than a flashlight that emits a light beam at a frequency that is lower than the human eye can detect.

Video

What we are going to do?

  • Connecting an IR receiver with Arduino UNO (you can use any Arduino).
  • Using an example program to decode the IR signals from an IR remote.
  • Save the decoded results and write code to perform a different operation from different IR signals

Hardware Needed

Components Amazon.comamazonAmazon.inamazonBanggoodbanggoodAliExpressali express
IR remotecart iconcart iconcart iconcart icon
IR receiver cart iconcart iconcart iconcart iconcart icon
Arduino UNOcart iconcart iconcart iconcart iconcart icon
Bread Boardcart iconcart iconcart iconcart iconcart icon
Jumper Wirescart iconcart iconcart iconcart iconcart icon

IR Sensor Pinout

Pinout diagram of tsop 1738 and tsop 1838
Pinout diagram of TSOP 1738 & TSOP 1838

Circuit

Arduino uno ir sensor circuit
TSOP 1738 IR receiver with Arduino UNO

Connect the circuit as follows.

ArduinoIR Receiver (TSOP 1738)
5vVCC (2nd leg)
GNDGND (1st leg)
Digital Pin 11OUT (3rd leg)

Note that there is a lot of different types of IR receivers so be careful when giving the connections, the pin(VCC, GND, OUT) might be shuffled in the model you are using.

Software & Libraries Needed

SoftwaresDownload
IR library for Arduinodownload icon
Arduino IDEdownload icon
  • Download & Install The Library from here download icon
  • Then from Arduino IDE go to File -> Examples -> IRremote and open IRrecvDemo

Example Code

  • Now go to tools and upload the code.
  • Open the serial monitor and check if the decoded results are printing when pressing buttons on the IR remote.
  • The output will be printed in HEX format as shown below

Now let’s connect an LED to one of the digital pins of Arduino and edit the above example to turn ON/OFF the LED using the IR remote.

Circuit With LED

ArduinoIR ReceiverLED
D9Anode(+) via
220 Ohm resistor
D11OUT
5VVCC
GNDGNDCathode(-)

Changes needed to make in the example code are:

  • In the 29th line Serial.println(results.value, HEX); change HEX to DEC Serial.println(results.value, DEC);, because the decimal value is easy to work with while programming.
  • Then upload the code and open the serial monitor and press any two buttons of your IR remote that you needed to function as the switch for the LED and note the values generated.
  • Then we need to declare two integer constant called codeON and codeOFF for saving the values which we noted in the above step.
  • Now declare a variable called code to save the live receiving values from the sensor.
  • Then make the pin at which LED is connected as OUTPUT using the pinMode() function
  • Then use an if else if block to check whether the received value is equal to the values saved in the constant codeON or codeOFF
  • If the value in code is equal to the value in codeON then make the LED pin HIGH
  • If the value in code is equal to the value in codeOFF then make the LED pin LOW

Code

To buy electronic components order from UTSOURCE

Leave a Comment

Your email address will not be published. Required fields are marked *