Dedicated to my underrated D13...or maybe not?

Hi,

(Warning! I am relatively new to Arduino...:wink: )

On most boards D13 is hardwired to an onboard LED to make
first steps and checks easier.

Without using my soldering iron and without altering the original
hardware setup:
Is it possible to use D13 for anything (external) else and neither
kill the GPIO due to draw to much current nor get random effects
due to the fact that the LED is evesdropping the line from and to
D13?

Thank you very much in advance for any help!
Best regards,
mcc

The LED is not connected directly to D13. D13 is monitored by an op-amp, an LMV358, which controls the LED.
I avoid using it as an input, but it’s fine to use as an output and behaves normally.
Edit: I should add, it’s probably OK as an input too, but I’ve never used it.

See the attached UNO R3 schematic. The op-amp is U5B.

Arduino_Uno_Rev3-schematic.pdf (81.4 KB)

Hi OldSteve,

thanks for your reply, help and the schematics.

That's a really nice setup this way with an OpAmp.

Unfortunately (in this case) I have an Pro mini from
a different seller (I try to avoid the work "clone","knock-off"
or such, since it is OSH - so nothing bad at all with this).

I took a closer look onto the board and cannot find anything,
which may be a OpAmp.
I think it is simply this way D13*---R---LED---*GND.

Is there any non-destructive way to check, whether D13 can
still be used for GPIO purposes?

Best regards,
mcc

mcc01:
I think it is simply this way D13*—RLED—*GND.

I was assuming an UNO or Mega2560.
Just looking at my Pro-Mini schematic, D13 does connect directly to the LED/resistor combo.
You should have mentiond it was a Pro-Mini originally, (and I should have asked).

The LED resistor is 330 ohms, so the LED will draw about 9mA to 10mA. You’d still be OK using that pin as an output, as long as you don’t draw more than about 15mA with external circuitry, or 20mA as a safe maximum. Then the current drawn from the chip’s I/O pin would be <= 30mA. The ‘absolute maximum’ that can be drawn from an ATMega328P pin is 40mA. (Damage can occur at that level or higher.)

I’ve attached the Pro-Mini schematic.

Arduino Pro Mini Schematic.pdf (59.1 KB)

Hi OldSteve,

...I didnt thought, that the implementations of such a "good ole tradition
like the D13-LED"" would be different on different boards. Otherwise I would
have mentioned, that I am talking/asking about a Pro Mini... :slight_smile:

On one side I am happy, that the vendor or my third-party-ProMini has
not oversimplified the board by replacing an OpAmp by a resistor since
the "original" schematics already have done that for the ProMini...on the
other hand: The OpAmp is really not a bad idea.

Ok, limited output can be done. Input?

By the way: Can you estimate how much current is floating between
a GPIO pin, which is directly connected to another GPIO (of another
ATmega or a common sensor ... for example an I2C one or a SPI?
Only to get a rough impression of the circumstances here....

Thanks a lot for learning me to walk, OldSteve ! :slight_smile:
Best regards,
mcc

On this forum we have a rule of thumb that 20mA is the safe maximum value for output current of a pin. When higher currents are drawn, the output pin is no longer 5V.

The Pro Mini pin 13 as input can cause troubles, unless it is a strong signal.

Did you know that it is easy to remove a smd component ? For example the resistor or the led at pin 13. Use a big blob of solder that heats both ends of the component, and hold the board tilted to let it fall of.

An input of the ATmega328P (used in Uno and Pro Mini) is very high impedance. It does not use current.
That means that if an output pin is connected to an input pin, there is no current.

If you connect two output pins together, that causes a shortcut and both Arduino boards might get damaged.

For I2C, the current is determined by the pullup resistors. Suppose the pullup resistors of SDA and SCL are 4k7, then the current 1mA when the signals are pulled low. If they are pulled low 1/1000 of the time, then the average current is 1µA.

When using two Arduino boards, don't forget to connect the grounds.

Fun facts:
The Pro Mini has 8 analog inputs, but only 6 of them can be a digital pin as well (A0...A5), because A6 and A7 are only analog inputs.
The ATmega328P combines a few functions in a pin. Sometimes that means that the internal hardware inside the chip has those functions parallel. For example pin A4 has the hardware for digital pin, analog input and I2C all together on the same pin, and you can use all three functions at the same time (which would be useless, but it is possible).

Hi Koepel,

Thanks for the look into the Matrix! :slight_smile:

The Pro Minis I bought have a ATmega328P. Two others bought from
a so called reliable seller in Germany directly have a ATmega328 and
a false Chip ID…ok, enough complains.

I dont like the idea of modifying the boards, despite the fact that I would
be able to do so. I think I could live with the fact, that D13 is “output only”.

“Function in parallel” means: Multiplexed or “real parallel” as in “multi core CPU”?

Best regards,
mcc

Koepel:
On this forum we have a rule of thumb that 20mA is the safe maximum value for output current of a pin. When higher currents are drawn, the output pin is no longer 5V.

'Safe maximum' is not the same as the 'maximum at which the voltage will be close to 5V'.
30mA is a good 'safe maximum', meaning that it's safe in that no damage will occur to the chip. Generally speaking, up to 25mA (total) is fine for most applications, and will still go fairly close to 5V while satisfying input requirements of whatever is being driven.

And as you say, about 20mA for the output voltage to still be close to 5V. Often, that's not absolutely necessary either. It depends on what you're connecting to. A little electronics knowledge goes a long way in that respect.
(Only an uloaded pin will go all the way to the rail. As soon as you start to load a pin, the voltage begins to drop. It's grey, not black and white.)

@mcc01, inside the ATmega328P is one processing core. Perhaps 'parallel' is not the right English word. I mean that for example for pin A4, the hardware for analog input pin, the hardware for digital output and input pin, and the hardware for SDA are all inside the chip and can be active at the same time and all be used at the same time.

Did you buy Arduino boards with ATmega328 ? That's not right. Only the ATmega328P is supported by Arduino. For advanced users it is possible to program the bootloader of the ATmega328P into the ATmega328. After that the Arduino IDE thinks it is a ATmega328P.

@OldSteve, 30ma as maximum is fine, but 20mA is finer :confused: :smiley:

Koepel:
@OldSteve, 30ma as maximum is fine, but 20mA is finer :confused: :smiley:

I can't argue with that. :smiley: