The pins are connected directly to the LEDs and the current limiting resistors - I have a microbit and checked this.
I pulled the C++ microbit compiler code from the
[lancaster university github][1]. It looks like one row of the microbit display is illuminated at a time and the display constantly scans through the rows.
Anything that turns on and off at a frequency greater than about 15Hz appears as if it is constantly on.
Looking at the display through a digital camera - I can see the LED brightness is not constant. The frame rate of the digital camera is not synced with the refresh rate of the display, so as the rows are switched on and off, this is picked up as a variation in intensity in the camera display.
Edit.
I put up a full account of 'scoping the LED pins on my website here:
http://mattoppenheim.com/2019/03/06/measuring-the-bbc-microbit-led-current-draw/[2]
I wrote a script to allow me to turn on or off one LED at a time and measured the total current drawn by the microbit using a Fluke 87 meter. I will put the script at the end of this post to allow others to check and improve on this.
The voltage applied was 3.00V from a TTi EX345RD power supply.
The results surprised me:
LEDS current in mA
0 4.74
1 5.79
5 8.63
10 11.31
15 12.75
20 13.45
25 14.01
I can see that the current draw per LED decreases as more are active. Maybe the intensity of the LEDs is decreased with an increasing number active LEDs?
I used my Analog Discovery 2 to 'scope the LED pins. They are indeed only active 1/3 of the time.
On the 'scope I can see that the LED cathod voltage does drop with an increasing number of active LEDs, from a maximum of 912mV (one LED active) to a low of about 330mV (all LEDs active). The cathode is connected to a 220 Ohm resistor, so the current draw per LED with all 25 LEDs active is around 0.33^2/220, which is about 0.5mA.
A single pin supplies a maximum of 9 LEDs, so supplies a maximum of about 4.5mA. This is in spec.
Here's my Micropython script to turn LEDs on/off using the A/B button:
from microbit import *
# intensity of LED
BRIGHT = '9'
# how many LEDs to turn on at a time
INCREMENT = 1
# maximum number of LEDs allowed on at once
MAX_BRIGHT = 25
# how many LEDs on at boot
START_BRIGHT = 3
def decrease(num_bright, inc):
num_bright = limit(num_bright-inc, MAX_BRIGHT)
return num_bright
def increase(num_bright, inc):
num_bright = limit(num_bright+inc, MAX_BRIGHT)
return num_bright
def leds_string2(bright):
''' return led string '''
bright = limit(bright, MAX_BRIGHT)
leds_string = BRIGHT*bright + '0' * (MAX_BRIGHT-bright)
leds_string = ":".join(leds_string[i:i+5]
for i in range(0, len(leds_string), 5))
leds_image = Image(leds_string + ':')
return leds_image
def limit(val, limit):
''' limit <val> between 0 and <limit>'''
if val > limit:
val = 0
if val < 0:
val = MAX_BRIGHT
return int(val)
num_bright = START_BRIGHT
while True:
if button_a.was_pressed():
num_bright = (decrease(num_bright, INCREMENT))
if button_b.was_pressed():
num_bright = (increase(num_bright, INCREMENT))
display.show(leds_string2(num_bright))
sleep(0.1) ```
[1]: https://github.com/lancaster-university/microbit-dal
[2]: http://mattoppenheim.com/bbc-microbit-led-current-draw/