I am at a very beginner level and use an Arduino Uno.
My question is about ground and results out of my limited knowledge of electricity.
My situation:
I would like to measure voltage of an external bus. (Later in the project I would like to decode voltage shortages for a specific protocol.)
The voltage measurement is working. But I have a question about it.
The external bus has two lines "A" and "B", "A" is 24V-DC, "B" is ground.
To measure it, "A" goes through a voltage divider, I use a 10M_Ohm and a 1M_Ohm resistor.
I measure (using analog PIN A0) at the intersection of the two resistors a voltage of 2.18V
(24 * R2 / (R1 + R2)). I use these two specific resistors to reach voltage level around 2-3V.
So far so good.
To the question:
To get the 2.18V (=analogRead/1023*5) input, I had to connect the end of the second transistor to ground of the arduino and to "B" (ground of the bus).
My question is why are both needed? Why isn't it enough to connect to arduino's ground?
Or why is it not enough to connect to "B" (ground of the bus).
Thank you.
"A" ----> 10M_Ohm ----> 1M_Ohm ----> Ground (Arduino)
| |
|-----> A0 |----> "B" (Ground of bus)
You need a common ground (or reference). The Arduino always measures relative to its ground.
...Voltage doesn't have any meaning without a reference. Birds can safely sit on a high-voltage transmission wire, and you could safely hang from the wire as long as you don't touch ground.
When you connect a multimeter you need both probes. The black probe is the ground or "reference". The meter may have an internal ground but it's isolated from the outside world so the black reference doesn't have to be ground, but it has to be connected to part of the circuit and you can read the voltage difference between two points. You can't connect one probe to one battery and the other probe to another battery unless they are connected somehow.
Your 10:1 resistor divider is on the to high impedance side, the Arduino works great with an input impedance of 10K or less. Using 10K:2K would give you much more voltage to work with and be more stable. If the voltage goes above 24V either raise the top resistor's value or lower the Bottom resistors value. This should save your calculator: Voltage Divider Calculator
When you connect a voltmeter to measure voltage across a resistor (say R1), be it a regular multimeter or an ADC such as the analog ports in the Arduino, it is like connecting a resistor (say R2) in parallel with R1. This may deviate the reading if R2 is in the same order of magnitude as R1. Look for voltmeter impedance to learn more about the subject.
To prevent this, I would recommend using lower resistors in your voltage divider, in the order of 10k
10M/1M may be too high and produce biased readings and is also prone to EMF interference because of the small currents (~2 micro Amps) circulating through them.
If you use 10K/1K you will draw about 2mA from your external bus, which should be immune to EMF (this depends on the electric environment). You must assess if pulling this current from your external bus is Ok.
If you go too low on the resistors you could be placing too big a load on that bus, and you will have to consider the power dissipation capabilities of your resistors. Discussing power dissipation is for another day.
And as @DVDdoug pointed out, when we say “voltage” we really mean “voltage difference” (or electric potential difference, (between 2 points) so you need a common reference that serves as “0V” or “GND”
The potential divider can be analysed like this:
V2 = i1 R2
if the circuit is not closed no current can flow, i1 = 0 so V2 = 0.
For the circuit to work as intended the input loop needs to be closed in some way.
Provided the input and output circuits are isolated the easy way to do this is to connect the less positive end of the input to the arduino ground.