# Differential Input to ADC Depends on Mac vs Windows Laptop USB Power (ADS1115)

## The Problem

I have a vacuum gauge that I would like to read and report the values from. The gauge expects a 9-30VDC input power, and has pinouts for Analog+ and Analog- with a 0-10V range.

I'm currently using an ESP32C3 Dev board, and an ADS1115 to read the analog voltage with the following circuit (ESP32C3 omitted for clarity):

The +5V and GND of the ADS1115 are connected to the ESP32C3 directly, and I'm reading the ADC in differential mode.

### The Plot Thickens

The weird part is this: When I power the ESP32C3 from my laptop (a Lenovo machine running windows) everything works perfectly fine. I get the expected voltage values, and the conversion works perfectly. When I power the ESP32C3 from my collaborator's laptop, the ADC reads between 0.5 -> 1V less than expected. I measured the voltage between the +5V and GND pins with my laptop (PC) connected and got ~ +4.7V. With the Mac connected, I measured ~+4.9V.

### My big questions are these:

• Why is this happening? Is it a difference in internal voltage reference between the two computers?
• What can I do to mitigate this issue?
• Could this be related to current-limiting/power-saving features on the USB ports?
• The schematic shows 3 different grounds. Are all three connected or are they actually separate? Does the result you see on your laptop depend on if it is run from battery vs. AC power? Commented Mar 3, 2023 at 2:48
• At least 2 of the grounds are separate. The ground for the +24V is connected to a Meanwell PSU which is connected to mains power. The analog ground in the middle is floating as far as I can tell? And the ground on the right is connected to the ESP32C3 which is connected to the laptop on battery. I haven't checked to see if it changes based on whether or not it's plugged into AC power. Commented Mar 3, 2023 at 2:50
• The datasheet says that if the ADC isn't floating you'll measure inaccurate voltages due to current returning through the output. If the laptop is on battery and not connected to anything else, you should be ok. Your collaborator was definitely on battery and had no other USB devices connected? Commented Mar 3, 2023 at 3:02
• Pretty sure they were on battery, but I'll try to test it again in the coming days. Commented Mar 3, 2023 at 3:35
• As an update I tried measuring the ADC with my computer on battery, and plugged in, and there was indeed a slight difference in the measured voltage. Commented Mar 6, 2023 at 22:41

Even though you are using differential mode, the inputs are still required, each individually, to have potentials between the power supplies 0 and 5V.

The AOUT− output of U2, I presume, is with respect to GND2, and since there seems to be nothing relating GND and GND2, the signal AIN1 of U1 could well be below 0V or above 5V. Same goes for AOUT+ & AIN0.

Even if you can guarantee that their difference (AOUT+)−(AOUT−) stays under 5V, you must also consider that from the perspective of the ADC and its own ground GND, this could be (+15V and +10V), or (−40V and −45V), for example.

The ADC's input protection diodes will clamp at least one of those inputs to one of its own supply potentials (see page 15 of the datasheet), and will (unintentionally) act as a very poor link between the two grounds.

The simplest solution is to join GND to GND2 yourself, but in the absence of the rest of the schematic, I can't say if that's a good idea or not.

As for the different behaviours of the two power supplies, I suspect that the reason has something to do with differences between their own isolation to/between mains earth and GND/GND2.

• I suspected that the difference between GND and GND2 might be the culprit, but I wasn't sure why our laptops had such different grounding when we were on battery. I don't think there's any reason why we can't join GND and GND2. We're currently prototyping, but in the final iteration of this system, the ADC/ESP32 and the vacuum gauge will be fed from the same supply, so there shouldn't be a ground issue. Commented Mar 3, 2023 at 3:37
• @BesselFunct (great name!) Just a comment to say beware of large currents flowing between GND and GND2. A safer alternative may be to put a DCDC converter in from the 24VDC rail and then an optoisolator on the output from the ADC. Note also that Apple laptops are typically in an exposed conductive shell whereas your Lenovo laptop probably isn't… Commented Mar 3, 2023 at 11:02
• I tried connecting GND and GND2 and it seems to have solved the issue. When I start to move away from prototyping, I'm definitely going to try to figure out a better solution. @Landak I've never used an optoisolator before, but I'll take a look at it. Thanks! Commented Mar 6, 2023 at 22:44