Jump to content
  • 0

Scope: measuring differential voltage (to measure AC current)


poll

Question

Hi!

I would like to measure the current in an AC signal using an AD2.

To do this, I have a set of shunt resistors that I could use with different values. The plan was to:

  1. Connect each channel of the AD2 scope on each side of the shunt resistor.
  2. Put it in the circuit I want to measure.
  3. Calculate the voltage difference in each sample and then calculate the AC current.

The first super-basic test I am doing is connecting the DC power supply providing always a fixed value (e.g., 1V) to each channel with no shunt resistor: just two wires directly from the power supply to each channel. The difference should be zero (or very close). When measuring the difference, however, I get up to 10mV of difference (mean=~4.4mV; median=~4.3mV), which would not allow me to measure the current in the milliamps range that I want (and impossible in the microamps that I would love to support).

With this resolution, I cannot proceed to the next steps (adding the shunt resistor and later on using an AC signal).

Is there any way in the API to get only the difference between both signals directly (e.g., without comparing with GND), or running measurements (RMS of the difference) at the AD2 directly, or any other way to obtain higher precision of the difference between both signals?

Just in case I did something wrong in the code:

scope.open(self.device_data, sampling_frequency=12500000.0, record_length=25000.0, buffer_size=500)

scope.trigger(self.device_data, channel=0, enable=True, timeout=1.0, edge_rising=True, level=0.0, source=scope.trigger_source.analog)

scope.channel(self.device_data, enable=True, channel=0, amplitude_range=8.0, offset=0.0, attenuation=1.0)
scope.channel(self.device_data, enable=True, channel=1, amplitude_range=8.0, offset=0.0, attenuation=1.0)
     
# set up the instrument
dwf.FDwfAnalogInConfigure(device_data.handle, ctypes.c_bool(False), ctypes.c_bool(True))

# read data to an internal buffer
while True:
    status = ctypes.c_byte()    # variable to store buffer status
    dwf.FDwfAnalogInStatus(device_data.handle, ctypes.c_bool(True), ctypes.byref(status))

    # check internal buffer status
    if status.value == scope.constants.DwfStateDone.value:
        # exit loop when ready
        break
    
# copy buffer
buffer_ch1 = (ctypes.c_double * scope.data.buffer_size)()   # create an empty buffer
buffer_ch2 = (ctypes.c_double * scope.data.buffer_size)()   # create an empty buffer
dwf.FDwfAnalogInStatusData(device_data.handle, ctypes.c_int(0), buffer_ch1, ctypes.c_int(scope.data.buffer_size))
dwf.FDwfAnalogInStatusData(device_data.handle, ctypes.c_int(1), buffer_ch2, ctypes.c_int(scope.data.buffer_size))


Where scope.channel is:

def channel(device_data, enable, channel, amplitude_range, offset, attenuation):
    dwf.FDwfAnalogInChannelEnableSet(device_data.handle, ctypes.c_int(channel), ctypes.c_bool(True))
    dwf.FDwfAnalogInChannelRangeSet(device_data.handle, ctypes.c_int(channel), ctypes.c_double(amplitude_range))
    dwf.FDwfAnalogInChannelOffsetSet(device_data.handle, ctypes.c_int(channel), ctypes.c_double(offset))
    dwf.FDwfAnalogInChannelAttenuationSet(device_data.handle, ctypes.c_int(channel), ctypes.c_double(attenuation))


Thank you very much in advance!
 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi @poll

The AD2 Scope inputs are differential, so with one channel it can measure the voltage drop on shunt resistor.
The input is not floating so at low range (high gain) it has the following common mode limitations:
https://digilent.com/reference/test-and-measurement/analog-discovery-2/hardware-design-guide#scope_signal_scaling

If you are only interested in AC, you could also use a capacitor to have AC coupling.

For more precise measurement a offset compensation should be perform, a reference reading with zero input that you will substract from the following measurement.
To eliminate the temperature drifts make sure the device is at normal operational temperature, have software connection with it for at least 15minutes prior starting the measurements.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...