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
  • Visible Light Navigation for the cyber:bot

Visible Light Navigation for the cyber:bot

Simple Light to Voltage Sensor

Imagine that your cyber:bot is navigating a course, and there’s a dark or shady area at the end, such as a cardboard box garage.  Your robot’s final task in the course is to stop inside that dark area.  Or, perhaps you want the robot to search for and stop under bright light.  There’s a simple phototransistor circuit you can use that lets the micro:bit module know it detected bright or dim light by comparing the ambient light to some specified level. 

Ambient means ’existing or present on all sides’ according to Merriam Webster’s dictionary.  For the light level in a room, think about ambient light as the overall level of brightness.

Parts List

(1) phototransistor
(2) jumper wires
(1) resistor, 2 kΩ (red-black-red)
(1) cardboard box “garage” that fits the cyber:bot
(1) Optional – a flashlight or desk lamp, incandescent works best

After some testing, and depending on the light conditions, you might end up replacing the 2 kΩ resistor with one of these resistors, so keep them handy:

(1) resistor, 220 Ω (red-red-brown)
(1) resistor, 470 Ω (yellow-violet-brown)
(1) resistor, 1 kΩ (brown-black-red)
(1) resistor, 4.7 kΩ (yellow-violet-red)
(1) resistor, 10 kΩ (brown-black-orange)

The drawing below will help you tell apart the phototransistor and infrared LED, since they look similar.

Building the Voltage Detector

The schematic and wiring diagram below show the schematic and wiring diagram of a circuit very similar to the ones in streetlights that turn on automatically at night.  The circuit outputs a voltage that varies depending on how much light shines on the phototransistor.  The cyber:bot will monitor the voltage level with one of its analog to digital pins.

  • Set the cyber:bot board’s PWR switch to 0 — always do this before building or modifying circuits on the board.
  • Build the circuit shown, using the 2 kΩ resistor.
  • Double-check to make sure you connect the phototransistor’s emitter lead (by the flat spot) to the resistor, and its collector to 3.3V.
  • Also double-check that the phototransistor’s leads are not touching each other.

 


Printer-friendly version
About phototransistors
Prev
Measuring Phototransistor Voltage
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

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

© 2025 Parallax Learn • Built with GeneratePress