Lesson 6 Infrared Transmitter

Share for us


An infrared transmitter module (as shown below) is a device that uses 38K modulation signal generated by MCU to emit infrared rays.


– 1 * SunFounder Uno board

– 1 * USB data cable

– 1 * Infrared transmitter module

– 1 * LCD1602

– 1 * Potentiometer

– Several jumper wires

Experimental Principle

An infrared transmitter is a device applied in remote control. It can emit rays within a certain range through an infrared transmitting tube so as to control signals. Infrared transmitter is widely used in consumer electronics, industry and communication, etc.

In this experiment, connect pin S of the infrared transmitter module to D3 to build a simple circuit. When the coded value for an infrared ray is input by programming and then the infrared transmitter module emits the infrared ray, the LED attached to pin 13 will light up. In addition, the coded value of the infrared ray will be displayed on LCD1602.

Experimental Procedures

Step 1: Build the circuit

                 Infrared Transmitter Module          SunFounder Uno

                                        S —————————————–D3

                                       –  —————————————– GND

LCD1602 connection: connect pin RS to digital pin 5; R/W to GND; E to digital pin 4; D4-D7 to digital pin 9 to 12; VSS to GND; VDD to 5V; A to 3.3V; K to GND

Potentiometer connection: Connect the middle pin to VO of LCD1602 and any other pin to GND

Step 2: Program (Please refer to the example code in LEARN -> Get Tutorial on our website)

Step 3: Compile

Step 4: Upload the sketch to SunFounder Uno

Now, you can see the infrared transmitter emit infrared rays through a camera or your phone camera. At the same time, the LED attached to pin 13 on SunFounder Uno board lights up and a coded value is displayed on the LCD.

C Code

#include <LiquidCrystal.h>
#include <IRremote.h>
IRsend irsend;// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(5, 4, 9, 10, 11, 12);
const int ledPin = 13;void setup()
pinMode(ledPin, OUTPUT);
lcd.begin(16, 2); // set up the LCD’s number of columns and rows:
}void loop()
digitalWrite(ledPin, HIGH);
irsend.sendNEC(0xFFA25D, 32);
lcd.print(” 0xFFA25D “);
lcd.print(” “);
digitalWrite(ledPin, LOW);