Why an input pin reports HIGH even if voltage is less than 2,5?

j

Why does it still reports HIGH?

Because you don't understand Ohm's Law?

Which is greater, the resistance to 5v or the resistance to GND?

If you have nothing connecting it to GND then the resistance to GND is infinite. I think you'll find that 3K is considerably less than infinity.

gilperon:
Thank you for helping, I am not smart as you that's why my question looks silly. Look, the voltagem drops as it goes through the wire, doesnt? So the voltagem at the input pin should be much less than 5V isnt?

Drops to what?

The resistance of that input pin, through the chip, to ground is pretty huge. Probably many megohms.

What you are trying to make is a [u]Voltage Divider[/u].

You can derive it from Ohm's Law, but actually it's [u]Kirchoff's Law[/u] that describes how voltages and currents divide in series & parallel circuits.

Why an input pin reports HIGH even if voltage is less than 2,5?

You didn't measure that voltage with a multimeter, did you? :wink:

It might surprise you that 2.5V is NOT the "dividing line" between high and low...

If you look at the ATmega datasheet (Table 29.1) it shows that the maximum for input-low is 0.3 x Vcc. So if you are operating at 5V, anything less than 1.5V is guaranteed to read low.

The minimum for an input-high s 0.6 x Vcc. So anything greater than 3V is guaranteed to read high.

That tells you that 2.5V is undefined! It might read high or low!

The datasheet also tells you that an output-low is always 1V or less, and an output-high is always at least 4.1V.

The output tolerances are "more strict" than the input tolerances. That's done to be darn-sure that an output-high connected to an input is always read as high, and an output-low connected to an input is always read as low.

gilperon:
Sorry for not being clear. I want to know this: the voltage drops across resistor, isnt? If I kept adding resitors and more resistor at the very end I would have a huge drop of voltave isnt? And also the current would decrease (this I understand) but what I dont understand is this: if the voltage drops when it goes from 5V, passing to resistor to the input pin so at the end, my input pin would read 0v isnt? But why in this case my input pin is still reading HIGH?

The voltage drop is relative to the resistance AND the current. current flowing through 3K in series with MEGOHMS (because that's what the input pin is going to have to GND) will be miniscule.

Miniscule current through 3K gives miniscule voltage drop.

I don't usually say this, but is there a section on the forum in a language you are more familiar with? You might ask your question there.

It's like this... Voltage drop = current X resistance.

You are driving very little current into the Arduino.

Another way to look at it is this: You have your 1K + 2K + the input resistance of the Arduino. You have 5 volts across it. Given that the input resistance is like 100 M. (that is 100 million Ohms.)

Against that the 3K you have is well, less than 1%. So you will have more than 4.999 V at the input pin.

Is that now clear?

If you had it like this:
5V->1k-(input)->2K->GND then you would have 2/3 of 5V at the input which would count as high still. (For a digital input)

Yes, do the math:
Vout = Vin * R2/(R1 + R2) = 5V * 2000/(1000 + 2000) = 3.333V.
The input only requires 1uA of current to make it change, so effectively a 1MegOhm in parallel with the 2K resistor. 1M + 2K in parallel results has an effective resistance of (1,000,000 * 2,000)/(1000000 + 2000) = 1.996K. Stick that into the original equation:
5V * 1996/(1000+1996) = 3.331V. Still a digital high.

CMOS inputs at room temperature are more like 10^10 ohms, effectively infinite,
since a MOSFET gate is an insulating layer.

Logic gates in general are designed to expect either a voltage above their input
threshold for HIGH, or below their input threshold for LOW, or switching extremely
rapidly across the gap (sub-microsecond perhaps). Failure to transition rapidly can
have various side-effects, from increased power consumption to complete circuit
malfunctioning - it can cause the gates to behave as (possibly unstable) analog
voltage amplifiers.

Sometimes inputs have hysteresis circuitry added so that the input doesn't have to
transition rapidly - and some microcontrollers like the Atmega series have this - the
voltage at which the input is deemed to go from LOW->HIGH is higher than that
deemed to be HIGH->LOW. Schmitt-trigger is the name given to an input
circuit with large amounts of hysteresis, and these are very useful for connecting
to noisy signals which are not "well-conditioned" for standard logic gate inputs.

gilperon:
Nice nice nice! I got it finally! Your calculations are very clear: the resistor inside input pin is very high compared to the resistors in my circuit. So it's clear that the voltage drop inside the input pin will be very close to the 5V.

It's nice to know smart people that use numbers to explain things! :slight_smile: Indeed, the high resistor inside the input pin guarantees that the voltage drop around it will be ~5v. Thank you so much!

Hoorah, at last! It seems your internal resistance to missunderstanding is very low, but consider us your pullup resistor. :wink: