Biasing arduino ground with a higher potential

BobTPH

Joined Jun 5, 2013
9,342
What is power supply V1? There are no 5V batteries that I know of. If it is the same USB source powering your Arduino, the grounds are already connected, and you cannot connect another part of the circuit to ground.
 

k1ng 1337

Joined Sep 11, 2020
1,038
Sorry for the late response....here is my full circuit:
View attachment 310776
This circuit doesn't make sense. "analog0" won't provide an accurate output because "gnd" is set to 3.7V (Node B in my image) with the voltage divider when it should be set to 0V (Node C). Not only is the proper 0V ground potential shifted up 3.7V, R1 & R2 will limit current through the 'gnd' connection which will cause other problems unless the current draw is very low. It is not at all clear why you have things connected this way.

If 'vcc' is say 5V, the total voltage seen by the microcontroller across its input terminals is 5V - 3.7V = 1.3V which is not enough to operate the microcontroller in its safe region. This alone will affect the internal workings of the microcontroller and if you manage to get it working, you'll have to compensate the ADC for the new voltage paradigm. In other words, you are messing with something that isn't broken.

Connect 'analog0' to Node B and 'gnd' to Node C for proper operation. Don't try to bias the ADC differently until you understand this basic operation. If you want greater precision, use the "analogReference(INTERNAL);" to tell the microcontroller to use the internal bandgap reference then scale appropriately. Be careful because it's fairly easy to fry an ADC.

Untitled.png
 

BobTPH

Joined Jun 5, 2013
9,342
This circuit doesn't make sense. "analog0" won't provide an accurate output because "gnd" is set to 3.7V
Nonsense. If the two circuits are indeed isolated except for the two wires shown, the ADC will read the voltage across R1. The fact that it does not indicates to me that the two grounds are actually the same, i.e. not isolated.
 

k1ng 1337

Joined Sep 11, 2020
1,038
Nonsense. If the two circuits are indeed isolated except for the two wires shown, the ADC will read the voltage across R1. The fact that it does not indicates to me that the two grounds are actually the same, i.e. not isolated.
My response is based on conjecture because we don't know what else is connected. The only assumption I made was VCC being 5V.

If he has the USB power connected, obviously the grounds are connected but I don't think he understands that. Even in that case, how does the MCU reconcile one of its ground connections being at 3.7V? If I'm not mistaken, current will be injected at this point.
 

BobTPH

Joined Jun 5, 2013
9,342
My response is based on conjecture because we don't know what else is connected. The only assumption I made was VCC being 5V.

If he has the USB power connected, obviously the grounds are connected but I don't think he understands that. Even in that case, how does the MCU reconcile one of its ground connections being at 3.7V? If I'm not mistaken, current will be injected at this point.
You are mistaken if they are otherwise isolated. You keep trying to measure the Arduino ground with respect to the sensor ground. That measurement has no effect on the Arduino ADC, which only knows about the Arduino ground. You might as well say the sensor ground is -3.7V, so the sensor does not work. When specifying a voltage you must give two points.
 

k1ng 1337

Joined Sep 11, 2020
1,038
You are mistaken if they are otherwise isolated. You keep trying to measure the Arduino ground with respect to the sensor ground. That measurement has no effect on the Arduino ADC, which only knows about the Arduino ground. You might as well say the sensor ground is -3.7V, so the sensor does not work. When specifying a voltage you must give two points.
I made an algebraic mistake with 3.7V which I see now so I have to think about this more.

In any case, no ground symbol is in his schematic so we also can't declare any point as 0V, at least in my mind.

Looking at the voltage loops formed as the schematic explicitly indicates, it doesn't make sense to me but of course this doesn't mean it isn't a practical circuit.
 

djsfantasi

Joined Apr 11, 2010
9,189
Connecting grounds at same potential works, but it is only when they are not common readings get bizzare, does the adc require arduino ground to be at 0 volts?
It requires that the signal being measured by the ADC is referenced to the same ground as the Arduino.

