Using AD2 for high side current sense measurement

Hey everyone, I’m working on debugging my boards I’ve been posting about over the past couple months. The area I’m focused on now is the instrumentation amplifiers that are doing high-side current sense amplification–I have 10mΩ high side resistors on a 5V supply getting amplified 100x to give me 1V/A, which is easy to read by an ADC. I’m seeing a lot of noise from my ADC readings, and so I’m investigating the amplifier’s behavior.

While it’s easy to use the AD2’s scope to look at the amplifier’s output, I also want to look at the input. The 5V supply reads around 5.1V on this particular board, and the sense resistor is located on the high side. At a high level, what I think I should do is connect both scope probes to the board’s GND, and then connect one probe to each side of the sense resistor with equal length bodged-on leads. Then, in Waveforms, I can look at CH1-CH2 to see the pre-amplified signal. I’d like to use high gain mode, but I’m not sure whether it’s safe to do so–depending on how I read the AD2 reference manual, I believe one of the following is true:

  • I must use low gain mode, because the 5V supply is outside of the +/- 2.5V range and I’ll break the scope if I use high gain mode
  • I can use high gain mode, and worst-case I’ll just saturate the scope, which I’ll be able to see and adapt to
  • I can use high gain mode without a problem, because something something differential mode allows for +25/-10V, and I’m doing a differential capture

I’m hoping someone can clarify to me how best to approach scoping the high-side current sense (or that you can tell me this isn’t possible, and I should trust the amplifier & just scope its output).

The point of this exercise is to determine whether the amplifier (INA381A3, 150kHz bandwidth, 2V/us slew rate) would benefit from an RC network between Vout and the ADC. I’m measuring PWMed LED strip power consumption, and I want to filter out the PWM and just see the current consumption over a 10-100ms period.

Thanks for your advice!

Hi @dgrnbrg . You are running into a common problem. The oscilloscope errors often compound to make differential measurements using separate probes very low accuracy and noisy.

One approach is to float your target circuit so that it does not have a ground reference. For example, can you disconnect it from everything and power from an isolated transformer (like a wall-wart AC-DC power supply) or batteries? Another option is to float your scope using a USB isolator. You can then safely connect the scope ground to one side of the resistor and the probe to the other side.

With a floating scope, you can make this measurement, but you still have other errors due to isolation capacitance and noise. If you need to make this type of measurement regularly or professionally, you can consider a Joulescope - Disclaimer, I am the creator of Joulescope.

However, for the case you mentioned, it may be enough just to look at the amplifier output. You really have two options:

  1. Have your ADC operate fast enough to capture the PWM signal and filter digitally in software.
  2. Apply an analog filter (as you mentioned) and sample much slower with the ADC.

Could you post the amplifier output waveform? Also, what is your ADC sampling rate?

You will probably pick up a lot of apparent noise from the length of the ground leads and bodge wires using this method, and the math functions of most digital scopes are painfully slow for looking at noise.

In addition to the two good practical suggestions from @mliberty, if you really want to see what’s on the sense resistor you could pick up a differential probe that will allow you to look directly across it; there are always many good used ones for sale on ebay, just make sure the scope end is compatible with your scope. But as Matt says, ultimately the important thing is what’s on the output of the amplifier. While you can add a bit of filtering on the input side, TI data sheets caution that this will degrade accuracy somewhat.

Connect the gnd lead to your circuits ground, and put a differential pair across your sense resistor.

I’m a huge fan of the ad2 as a teaching tool and as an inexpensive lab tool. The differential front end is great for letting students flexibly measure things and “just works” in situations where a normal scope would require an isolator or would require you to fake a differential measurement by subtracting a pair of single ended measurements.

It falls down quickly at high frequencies, so I’d be cautious before using it on smps stuff.

I just took a look at the AD2 specs, and the AD2 really is fully differential. Ignore my advice, which applies to oscilloscopes that are earth-ground referenced. Do as @vanweric says and just connect + to one side of the resistor and - to the other.

However, be very aware of the accuracy specs: ±10mV ± 0.5% with CMMR (typical): ±0.5%. I think they mean Common Mode Rejection Ration (CMRR), which means at 5.1V you will have another 5 * 0.005 = 25 mV (typical) error.

I’m a bit confused–the probes I have for the AD2 have a proper probe tip, and an alligator clip that’s black for ground. I’ve found snippets on the internet saying that while the AD2 has a differential front end, it’s not exposed (I don’t know enough about how scopes/amps work to understand this exactly).

Are you thinking that I can use the probe + its ground clip as the differential measurement? Or the 2 probes are the differential?

Thanks, that’s a helpful point. I’ll start with capturing the output and considering a mix of analog filtering with a simple RC filter, and possibly also doing digital filtering (although the analog filtering is preferable, because I’m using the amplifier’s comparator output as a safety trigger as well).

I just took a look at my AD2 with my multimeter. The “Discovery BNC” board connects USB GND to the negative analog inputs 1- and 2-. So, you can’t use the “Discovery BNC” board for your application.
However, you can directly connect 1+ and 1- across your shunt resistor and separately connect GND to your target’s ground. I’m not sure about your AD2, but mine also came with a wire harness. You can use that if you have it or any 0.1" jumper wire.

I recommend that you twist the 1+ and 1- wires together to help minimize noise pickup.

So, I got some measurements. This first measurement is the output of the INA381A3. My bench supply is supplying around 500mA, so it’s pretty weird that I’m seeing 1V, since I’d expect to see around 500mV. The LEDs I’m driving are these, which are specced to have a 1.2kHz PWM, and I’m pushing data at 4MHz. I’m reading this scope waveform as ~1MHz, so I think that an RC filter with a cutoff at 200Hz should be fine to get something much smoother for the ADC.

This next image is from scoping the AREF/AVCC pin with a bodge wire connected to the decoupling capacitor. This is the reference for the ADC and the power supply to the MCU’s analog domain. There is a 10uF cap near the MCU, and this ferrite bead between the AREF & the rest of the 3.3V logic. The analog logic is “farthest” away from the power supply. The MCU is running at 120MHz core, using a 12MHz xtal that’s divided to 3MHz and PLLed to 120MHz.

Finally, this image is from scoping the output of the 3.3V SMPS that powers all this.

The datasheet doesn’t say what ADC tech is in the SAME51 MCUs, but it does say that I can clock it at 90-100MHz max (currently at 48 MHz), and if I’m good on impedance, my sampling period can be as little as 2 clocks (conversion is 1 clock per bit, but I think it’s held after sampling), so I’m currently sampling for 42ns and getting at most 1.8MSPS (although I’m doing way, way fewer, because I’m sending each sample out on a serial port and cycling between 4 inputs).

My two questions now are this:

  • Do I need to revise my choice of ferrite bead to reject more noise from the ADC reference? I think 100mV is a lot of low frequency ripple at ~30kHz, esp since the 3.3V smps runs at 580kHz and the LED smps runs at 960kHz. Alternatively/additionally, I could put a 1uH inductor between the output of the 3.3V smps and the digital electronics.
  • What could I be doing to get 2x the voltage as expected from the amplifier? I confirmed the package marking corresponds to the A3 flavor, which is 100x gain. And I am using 0.5% 0.010Ω sense resistors.

Hi @dgrnbrg - Thanks for the plots. That helps.

If you are expecting PWM at 1.2 kHz, I don’t think that you are capturing it, unless the LED is configured for full-on. You want to see the PWM’s alternating durations of off and full-on. Could you try setting the time base to 1 ms/div? You can also reduce the trigger level to 100 mV or so. If it is PWM’ing, then that could explain the current difference between the bench supply and your measurement.