Differing voltages on pin D7 and D8D6D5

Hi , I am new to Arduino, but getting along just fine.

Nano 33 IoT connected to cloud successfully. I have a dashboard that is controlling 4 LED's from pins D5 D6 D7 D8.

I am measuring the voltage (negative to each pin respectively) when these pins are HIGH.

I am seeing 2.7V output from D5 D6 and D8, but I am seeing 3.3V from D7.

Is this correct? Why are they different? Is it a problem (apart from my LED on D7 is brighter).

I have put my code below. Any pointers welcome.

Thanks W.


  bool blueLED;
  bool redLED;
  bool greenLED;
  bool yellowLED;
#include "thingProperties.h"

int myYellowLED = 5;
int myGreenLED =6;
int myBlueLED = 7;
int myRedLED = 8;

void setup() {
  // Initialize serial and wait for port to open:
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found

  // Defined in thingProperties.h
  pinMode(myYellowLED, OUTPUT);
  pinMode(myGreenLED, OUTPUT);
  pinMode(myBlueLED, OUTPUT);
  pinMode(myRedLED, OUTPUT);

  // Connect to Arduino IoT Cloud

void loop() {

void onBlueLEDChange() {
  Serial.print(" BLUE ");
  if (blueLED) {
    digitalWrite(myBlueLED, HIGH);
  else {
    digitalWrite(myBlueLED, LOW);
void onRedLEDChange() {
  Serial.print(" RED ");
   if (redLED) {
    digitalWrite(myRedLED, HIGH);
  else {
    digitalWrite(myRedLED, LOW);

void onGreenLEDChange() {
  Serial.print(" Green ");
  if (greenLED) {
    digitalWrite(myGreenLED, HIGH);
  else {
    digitalWrite(myGreenLED, LOW);

void onYellowLEDChange() {
  Serial.print(" Yellow ");
  if (yellowLED) {
    digitalWrite(myYellowLED, HIGH);
  else {digitalWrite(myYellowLED, LOW);

Please follow the advice given in the link below when posting code , use code tags when posting code here to make it easier to read and copy for examination

Please show a schematic of your hardware setup. I have a feeling that you're connecting your LEDs directly to the Dx pins without a current limiting resistor, relying on the microcontroller's protection circuitry to limit its source current. This would explain why you see the voltage that corresponds to the forward drop of your leds on the output pins.

Thanks for your response. I can confirm that I am connecting my LEDs in series with a 220 Ohm resistor. I have observed that my Blue LED causes the output voltage to be around 3V, whilst Red Green and yellow LED's are around 2.7V.

Simply swapping my Blue LED to a Red LED causes the output voltage to go from 3V to 2.7V.
Maybe this is what I should be learning.

LED Voltage Picture

Place the DMM negative to gnd.
Measure each of the output pins with the DMM, when you signal that LED to be ON and OFF.

Measure each of the anode pins of the LED when signaled ON and OFF.

Please include a circuit diagram.
A hand drawn circuit will be fine, label pins and LEDs, and resistor values.

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

I can confirm all switching (including remote) is working as expected. I am just curious as to the differing voltages for different LEDs.
My first suspicion was that the Nano 33 IoT board puts out different voltages on D7. I now know that is not true.
If I replace all LEDs with the same colour, I get the same voltages.

This may help.

Tom.. :smiley: :+1: :coffee: :australia:

1 Like

Do you measure the voltage directly at the pins (D5 etc.) or at the anode of the LED? Cause that would explain the different voltages.
Please note that the maximum source current of this microcontroller on any of its Dx output pins is either 2mA or 7mA depending on how you configure them. For instance for your red led and a 220R resistor, you're already trying to force 8mA through the corresponding pin, which the microcontroller won't allow. Please note as well it's bad practice to try and use the hardware protection of the microcontroller as a regular means of current limiting in your circuit.
Please refer to the SAMD21 datasheet, page 1010. https://ww1.microchip.com/downloads/en/DeviceDoc/SAM_D21_DA1_Family_DataSheet_DS40001882F.pdf

Perfect - every day is a school day. And that's why I'm here!

Ok thanks for this, I am still very new to this. I work with heavy electrics so loading etc are understandable. I followed an example from a web site which used an LED and a 220Ohm resistor as an example. I ramped up to four as per my circuit shown earlier.

So am I grossly overloading this board?

Obviously I am just experimenting, but if I did want an array of 4 LEDs in real life, what value resistors should I consider to allow me to not overload this board?

Or I am I barking up the wrong tree?


For reference:

Yellow LED.
Voltage at D5 pin is 2.7V
220 Ohm resistor
Voltage at Anode of LED 1.8V

Did the example use this particular processor (SAM21) or e.g. an ATMega328? Note that the older ATmega328P allows a current draw of 20mA on a single output pin. Many simple led examples exploit this higher current sourcing capability. Personally I consider it bad practice to use microprocessor pins as power supplies, even if the loads are fairly low (e.g. ~5mA). Better use those pins to switch a (small signal) mosfet that in turn controls the leds or whatever other load you're switching.
Long story short: a microprocessor is not a power supply.

So according to Ohm's law, the current draw here is 0.9V / 220R = 4mA, which is either twice the permissible current draw or a little over half it, depending on how the pin is configured. I don't know how the Arduino IDE configures the SAM21 pins by default, whether they're run in high-current mode or not.

1 Like

Thanks for your very useful input.

The example used the very same board Arduino Nano 33 IoT

I understand your explanation as to switching and it makes perfect sense ( bit like contactors in my industry).

Early stages here....

Yes, very much so, I suppose. Instead of trying to make a microprocessor do any heavy lifting, try to give it a lever. That's where stuff like transistors (MOSFET or BJT) and relays (/contactors) come in.

1 Like

Use a LED calculator - either as a phone app, or online.
The better ones have presets for various kinds of LEDs, otherwise you have to check datasheets for the voltage drop of your specific LED (or measure it yourself).

So the point here is that the output drivers in the MCU have significant effective resistance. In the ATmega328 this amounts to something like 27 Ohms IIRC, but if the specification for this processor is a maximum of 8 mA, we may presume the effective resistance is at least 100 Ohms.

You will find charts in the datasheet showing how much the output voltage drops for various current draws, it is by no means insignificant. :astonished:

blue LED in general is brighter and takes less current, try changing LEDs around and measure again, do you have similar situation but on different pin now?