How can I measure an isolated voltage with an AVR

Go To Last Post
21 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I want to measure an isolated voltage (by isolated I mean the ground of the circuit I want to measure is not connected to the micro ground), just like a voltmeter does (like a cross a resistor of an external circuit). What would be the best way to do this?

I thought about connecting and ADC pin to one node and the AREF to the other. Would this work, or does AREF have to be connected to GND? How do voltmeters do it?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sounds like you want to use the differential mode (TWO A/D channels) to measure the difference between the two points.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If I'm understanding what your proposing correctly:

Doing that would require a reference to the absolute ground point of the individual voltages (on the external circuit). I don't want to measure it like that, I want to be able to measure the voltage with no ground reference, just like a voltmeter does.

Oh and I didn't mean AREF, I meant AGND.

Last Edited: Fri. Oct 21, 2011 - 07:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The A/D must reference against the processor ground. Voltmeters are either battery powered or if mains powered are isolated from the mains. The voltmeter chassis is insulated from ground. You will have to "float" your measurement circuit to do what you want. The differential mode takes two readings against a ground reference (which can be floating), often done with 'scopes to see certain waveforms.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So it is possible to take a reading of the external voltage with respect to the AVRs ground?? (With no connection between the external circuit's ground and the AVR's)

(I know with differential I will take two but I am just asking about the possibility of measuring a floating voltage with the AVR I guess)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ltkenbo wrote:
So it is possible to take a reading of the external voltage with respect to the AVRs ground?? (With no connection between the external circuit's ground and the AVR's)

(I know with differential I will take two but I am just asking about the possibility of measuring a floating voltage with the AVR I guess)

No, by floating your measurement device, I meant IT'S ground cannot be "earthed".

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm still kind of confused. When I said the AVRs ground, I was meaning one that is not common with the circuit I am measuring. What does a ground connection to the earth have to do with it as long as both are not connected to that same ground? Are you saying the other one needs to be literally "earthed" as it provides an absolute 0 volt point of reference?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Are you saying the other one needs to be literally "earthed" as it provides an absolute 0 volt point of reference?

What other datum were you planning to measure against then?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The A/D measures voltage between the analog ground pin and A/D input pin(s) of the processor. The analog ground pin is also the dc power negative return. To measure anything that does NOT have one side of the measurement at earth potential your measurement device (the AVR) must be "floating" above earth ground. If this isolation breaks down you will have minor destruction taking place. It also means NOTHING in the circuit can be touched by human hands (as the human body is usually near ground potential, unless you are wearing glass slippers.)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Quote:

Are you saying the other one needs to be literally "earthed" as it provides an absolute 0 volt point of reference?

What other datum were you planning to measure against then?

Well my voltmeter measures a battery voltage quite nicely and neither of them are literally grounded.

kscharf wrote:
To measure anything that does NOT have one side of the measurement at earth potential your measurement device (the AVR) must be "floating" above earth ground.

I think I understand now. I thought you guys were telling me before though that the device that I am measuring must be earth grounded.

What is the particular reason it has to be floating? Is it because it if wasn't it could potentially (no pun intended) be lower than the voltage it is measuring?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
What is the particular reason it has to be floating? Is it because it if wasn't it could potentially (no pun intended) be lower than the voltage it is measuring?
Because the device being measured could be at some potential above or below earth ground. If the measurement device ISN'T floating there WILL be a ground loop!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok I understand now. So long story short to be sure I am clear, I need to isolate the power supply of my micro, then I can use 2 different ADC pins to take a measurement of each node of the device and then subtract the two and get my voltage?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ltkenbo wrote:
.... is not connected to the micro ground), just like a voltmeter does....
Think of the AVR ADC as if it was the volt meter you mentioned. In fact your example voltmeter could even be an actual AVR micro ADC using its own dedicated battery with no connection to earth ground or your example micro ground, to power the volt meter.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i might be off in the tall weeds here, but are you looking for isolation? where you device under test is isolated form the avr electronics?

link

i am a NOOO00B!!

Don’t let that undermine what I just said.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One crude way to do it would be to use an electromechanical DPDT relay to connect a flying capacitor first across the external voltage to be measured, or then to the AVR's A/D sensing network.
Kind of power-consumptive, tho....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At what voltage is the source, volts, kVolts, etc?

What is the output of the voltage measurement? LCD, RS-232, RF link?

IIRC the AVR differential ADC's aren't "true" differential voltmeters. As mentioned above,they are both still referenced to the AVR's ground.

If you really want to measure the voltage on your isloated source, one option is to use a micro with an ADC, tie ground of the micro to one measurement node, the ADC input to the other measurement node.

Take your reading, and then couple the output to the "real world" via a digital link through an optoisolator or an RF link.

The input from the isolated source still has to meet the micro's Vin requirements, (for AVR's this means not negative voltages, and Vin < V+, i.e. < 5V input if running on a 5 V supply).

If the input signal is an AC signal then the input has to be Low Pass filtered to meet Nyquist-Shannon requirments, but I don't think that is what you are currently asking about.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are commercial sensors , like the ACS series for isolated current measurements :
http://www.allegromicro.com/en/P... Those are meant for larger currents, though and not the cheapest ones. You can also whip one up on your own with an magnetic sensor , like the NXP KMZ series. Those need a differential amplifier for matching the ADC of the MCU, or you rely on the newer ADCs with diff. inputs and gain , like the Tiny25/45/85.
In what range do you expect the currents to be ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ltkenbo wrote:
So it is possible to take a reading of the external voltage with respect to the AVRs ground?? (With no connection between the external circuit's ground and the AVR's)

No. Think of it this way. Suppose the isolated device you want to measure is a battery. To measure the voltage of that battery, there must be a path through which current can flow out one end of the battery, through the measurement device, and back into the other end of the battery. That means both ends of your battery must be connected to your measurement device in such a way as to make that possible. It doesn't matter if you call one end or the other gnd or not, or if that gnd is also connected to earth.

Greg

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ltkenbo wrote:
I want to measure an isolated voltage (by isolated I mean the ground of the circuit I want to measure is not connected to the micro ground), just like a voltmeter does (like a cross a resistor of an external circuit). What would be the best way to do this?

I thought about connecting and ADC pin to one node and the AREF to the other. Would this work, or does AREF have to be connected to GND? How do voltmeters do it?

I would probably go the simple path; a voltage to frequency converter (such as LM331 or AD537) driving an opto coupler and measure the frequency and convert back to a voltage reading at your AVR.

Cheers,

Ross

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi guys,

assuming a 5 volts source, what's wrong with bitbanging a diode into the circuit.

Then using the diodes cathode and anode side as reference voltages.

Can some one with more experience tell me if it'll work?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow lots of ideas, I'll have to give all of them some thought.