Hi guys,
i'm new to Arduino and i have a simple problem that is driving me crazy.
I'd like to understand how to calculate how much the tension on an analogic input will change after using a resistor.
For example if i have a simple circuit with the 5 volts given by Arduino and the current goes through a 220ohm resistor and then goes to the analogic input what will the tension on this be like?
But why the input receives all the 5 volts? Shouldn't the resistor lower them? And why there is 0v across the resistor if the output is 5 volts?
I think i'am misunderstanding some foundamental concepts here
If you know [u]Ohm's Law[/u] (which describes the relationship between voltage, resistance, and current) and if you understand that the same current is flowing through both series resistors, then you can understand how a voltage divider works.
A voltage divider only works with high impedance (low current) circuits. i.e. You can't use a voltage divider to power a 5V chip from a car battery.
And why there is 0v across the resistor if the output is 5 volts?
If we're talking about a series resistor, there is NOT 5V "across" the resistor. Since (almost) no current is flowing, there is (almost) no voltage across the resistor. (Ohm's Law is a law of nature and it's always true.)
There is voltage across the Arduino input, but it has (almost) infinite resistance so no current flows. You know... The AC power is present at your power outlet when nothing is plugged-in and no current is flowing (infinite resistance).
Let's try a thought experiment. Assume you have a 5V battery with two resistors connected in series, forming a complete circuit. One resistor is 1k and the other is 10k. The total series resistance is 11k. The 1k resistor has 1/11 of the voltage across it (0.45V) and the 10k resistor has 10/11 of the voltage across it (4.55V).
Let's try a similar experiment. Assume the two resistors are 220 ohm and 100 million (100,000,000) ohm. The total series resistance is 100,000,220. The 220 ohm resistor has 220/100000220 of the voltage across it (0.00001V) and the other has 4.99999V across it. In this case, the much larger resistor is the analog input of the Arduino. Thus the small 220 ohm resistor has effectively 0V across it while the ADC effectively sees 5V.
Ok so essentially the voltage "splits" up between the resistors right? But in the first case shouldn't we consider also the resistence of the Analog Input or of the Ground? (Or ground is considered to have 0 resistence?).
DragoSupremo:
But if the voltage across the resistor is 0v how can the input see the full 5v?
Hi,
If you try to have an insight of what happens, the best analogy -for this particular case- is to think of voltage in terms of water pressure and current in terms of water flow.
You have an horizontal pipe with, say, 4 bar of pressure at the beginning -a quite normal situation in a home installation-; if you measure the pressure both at the begininning and the end of the pipe they will be equal if you have no water flow -the situation with the analog input; it "sinks" no water. If you draw some water, the pressure will drop; the longer the pipe -the resistance- the bigger the pressure -voltage- drop. The bigger the water flow -the current- the bigger the pressure -voltage- drop.
(Analogy to be used carefully, on the other hand).
Regards.
Hi,
As long as there's no water flow the pressure is the same along the -horizontal- pipe, whatever it is its diameter (and length).
The analogy is that if there's no current there is no voltage drop (in this case even if the resistor is not horizontal ;D )
Regards
Ok after many trials i think i'm starting to understand how it works So actually no current is flowing between the 5v Output and the Analog Input (due also to its hight Resistence), so the GND and Analog Input are completely different and are not the same thing as i thought, right? If instead i connected the resistence to the GND current would start to flow (because of its negative charge) but voltage would still be the same. So the only reason to put a resistor this way is to reduce the Amperage. Could this have sense or i am completely wrong?
DragoSupremo:
Ok after many trials i think i'm starting to understand how it works So actually no current is flowing between the 5v Output and the Analog Input (due also to its hight Resistence), so the GND and Analog Input are completely different and are not the same thing as i thought, right? If instead i connected the resistence to the GND current would start to flow (because of its negative charge) but voltage would still be the same. So the only reason to put a resistor this way is to reduce the Amperage. Could this have sense or i am completely wrong?
Yes ...
If the hydraulic simil makes sense for you, think on the analog input as the pressure meter itself on the other end of the pipe: it does not sink any water, so the pressure it measures is the same as in the pipe beginning.
Connecting the resistor to ground is like leaving the other end of the pipe open: the longer and narrower the pipe -more resistance- less water -current- will flow through it (an infinite pipe is like an infinite valued resistor: any water -current- will flow through it).
Regards
The resistor in the path in between the voltage source and the analog input is just to prevent spurious currents (mainly due to "noise": electromagnetic interference most of the times) flowing into the arduino: in fact you can connect them directly and it will work (without major problems in a "quiet" environment -home).
(By this time, maybe you are wondering how a current may flow into the arduino if it behaves as a closed pipe ... well as I told you before the hydraulic simil is to be used with caution).
DragoSupremo:
Ok after many trials i think i'm starting to understand how it works So actually no current is flowing between the 5v Output and the Analog Input (due also to its hight Resistence), so the GND and Analog Input are completely different and are not the same thing as i thought, right? If instead i connected the resistence to the GND current would start to flow (because of its negative charge) but voltage would still be the same. So the only reason to put a resistor this way is to reduce the Amperage. Could this have sense or i am completely wrong?
Yes, I think you are getting it now
Many beginners are confused by CMOS inputs being isolated (infinite resistance, to a first
approximation). The way MOS transistors work is by an electric field across a thin layer
of silicon dioxide - which is an insulator. Expect input resistances at room temperature of 10^10
ohms or so for a CMOS input pin. 10 thousand million ohms. That's outside the range of multimeters to
measure.
And the other aspect that can cause confusion are the protection diodes on the inputs - these are there
to prevent static electricity in everyday objects from destroying the chip. They prevent input and output
pins from straying more than about 0.5V outside the supply voltage range. Which is why you must not
connect live voltages to a chip when it is not powered up, since they will burn out the protection diodes
and or power up the chip mysteriously.
Now i have also tried to connect to GND the circuit, but if i measure the Tension after the resistor the input surprisingly reads 0V! Why this? Does this mean that 0V means that all the current is going to the Input (and not the contrary as i thought)?
DragoSupremo:
Ok many thanks i think i'm getting it now.
Now i have also tried to connect to GND the circuit, but if i measure the Tension after the resistor the input surprisingly reads 0V! Why this? Does this mean that 0V means that all the current is going to the Input (and not the contrary as i thought)?
Hi,
I'm afraid you mix current and voltage: If you connect the other end of the resistor to ground you are actually inputting 0V to the arduino. What the arduino measures is the voltage at its analog input, whatever the currents messing around ...
Regards.