Test the IR Receiver Circuit
Let’s check that your infrared receiver circuit is wired properly and that your remote was programmed correctly. This program displays the numbers from the infrared remote on the micro:bit’s LED display. This example provides an easy way to determine the number associated with each key on the remote (especially the non-numbered CH and VOL keys).
Hardware Setup
- Set the cyber:bot board’s power (PWR) switch to Position 0.
- Make sure the battery holder is loaded with 5 AA batteries.
- Make sure the battery holder’s barrel plug is firmly plugged into the cyber:bot board’s barrel jack.
- Connect your micro:bit module to your computer with a USB cable.
Software Setup
- In a browser, go to makecode.microbit.org to open the micro:bit Makecode Editor.
- Add the Cyber:bot extension to your project.
- Go to Add extensions to your micro:bit.
- Skip the Quick Start section, and instead start at the section titled Adding an extension to micro:bit Filesystem.
- Watch the video and then add the cyberbot.py module to the project by following the instructions from there to the end of the page.
- Next, follow the same steps to add the tv_remote.py module to the project. It will be in the same folder with cyberbot.py.
Project: IR_Remote_Test
- If you haven’t already done so, follow the instructions in the Software Setup section to add the Cyber:bot extension.
- Set the name to ir_remote_test and enter the project below.
(See Save & Edit Projects and Flash Projects with MakeCode Editor.) - Click Download.
(See Flash Projects with MakeCode Editor.) - Set the cyber:bot board’s PWR switch in position 1.
- Point the remote at the IR receiver on the board, and then press and release a number button on the remote. You should see the number displayed on the LED matrix.
IR Interference — Are you seeing numbers appear on the micro:bit LED matrix when you are NOT pressing any numbers on the remote?
First, check to see if you are getting a syntax error report from your micro:bit.
If that’s not the problem, your IR receiver might be getting signals similar to a TV remote’s signals from some other source. The most common culprit is overhead fluorescent light fixtures. If possible, turn them off or try taking your robot to a different area.