How to use an Arduino IR Transceiver

This guide shows you how you can work with infrared sensors. Infrared (IR) communication is a widely used and easy to implement wireless technology that has many useful applications. The most prominent examples in day to day life are TV/video remote controls, motion sensors, and infrared thermometers. At the end of this document, you will be able to get familiar with IR sensors and how to work with them by using Ozeki 10. The guide contains diagrams and videos to help you during your tour. So, let's get started.

What is infrared?

Infrared radiation is a form of light similar to the light we see all around us. The only difference between IR light and visible light is the frequency and wavelength. Infrared radiation lies outside the range of visible light, so humans can’t see it. Because IR is a type of light, IR communication requires a direct line of sight from the receiver to the transmitter. It can’t transmit through walls or other materials like WiFi or Bluetooth.

What is an IR Transceiver?

An infrared (IR) transceiver is a device which is capable of both sending and receiving infrared data. These devices are most commonly seen in use in communications, although they have other applications as well.

How does an IR Tranceiver work?

A typical infrared communication system requires an IR transmitter and an IR receiver. The transmitter looks just like a standard LED, except it produces light in the IR spectrum instead of the visible spectrum. The same type of LED is used in IR transmitter breakout boards for the Arduino. The IR receiver is a photodiode and pre-amplifier that converts the IR light into an electrical signal.

How to use an Arduino IR Transceiver?

To connect the transceiver to your Arduino, you need three wires to be connected. The first one goes from the G pin of the transceiver to the ground (Gnd), the transceiver's R pin goes to the 5V pin of the Arduino. Lastly, the Y pin from the transceiver needs to be connected with digital input from the Arduino.

Arduino IR Transceiver wiring diagram

wiring diagram of arduino ir transceiver
Figure 1 - Wiring diagram of Arduino IR Transceiver

How to use IR Transceiver in Ozeki

IR Transceiver connections are capable to forward any signal received from the most popular remote controller brands to any connection in your Ozeki software. It can also send any data for transmission. The transmitter can imitate the most significant remote controller brands, so you are able to control any device belonging to these brands. To use the IR Transceiver in Ozeki, you first need to download Ozeki Robot Developer. Ozeki Robot Developer will install the Arduino libraries needed to use this sensor efficiently.

Download Ozeki Robot Developer

Download Ozeki Robot Developer

After Ozeki Robot developer is installed, you need to upload the IR Transceiver control code to your Arduino. You can find the code and download instructions on the following pages. The upload process includes two steps: first you need to format the EEPROM of the arduino, then you need to upload the control code. The procedure is very simple, it only takes a few seconds.

Upload the IR Transceiver code to Arduino Uno
Upload the IR Transceiver code to Arduino Mega 2560
Upload the IR Transceiver code to Arduino Nano

The arduino sensors and Ozeki will communicate over the USB port using the Ozeki IR Transceiver protocol. This protocol makes it possible for you to use the sensor directly on your PC. You will be able to control this sensor through the web based user interface or you will be able to communicate with it using Ozeki Chat. You can read more about chat control on the following page.

How to communicate with the IR Transceiver using chat

It is important to understand chat control, because when you build a robot, the way you wish to control this sensor is by sending and receiving messages. If you open the Ozeki Robot Developer app, you will see, who you can write a C#.Net program to work with this sensor.

Connection steps

  1. Connect the IR Transceiver to the Arduino using the wiring diagram
  2. Attach the Arduino board to your PC
  3. Check the COM port to see if the Arduino is connected properly
  4. Open the Arduino application on the computer
  5. Upload example code to the Arduino
  6. Open Ozeki 10 by typing https://localhost:9515 in your browser
  7. Select the connection of the IR Transceiver
  8. Send test message to try out your IR Transceiver

System overview

The system we suggest consists of a IR Transceiver, that is wired to the analog port of your Arduino. The Arduino will be responsible for reading data from this device in real-time. The brain of the system will be running on a PC (Figure 2). On the PC, Ozeki 10 will be able to manage the communication. You can easily run Ozeki 10 using a webbrowser.

setup ir transceiver to pc using arduino
Figure 2 - System configuration of IR Transceiver connecting to PC using Arduino

Decoding protocols for receiving

  • NEC
  • Sony
  • Sanyo
  • Mitsubishi
  • RC5
  • RC6
  • Panasonic
  • LG
  • JVC
  • SAMSUNG
  • Whynter
  • Aiwa RC-T501
  • Denon

Encoding protocols for transmission

  • RC5
  • RC6
  • NEC
  • Sony
  • Panasonic
  • JVC
  • SAMSUNG
  • Whynter
  • LG

Prerequisites

  • Infrared LED for transmitter or infrared sensor (e.g. 1838B) for receiver
  • Ozeki 10 installed on your computer
  • Programmable board (Arduino Mega/Nano/Uno)
  • USB cable is needed between Arduino Mega/Nano/Uno and your computer

Step 1 - Wire the IR sensor to your Arduino

You can see how to wire an IR sensor (such as 1838B) to any of the following boards:

After wiring, please plug the board to your computer!

Step 2 - Upload code to the microcontroller

(Here is the code to upload)

Step 3 - Start Ozeki 10 to try the receiver

Step 4 - Wire an infra LED to your Arduino

You can see how to wire an infra LED to any of the following boards:

After wiring, please plug the board to your computer!

Step 5 - Upload code to the microcontroller

(Here is the code to upload)

Step 6 - Start Ozeki 10 to try the transmitter

Step 7 - Understand the IR Transceiver protocol

The IR Transceiver can communicate with Ozeki through the following protocol.

References:
https://www.circuitbasics.com
https://www.wisegeek.com

More information