Arduino Lesson 20: IR LED
Arduino Lesson 20


Receiving data from IR

Components Required



IR or Infrared is commonly use communication technology in many cases. Because it is inexpensive and easy. Because of this technology is depend on light, this is widely used for short distance communication. The IR LED module emits Infrared light in slightly higher frequencies. So it use to transmit data and using IR receiver, we can take that data from another place.

Learning outcomes:

  • Using IR LED and getting transmit data
  • Apply IR LED in projects


IR light have slightly high wave length than visible light. So it can’t see for us. Also it have high frequency range. Therefore using IR light we can transmit data from high frequency waveform. This is called modulated signal transmits. The sun and every light source emit IR light. IR light is always around us with many higher frequencies. Therefor in the communication we used some rare natural IR frequencies. In many cases 38KHz is used. In this frequency the IR LED on and OFF 38000 times in a second. The encoded modulated data(binary data) transmitted by changing on and off pattern. Then this wave is receiving and demodulate by using some IR sensor. After using some microcontroller we can decode and know what is the the transmitter side is sent.



Connect the IR LED module to Magicbit. As usually we connect this module to upper right connector(D33) of the magicbit. Download and install IR remote library from here. Then connect the Magicbit to your pc and upload the following code. This code is used for transmit some data to some other device like TV,A/C or etc. When the right push button is pressed. According to your purpose change the binary code to change data what you want to transmit.




#define PB_Right 34;
#define IR_SEND_PIN 33;
boolean buttonState;
long irKeyCode= 16582903;
IRsend irsend;

void setup(){
pinMode(PB_Right, INPUT);

void loop(){
        irsend.sendSony(irKeyCode, 32);
Related Posts
Leave a Reply

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