Skip to content
Parallax Learn

Parallax Learn

  • Welcome
  • Tutorials
        • Tutorial Series head tag

          Tutorial Series
        • Tutorial Series

          The special, classroom-ready series pages are organized collections of tutorials for our most popular hardware and/or languages. The tutorials for each topic are conveniently accessible from a single page, shown in the order it is recommended that they be completed.
        • Robotics Series Head tag

          Robotics Series
        • Robotics Series

          • Artificial Intelligence
          • Cybersecurity: Radio Data tutorialCybersecurity
          • cyber:bot + Python
          • cyber:bot + MakeCode
          • Boe-Bot Tutorial SeriesBoe-Bot
          • Arduino Shield-Bot
          • ActivityBot with C TutorialsActivityBot + C
          • ActivityBot with BlocklyProp Tutorial SeriesActivityBot + BlocklyProp
          • Scribbler 3 Tutorial SeriesScribbler 3
        • Electronics & Programming Series Head tag

          Electronics & Programming Series
          • BS2 Board of Education Tutorial SeriesBS2 Board of Education
          • Propeller C-Language BasicsPropeller C Basics
          • FLiP Try-It Kit C Tutorial SeriesFLiP Try-It Kit + C
          • FLiP Try-It Kit BlocklyProp TutorialsFLiP Try-It Kit + BlocklyProp
          • Badge WX Tutorial SeriesBadge WX
          • Propeller BlocklyProp Basics and ProjectsPropeller BlocklyProp Basics
          • View All Tutorial Series »
        • Browse Tutorials
        • Browse Tutorials

          Individual tutorials sorted by robot or kit, and language.
        • By Robot or Kit
          • ActivityBot
          • SumoBot WX
          • Boe-Bot
          • Shield-Bot
          • cyber:bot
          • Badge WX
          • ELEV-8
          • ARLO
        • By Language
        • By Language

          • Propeller C
          • Arduino
          • BlocklyProp
          • PBASIC
          • Python
          • MakeCode
          • View All Tutorials »
  • Educators
  • Reference
  • Downloads
  • Home
  • All Courses
  • Control your cyber:bot with an Infrared TV Remote

Control your cyber:bot with an Infrared TV Remote

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 Google Chrome or Microsoft Edge browser, go to python.microbit.org to open the micro:bit Python Editor.
  • Add two modules to the project: cyberbot.py, qti.py, and intbits.py.
    • Go to Add modules to your micro:bit.
    • Skip the Quick Start section, and instead start at the section titled Adding a Module 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. 

Script: IR_Remote_Test

  • If you haven’t already done so, follow the instructions in the Software Setup section to add the cyberbot.py and tv_remote.py modules to your project.
  • Set the project’s name to ir_remote_test, enter the script below, and then click Save.
    (See Save & Edit Scripts and Flash Scripts with Python Editor.)
  • Click Send to micro:bit.  
    (See Flash Scripts with Python 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_remote_test.py            

from cyberbot import *
from tv_remote import *

bot(22).tone(2000, 300)

while True:
    num = ir(10).remote()
    if num > -1:
        display.scroll( str(num), 75, wait=False )
    sleep(100)

 

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.

 


Printer-friendly version
Build the IR Receiver Circuit
Prev
Drive your cyber:bot with the Remote
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024

© 2025 Parallax Learn • Built with GeneratePress