Series Resistance and Range

We now know that less series resistance will make an LED glow more brightly.  A reasonable hypothesis would be that brighter IR LEDs can make it possible to detect objects that are further away.

  • Use the Open button in the micro:bit Python Editor to re-open test_both_IR_indicators.
  • Click Send to micro:bit to flash the script.
#test_both_IR_indicators

from cyberbot import *

bot(22).tone(3000, 1000)

while True:
    irL = bot(14, 13).ir_detect(37500)
    irR = bot(1, 2).ir_detect(37500)
    bot(20).write_digital(irL)
    bot(21).write_digital(irR)
  • Set the cyber:bot board's PWR switch to 1.
  • Verify that both LED indicator circuits are working properly before continuing.
  • If anything does not work correctly, check for and fix any errors in your circuit or code before continuing.
  • Set the cyber:bot board's PWR switch to 0.

Resistance vs Distance

You will need two each of the resistor values you used with the red LED test, along with a piece of paper and a ruler. The goal is to measure the object detection distance for different resistor values in series with the IR LEDs. 

  • As you work, remember to set the cyber:bot board's PWR switch to position 0 for changing resistors, and to position 1 for running the test.
  • Remember also that the same script will run whenever you set the PWR switch to 1, so you can pick up right where you left off with each test.

  • Place your cyber:bot in an open area, and put the ruler in front of it extending outwards.
  • With the IR LEDs' 2 kΩ resistors in place on P1 and P14, and the script test_both_IR_indicators running, hold a sheet of white paper in front of the cyber:bot about a foot away.
  • Move the paper slowly towards the robot, and keep an eye on the P20 and P21 amber LEDs. When you see the LEDs go off, the cyber:bot detects the paper. Note that distance on the ruler, and record your data.
  • Replace the IR LEDs' 2 kΩ resistors on P1 and P14 with 4.7 kΩ resistors.
  • Again, determine the furthest distance at which the same sheet of paper is detected, and record your data.
  • Repeat with 1 kΩ resistors, 470 Ω resistors, and 220 Ω resistors.  (For the smaller resistor values, they may end up making the detectors so sensitive that they see the table surface in front of your robot.  If that happens, set the robot on the edge of the table with the IR detectors pointing off the end and try the distance measurements again.)
Series Resistance on IR LED Maximum Detection Distance
4700 (yellow-violet-red)  
2000 (red-black-red)  
1000 (brown black-red)  
470 (yellow-violet-brown)  
220 (red-red-brown)  
  • Before moving on to the next activity, restore your IR object detectors to their original circuit with 2 kΩ resistors in series with each IR LED; or whichever resistor value lets your robot "see" objects several inches away, but not see the floor.
  • Also, before moving on, make sure to test this last change with the script test_both_IR_indicators to verify that both IR object detectors are working properly.