How it Works

How It Works: led_blink_with_voltmeter

Earlier, we learned that the micro:bit’s microcontroller connects a pin like P13 to its 3.3 V supply in response to pin13.write_digital(1) and to its 0 V (GND) supply in response to pin13.write_digital(0).  It looks like the 0 V (GND) signal checks out, but why does it only supply 2.65 V to turn the LED light on?

The answer is that the transistors inside the micro:bit that make connection between an I/O pin and 3.3 V have some internal resistance.  With current for the LED circuit flowing through that internal resistance, the result is a voltage drop of 0.55 V inside the micro:bit, leaving 2.65 V for the LED circuit.  This I/O pin behavior is called voltage drop under load.  Again, your measurements could vary, and the variations will depend on temperature, version of micro:bit, and even microcontroller manufacturing variations from one batch to the next.

This script started as led_blink from Connect and Blink a Light.  Aside from the fact that the green light was moved from P14 to P13, the led_blink_with_voltmeter script has two main differences.  First, it has from multimeter import *, which has functions for measuring voltage and displaying it with the CYBERscope.  Second, it measures voltage with voltmeter(device="CYBERscope") after each pin13.write call.  This function call measures the voltage between the P2 and P0 alligator clips and sends the measurement data to the CYBERscope to be displayed.

# led_blink_with_voltmeter

from microbit import *
from multimeter import *                  # <-- added

while True:
    pin13.write_digital(1)
    voltmeter(device="CYBERscope")        # <-- added
    sleep(2500)
    pin13.write_digital(0)
    voltmeter(device="CYBERscope")        # <-- added
    sleep(2500)
    


Try This: Float the P13 Resistor Lead

Here, you will test I/O pin voltage without any load.  You will do this by disconnecting the circuit “load” from the I/O pin “supply.”

  • Unplug the resistor lead that’s connected to the left terminal strip’s (e, 17) socket.
  • Leave the other end where it is, plugged into the right terminal strip’s (a, 17) socket.
  • Unbend the resistor leads to make it point straight up in the air.  In electronics-speak, this is sometimes called “floating” the lead.
  • Repeat your voltage measurements.
  • Do the measurements now oscillate between about 3.3 V and 0 V?
  • Reconnect the resistor to the left terminal strip’s (e, 17) socket when you are done.