Basic Understanding of Digital Output Pins using Ohm's law

Hi,

I would greatly appreciate any help. I believe I am understanding how the arduino output pins work incorrectly. I have written code that produces a high digital output to pin 3 for a couple of seconds and then it runs through a resistor and then back to ground. For some reason, no matter what the resistance of the resistor is, the resistance calculated via a multimeter is 50 Ohms, the voltage is 5 V(which I expected), and the current is 100mA. If I put a 10 kOhm resistor, the current still stays the same. Doesn't this violate Ohm's law? The circuit is simply going from digital output 3 to a resistor, to ground. The current through the resistor should be given via ohm's law. No? For some reason it isn't and I don't understand why. Any help would be very appreciated!

I am using the UNO rev3 by the way.

so please show the code.
Do not forget to use a code tags, inserting the code to the message.

Do you measure the resistance when the current flows via resistor?
Please show your connection diagram with DMM

1 Like

The High pin output will always be +5V. If you put a 50 Ohm resistor, it should have a current of 100mA.

But the UNO's digital pins support a maximum of 40 mA.

So if you try to drain more than 40 mA, you could damage the pin.

How are you measuring the current?

PS:
See this informative image about the current that the pins can supply.

My code is really simply, it's just

void setup()
{
  pinMode(3, OUTPUT);
}

void loop()
{
  digitalWrite(3, HIGH);
  delay(1000); // Wait for 1000 millisecond(s)
  digitalWrite(3, LOW);
  delay(1000); // Wait for 1000 millisecond(s)
}


I'm not sure if the photo is going to show up, but I'm simply attaching the multimeter to each side of the resistor.

What do you mean by "calculated"? The multimeter cannot measure resistance in an active circuit.

I'm simply attaching the multimeter to each side of the resistor

What measurement type and range setting did you set?

The issue is that the resistor isn't actually 50 Ohms, but the reading suggests that it is, which makes no sense to me. I understand that the voltage source has some load resistance, but couldn't we just calculate the equivalent resistance by adding them up. Thus, changing the resistance of the resistor should change the current passed. However, this isn't what is being shown.

STOP testing immediatly, you will destroy the UNO with the current meter connect that way.

< edit >
A current meter should be wired in series with the resistor, not in parallel. The way you have it connected, you could completely remove the resistor and still measure the same current. Essentially you are directly shorting pin 3 to ground, with only the internal resistance of the meter (which is very low) and the internal resistance of the output pin of the atmega328 limiting the current. If you are very, very lucky the atmega328 may still work, but I suspect pin 3 is damaged.

2 Likes

If you have a current meter connected between an output pin and ground, then it acts essentially as a short circuit, which can destroy the output pin, and even the processor.

The current is limited by the output impedance of the pin, until the pin electronics burn out.

Ok, thank god I asked before actually doing this on the real arduino. Thank you so much!

In other words, a real Arduino?

Yeah, I have it, but was running my code on the simulator beforehand.

The OP might get lucky, the cheep meters use a relative high resistor value in series with the load and measure the drop across that to determine current. I suggest the OP view a few basic electronics tutorials and maybe get a book or two on that as well.

Thanks man :smiling_face_with_three_hearts:

1 Like

How was it calculating a resistance of 50 Ohms and a current of 100 mA if it was a short circuit? Do some multimeters have an internal resistance and others will break my arduino?

Why would you believe what a simulation reports?

Always take those things with a large dose of salt -- they are not "real life".

Yeah, true true.

In fact, the impedance of an ATmega328 output pin is around 40 Ohms, so your interpretation of the simulation result is not so far off. But I doubt any Arduino forum member knows what assumptions are built into a simulator.

However, if you set the output high on a real Arduino, and connect it to ground, that WILL burn out the pin.

Ohms law has not been violated. How are you measuring the resistance? If you are using an ohmmeter into the resistor and output of the UNO then you have to consider you have two items in parallel.
BTW your best not to draw more than a couple of milliamps from a digital output. The spec allows you more but its best to leave a lot of design margin.

current meter??
ammeter
it's ammeter

A current metrr has a small resistor inside. Depending on the range you choose (or autorange), the retsitance may be small or larger.
The meter then measures the voltage over this resistor. That value is used to calculate the current through that resistor (which is equal to the current through your circuit).
Measuring current may quite easily damage your stuff or your meter (as it has near zero resistance, currents may get quite high).
In the high amp range, the resistor may be 0.1 ohm, in micro amp range, the resistance may be 1 kOhm or more. All depending on the quality of your meter.