Problem pin D13 in Mega2560 Pro (version Mini)

Hello,
I have the board Arduino Mega2560 Pro (version Mini), if setted D13 with INPUT_PULLUP, your voltage is 1.79v, why?
I tested with other board but have same problem.

Scenarios:

pinMode(13, INPUT_PULLUP); --Result: 1.79v
pinMode(11, INPUT_PULLUP); --Result: 4.76v

I attached image from arduino.
I need help :slight_smile:

1 Like

Pin 13 has an LED attached, which affects the reading when you use the pin as in input with the built-in weak pull-ups.

From https://www.arduino.cc/en/Tutorial/DigitalPins:

NOTE: Digital pin 13 is harder to use as a digital input than the other digital pins because it has an LED and resistor attached to it that's soldered to the board on most boards. If you enable its internal 20k pull-up resistor, it will hang at around 1.7V instead of the expected 5V because the onboard LED and series resistor pull the voltage level down, meaning it always returns LOW. If you must use pin 13 as a digital input, set its pinMode() to INPUT and use an external pull down resistor.

[

Expand<](Problem pin D13 in Mega2560 Pro (version Mini) - General Electronics - Arduino Forum)
And that is indeed the case. Apparently in your case it is a red LED with that low voltage drop. "INPUT_PULLUP" is effectively a 47k pull-up resistor on the port and the LED resistor is most likely 1k so you are seeing just the LED voltage drop. If you set it as OUTPUT and HIGH of course it will read close to 5 V and the LED will light.

In fact even with just the INPUT_PULLUP you will usually see a glow from the LED.

The original Mega 2560 has an op-amp monitoring this pin and driving the LED so this does not happen.