In this activity, you will send very slow on/off signals to the P13 LED light circuit and measure the voltage that the I/O pin supplies to turn the light on and off. By slowing down the highs and lows, you will be able to measure the voltages the P13 pin supplies to the green LED.
Setup from Blink Sequencing [1].
(2) Alligator clip probes connected for voltmeter functionality, like in the Parts and Circuit from First Electrical Connections with a Breadboard [2]
(1) 1 kΩ resistor (for the Your Turn section).
led_blink_with_voltmeter.hex [3]
IMPORTANT: Your LED on voltage measurements might be considerably higher than the 2.65 V measurements shown below. Basically, if you get anything in the 2.5 to 3.3 V range, assume it’s good.
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 [6]. 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.”
In the main activity, you measured the I/O pin high voltage under load.
In the Try This section, you measured the I/O pin high voltage with no load.
In both activities the I/O pin low voltage was not under load because it was trying to supply 0 V to a circuit that had 0 V (GND) at the other end. No electrical pressure was applied, so no current was flowing through the circuit. Thus, no current “load” on the I/O pin.
What I/O pin voltage under load did you observe? What is your explanation?
In this activity, you used a voltmeter to measure the voltage supplied by the I/O pins to turn the LED on and off in the P13 LED light circuit.
Use the voltmeter to check the voltage across the yellow LED circuit. Confirm that it is similar to that of the green LED circuit.
Self-check
Solution: Make sure to change the pin in the script to 14. The reading should be approximately 2.95 V.
Links
[1] https://learn.parallax.com/tutorials/language/python/led-lights/blink-sequencing
[2] https://learn.parallax.com/tutorials/language/python/breadboard-setup-and-testing-microbit/first-electrical-connections-5
[3] https://learn.parallax.com/sites/default/files/content/Python/LED/led_blink_with_voltmeter.hex
[4] https://python.microbit.org/v/2
[5] https://cyberscope.parallax.com
[6] https://learn.parallax.com/tutorials/language/python/led-lights/connect-and-blink-light/script-and-tests