Voltages are always measured between two points. So it doesn’t make sense to say “require arduino ground to be at 0 volts”. With reference to what other point?

The points labeled “ground” on your sensor and the Arduino must be connected.
 

djsfantasi

Joined Apr 11, 2010
9,189
No, in fact it is quite the opposite.

He when he wants to measure across R1.

As long as the two grounds are NOT connected together it will work.
Hence why I said “ground” in quotation marks. He can connect the grounds together and algebraicly calculate the voltage across R1 by measuring the voltage at point B with the Arduino ADC.

I am sure that the internal ADC on the Arduino can only measure voltages relative to its ground. So, with an Arduino, you cannot isolate R1.

Given that V+ is 5V, if you connect point B to the Arduino ADC pin and point C to y try he Arduino ground, the voltage actoss R1 is equal to
(5-V[R2])
Where V[R2] is the voltage calculated from the value returned from the analogRead() command.
 

Thread Starter

darkc0der

Joined Dec 20, 2023
14
My problem is solved....thnx everyone. I was basically pulling power from the same source that is the connector....the schematic is wrong;there is actually no batteries:/....and the bottom resistor was getting shorted out resulting in wrong readings.. Why i couldnt figure this out i still don't know, this is peak stupidity on my part...sorry.
 
Last edited:

k1ng 1337

Joined Sep 11, 2020
1,038
I gave you that diagnosis in post #11. Too bad other posters kept giving misinformation and confused you.
I'm always disappointed when I see a seasoned member say something like this.

You post a lot of confusing stuff yourself and you rarely provide a proof. I don't think you are in a position to have this attitude.
 

nsaspook

Joined Aug 27, 2009
13,636
I'm always disappointed when I see a seasoned member say something like this.

You post a lot of confusing stuff yourself and you rarely provide a proof. I don't think you are in a position to have this attitude.
Sorry but he's 100% right here. It's not ESP to know the root problem is isolation of power, it's called experience.
 

k1ng 1337

Joined Sep 11, 2020
1,038
Sorry but he's 100% right here. It's not ESP to know the root problem is isolation of power, it's called experience.
Experience is one thing and attitude is another. I make legitimate efforts to solve all the problems I encounter here. If they are found to be invalid then it's incumbent on you the experienced scientific reader to set things right. The wrong attitude is to make facile comments when nobody really knows what went wrong in this particular case.
 

nsaspook

Joined Aug 27, 2009
13,636
Experience is one thing and attitude is another. I make legitimate efforts to solve all the problems I encounter here. If they are found to be invalid then it's incumbent on you the experienced scientific reader to set things right. The wrong attitude is to make facile comments when nobody really knows what went wrong in this particular case.
Your input is and was welcome here but it seems the OP wasn't getting the point.

Attitude? B. A. is personal assessment.
1703530767195.png

Most us had a pretty good idea of what was wrong from the first incomplete circuit diagram posting of the OP. Sometimes a little Kick is needed to make a lasting impression.
 

BobTPH

Joined Jun 5, 2013
9,342
Experience is one thing and attitude is another.
Go read my post #11. I asked for a simple piece information that would suggest the answer. But the TS was too busy receiving incorrect information. I asked this because people learn best when they see the solution themselves.

I then gave the answer explicitly in post #22.

The forum is not about proving anything, it is about helping others succeed.
 

k1ng 1337

Joined Sep 11, 2020
1,038
Go read my post #11. I asked for a simple piece information that would suggest the answer. But the TS was too busy receiving incorrect information. I asked this because people learn best when they see the solution themselves.

I then gave the answer explicitly in post #22.

The forum is not about proving anything, it is about helping others succeed.
Alright but you are missing the point. You may have done all the calculations and all the work but I have not. I demand proof of all I accept as truth and in the scope of a forum where literally anyone can voice their opinion, you don't provide this kind of information nearly as much as some people do. You then end with a comment how it's damn shame some of us tried to help. Do I really need to explain how this is damaging to the student or serious hobbyist?
 
Top