Max Current for Digital Pins: Is it limited by the board?

I have a MKR Wifi 1010 board. I am trying to figure out the right value of a resistor as a current limiter for a typical 2V red LED that can draw a maximum of 20mA.

I did some testing and without a current limiting resister, it seems the MKR Wifi 1010 will only let 7mA flow. I see a note in the full pinout here at the bottom of each page that the max current per pin is 7mA.

Can I assume correctly that the board has a current limiter for each pin? I think this means I don't need a current limiting resistor since the pin already has that protection well below the 20mA I am worried about.

BTW, a 100ohm resister gets 5mA flowing through the LED and a 220ohm resister gets 3mA. Neither of these are very bright. But the 7mA without the resister is OK for my application.

I also see the pin group maximum current is 65mA per group. Are all digital pins considered a group or is there some other grouping like the ports (PA vs PB? or PAxx through PBxx)? I tried to google this, but I did not find an answer.

Thought that Arduino was limited to: 7 mA current per I/O pin.


“ I did some testing and without a current limiting resister, ”

Never do this.

When you said: "Thought that Arduino was limited to 7mA..." are you trying to answering my question saying that the limit is provided by the electronics or that it is a design limit not be be exceeded or perhaps both: yes, the board will not let more than 7mA flow but one should not design a circuit that tries to draw more than that as well?

Obviously, I am not an expert, so I need a little more to go on than what comes off as a condensing response.

If the current limit of a MKR Wifi 1010 board i/o pin is 7mA, do not try to take more than that amount.
You mentioned you tried a LED without a current limiting resistor.
Doing this, the LED will damage the i/o pin.

If the controller is powered by 3.3 volts:

  • (3.3V(Vcc) - 2v(LED) ) ÷ 7mA ≈ 185 Ω this will be the safe resistor to get 7mA current flowing.

“ Can I assume correctly that the board has a current limiter for each pin? ”
No.


There are high efficient LEDs that are very bright at 5mA.


“I also see the pin group maximum current is 65mA per group.”
Port

BTW
What was the actual voltage drop on the LED when you measure it ?

@LarryD Thank you, this is very helpful.

I got 1.94V over the LED and 0.54V over the 220ohm resistor.

1.94v confirms the 2v for a red LED.

1.94v + .54 = 2.48v

3.3v - 2.48 = .82v across the output MOSET in the controller, seems high.

.54V ÷ 220 Ω = 2mA thru the LED :frowning:

Try a different output, one that never had a LED without a series resistor during your experimenting.


Which way are you wiring the LED, as D5 or D6 in the image below (UNO is shown, ignore this fact) ?

Double check that your 3.3V is indeed 3.3V. :thinking:

Using only the 5V from USB (before I was using a LiPo Battery), I get:

I am setup like D6: PIN to LED+ to R to GND

Vcc to GND=3.29V
LED = 1.92V
220ohm = 0.54V
Current = 5.25mA

I get this on Pins 0,1,2,3,4 and 5. Only Pin 0 was part of the initial experiment.

This doesn’t make sense.
If 5.25mA is the resistor/LED current, 5.25mA * 220 Ω = 1.155V and you said .54V :thinking:

How and where are you measuring 5.25mA ?

Is the level on the i/o pin a constant HIGH or is it pulsing ?


Show us a good image of your ‘actual’ wiring.
Show us a good image of you measuring the LED current flow.

I built the circuits on a separate breadboard and got numbers that are a little different. I have another MKR Wifi 1010 so I plugged this into the same breadboard and I got the same answers for both Arduinos. This other MKR Wifi 1010 is brand new, so no issues with possible damage.

Voltage PIN to Ground across one of the 8 LED plus 220ohm resister paths is 2.74V
LED Voltage drop is 1.89V
Resistor Voltage drop is 0.84V

Current through the path from each PIN to GND is 3.69mA

Total current through all 8 LEDs is ~28.9mA (this seems to bounce a little but I have an old multimeter)

If that’s a red red black brown resistor, it is 2.2k


Okay, .84v ÷ .00369 ≈ 241Ω

.84v(220) + 1.89v(LED) = 2.78
3.3v - 2.78 = .52 across the o/p pin still high

It is hard to tell from the picture. These are ELEGOO resisters at 1% tolerance.

These are Brown Brown Black Black Brown, so 2 2 0 x1 @ 1%. I double checked them on both multimeter and my LCR tester. 220ohms, not 2.2K.

Re post.


Brown Brown Black Black Brown (1%) is 110 Ω :thinking:


Is the pin .52v to GND .

Is the o/p a solid HIGH or is it pulsed ?

Is Vcc 3.3V ?

Maybe it is my multimeter dropping some voltage? It is 20 years old (I hand built it from a kit). I order a new one that I should get tomorrow. I have been meaning to get a new one for a while, but I do these projects sporadically and it has so far not been an issue. Anyway, a decent enough excuse for me to spend some money on a new gadget.

Yes, sorry, my vision is not what it used to be. The card says Red for 2 but I had Brown in my head since the tolerance is brown and the colors look the same to me since my vision is poor. Upon closer inspection and under good lighting it is clearly Red Red Black Black Brown.

220OhmResistors-cropped

Looks R R Bk Bk Bn in the image :slight_smile:


Is the o/p a solid HIGH or is it pulsed ?

Is Vcc 3.3V ?

The Open PIN is a solid 3.28V and does not pulse.

0.52v on the O/P pin when drawing only 3.69mA seems high to me.
:pleading_face:

Implies o/p resistance is 140 ohms.

When I first aquired my mkr wifi1010 I ran across this post discussing the "drive strength" of the pins on the samD boards.

Apparently there is a bit in a register that sets the drive strength of the pins to be either 7mA or ~ 2.5mA depending on whether it is set or not. By default it is set to the lower limit on arduino boards even though it is not mentioned anywhere.

The last post in the thread sums it up:

@MartinL
By default the DRVSTR (driver strength) bit isn't set in the Arduino SAMD core code, therefore the GPIO pins operate in low current mode and are able to source 2mA and sink 2.5mA.

To increase a given pin's driver strength and allow it to source 7mA and sink 10mA, just add the following line after calling the pinMode() function. In this example the driver strength of digital pin D7 is increased:

PORT->Group[g_APinDescription[7].ulPort].PINCFG[g_APinDescription[7].ulPin].bit.DRVSTR = 1;

Subsequent calls to the digitalWrite() function don't affect the DRVSTR bit in any way.

I wrote this function to test this for myself:

void pinModeStrong(uint8_t pin, uint8_t mode) {
  pinMode (pin, mode);
  PORT->Group[g_APinDescription[pin].ulPort].PINCFG[g_APinDescription[pin].ulPin].bit.DRVSTR = 1;
}

Tested using the backlight on an Oled there certainly was a major difference in brightness. I did not measure the actual current myself.

This suggests that there must be some form of current limitation at least in the default low current mode. Maybe @pert would know for sure.

2 Likes

We really do learn something new every day, +1