4

As I read the Nordic datasheet for the nRF51822, the GPIO pins on the chip are able to source or sink 0.5mA, or 5mA for up to three pins configured in high-current mode. As the schematic shows, the 25 LEDs on the micro:bit are connected electrically in three rows of nine (with two gaps), with common anodes in each row, and a series resistor of 220R for each column, and both columns and rows directly connected to GPIO pins. This gives a current in each LED of about (3.3V - 2V)/220R = 5mA, making more like 50mA sourced from the pin driving a row of nine LEDs through their common anode.

Have I missed something, or is the chip being used far outside its specification?

Mike Spivey
  • 612
  • 5
  • 12
  • I'm guessing that's indeed an oopsie. Nice catch. – Richard the Spacecat Feb 13 '19 at 11:10
  • Please provide a link to the schematic for the micro:bit. In particular, what makes you think the common anode is connected to a GPIO pin? – Elliot Alderson Feb 13 '19 at 13:32
  • To expand on what @ElliotAlderson said, it's likely that there's a transistor between the LEDs and the GPIO, to reduce the current demand on the nRF51822. – Hearth Feb 13 '19 at 13:35
  • @Hearth Actually, if it is a **row** of LEDs rather than a **digit** in a seven-segment display, then I suspect that the anodes are connected directly to the power supply voltage. – Elliot Alderson Feb 13 '19 at 13:37
  • 1
    @ElliotAlderson Actually, I just went and looked up the [schematics](https://github.com/bbcmicrobit/hardware/blob/master/SCH_BBC-Microbit_V1.3B.pdf) out of curiosity and... yep, the asker is correct. It's an LED matrix being driven directly by GPIO pins on both the cathode and anode side. – Hearth Feb 13 '19 at 13:42
  • @Hearth Yikes! That doesn't sound good. – Elliot Alderson Feb 13 '19 at 13:48
  • Mike, consider posting an answer to this question based on your findings. It will avoid having this appear as an "unanswered" question, but moreover will give you some internet points in potential upvotes. :) – JYelton Feb 13 '19 at 15:13
  • Was the microcontroller warm or overheating? (If you have it... What is the delta temperature above ambient?) – MicroservicesOnDDD Jun 03 '23 at 16:35

1 Answers1

2

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/
Oppy
  • 121
  • 4
  • 2
    Thank you for your investigation, and the nice explanation of how a multiplexed display works. The only problem is your claim at the end that the current is within spec: I've not seen a Nordic document that suggests these high currents are consistent with the specification of the chip. Note also that average dissipation is not the only problem to consider. With the switching transistors for the GPIO on the same die as the processor, we can expect problems with noise when large currents are switched -- and rumour has it I2C doesn't work well when the display is in use. – Mike Spivey Feb 14 '19 at 22:43
  • Thanks for your comments. I measured the current draw with different numbers of LEDs active and added the results to my post. – Oppy Feb 16 '19 at 18:43
  • The question remains, is the device able to handle this current? You didn't specify which pins you measured the current on, and while three pins can handle up to 5mA, there are twelve pins involved in the LED matrix in total, both sinking and sourcing current. – Hearth Feb 16 '19 at 18:49
  • Those are interesting measurements, but some questions remain -- chiefly what voltages are on the GPIO pins when the LEDs are on? If the Vf of the LEDs is about 2V and the resistors are 220R as in the schematic, then it seems likely the pins are being pulled away from the rails by the current. If I get the chance, I will make some measurements of my own and report back. – Mike Spivey Feb 16 '19 at 23:37
  • I 'scoped the microbit and put up the results in my answer above and a more detailed account on my website. The current draw from the pins is in spec. – Oppy Mar 06 '19 at 14:17