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 [1]. 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)
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.”
Links
[1] https://learn.parallax.com/tutorials/language/python/led-lights/connect-and-blink-light/script-and-tests