Microbit Lesson-17: IR Remote Control


IR, or infrared, communication is a common, inexpensive, and easy to use wireless communication technology. IR light is very similar to visible light, except that it has a slightlty longer wavelength. This means IR is undetectable to the human eye – perfect for wireless communication. For example, when you hit a button on your TV remote, an IR LED repeatedly turns on and off, 38,000 time a second, to transmit information (like volume or channel control) to an IR photo sensor on your TV.

This tutorial will first explain the inner workings of common IR communication protocols. Then we will show how to use the micro bit with the IR controller to control the RGB module

Parts Needed

  • 1x micro:bit
  • 1x Micro B USB Cable
  • 1x micro:bit Breakout (with Headers)
  • 1x Breadboard
  • 5x Jumper Wires
  • 1x  IR Receiver
  • 1x IR Controller
  • 1x RGB Module

What is Infrared?

Infra-Red light is actually normal light with a particular color. We humans can’t see this color because its wave length of about 950nm is below the visible spectrum. That’s one of the reasons why IR is chosen for remote control purposes, we want to use it but we’re not interested in seeing it. Another reason is because IR LEDs are quite easy to make, and therefore can be very cheap, thus making it ideal for us hobbyists to use IR control for our own projects. We need to know there are many more sources of Infra-Red light. The sun is the brightest source of all, but there are many others, like: light bulbs, candles, central heating system, and even our body radiates Infra-Red light. A common modulation scheme for IR communication is something called 38kHz modulation. There are very few natural sources that have the regularity of a 38kHz signal, so an IR transmitter sending data at that frequency would stand out among the ambient IR. 38kHz modulated IR data is the most common, but other frequencies can be used. When you hit a key on your remote, the transmitting IR LED will blink very quickly for a fraction of a second, transmitting encoded data to your appliance.If you were to hook an oscilloscope up to your TV remote’s IR LED, you would see a signal similar to the one above. This modulated signal is exactly what the receiving system sees. However, the point of the receiving device is to demodulate the signal and output a binary waveform that can be read by a microcontroller. When you read the OUT pin of the VS1838B with the wave from above, you will see something like the second.


As everything that radiates heat, also radiates Infra-Red light. Therefore we have to take some precautions to guarantee that our IR message gets across to the receiver without errors.Modulation of the signal on a carrier frequency is the answer to make our signal stand out above the noise. With modulation we make the IR light source blink in a particular frequency. The IR receiver will be tuned to that frequency, so it can ignore everything else. In the picture below you can see a modulated signal driving the IR LED of the transmitter on the left side. The detected signal is coming out of the receiver at the other side.


Technical details of VS1838B IR Receiver

  • Model Number : VS1838B;
  • Working Voltage :2.7V to 5.5V
  • Reception Distance : 18M;
  • Reception Angle : ± 45 Degree;
  • Low Level Voltage : 0.4V
  • High Level Voltage : 4.5V;
  • Body Size : 7 x 7 x 5mm / 0.27″ x 0.27″ x 0.2″(L*W*T);
  • Pin Length : 22.5mm / 0.88″
  • Pitch : 2mm / 0.08″;

Pinout for VS1838B IR Receiver


This module consists of a 1838 IR receiver, a 1kΩ resistor and a LED. It works together with the IR transmitter module(We use an IR controller here). Compatible with popular electronic platforms like Micro bit, Arduino, Raspberry Pi and ESP8266.

Operating Voltage 2.7 to 5.5V
Operating Current 0.4 to 1.5mA
Reception Distance 18m
Reception Angle ±45º
Carrier Frequency 38KHz
Low Level Voltage 0.4V
High Level Voltage 4.5V
Ambient Light Filter up to 500LUX

About the IR control

Infrared remotes are still the cheapest way to wirelessly control a device. We have designed the remote to be small, very simple, and low-cost.There are many different IR remote controls. all of these may have different encoding methods and number of physical buttons, and different codes received when a button is pressed.


Wiring diagram for the project

Connection for IR receiver:

IR receiver Micro bit
    VCC 3.3V
     – GND
     S P8

Connect the RBG module to the micro bit as below:

RGB Module Micro bit
R P0
G P1
B P2


Run Your Script

Extension Installation:

For this project you need to install the below extension. In the previous chapter we already explained you how to install the extension. https://github.com/quadstore/QuadStore_IR_Master

Either copy and paste, or re-create the following code into your own MakeCode editor by clicking the open icon in the upper right-hand corner of the editor window. You can also just download this example by clicking the download button in the lower right-hand corner of the code window.


Note: You can ignore the “Cannot read property ‘onPressEvent’ of undefined” compilation problem in the code. You should still be able to upload the code to your microbit without any problem.


A few seconds after the download finishes, press the “CH-” button of a remote control, The RGB LED turned to red; Press the “CH” button of a remote control, The RGB LED turned to green; Press the “CH+” button of a remote control, The RGB LED turned to blue.

1 thoughts on “Microbit Lesson-17: IR Remote Control

  1. Narayanan says:

    Couldn’t find documentation for extension installation on previous lessons. Managed to add extension on my own and use the code but getting “The hex file is not available, please connect to internet and try again.” Any help will be appreciated.

Leave a Reply

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