Microbit SmartCar – Infrared Red Remote Control

Introduction

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.

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.

IR Remote and Receiver

Assembly Instruction:

Step-1: Connect the IR Receiver to the Microbit Car as per the below diagram

Circuit Connections Table

IR Receiver Microbit CAR
S P15
5v (Center Pin) 5v
GND

Circuit Diagram

Actual Wiring Diagram

Step-2: Installing Extension & Download the code to the Microbit. For this project you also need to install an extension before downloading the actual code the Microbit.

Installing Extension

First you need to install the extension required for IR Remote. In order to do it Open your microbit makecode project Click Setting Icon -> Extensions -> in search bar add below Package link and click search

https://github.com/quadstore/QuadStore_IR_Master

Run Your Code

https://makecode.microbit.org/_U72YzfC6bYRg

Either copy and paste, or re-create the following code into your own MakeCode editor by clicking the “Edit” Option 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.

Result

  1. Press the “Forward Arrow” button in the IR Remote for the car to move forward.
  2. Press the “Right Arrow” button in the IR Remote for the car to move right side.
  3. Press the “Left Arrow” button in the IR Remote for the car to move left side.
  4. Press the “Back Arrow” button in the IR Remote for the car to move backward.
  5. Press the “OK” button in the IR Remote for the car to STOP.

Video

 

Leave a Reply

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