ADS1115 Stops working and won't initialize

Hello. I have been working on this circuit

I have 5V GND, SCL and SDA connected directly to an Arduino Mega. The MAX665 is used to invert the voltage to give -5V. The OPA633 is a voltage follower. Below (not shown) are multiplexers used to select which signal I want.

I am using two channels on the ADS1115. Channel 1 reads the voltage between the output of the voltage follower and 5V. This is because I need to be able to read signals from +-4V. If the output of the voltage follower is -4V then the ADS should have 0.5V applied to it.

In order to take into account the true voltage of the power supply which is used to calculate what the voltage follower is actually outputting I measure the power supply voltage after being divided by 2.

The relevant code used is here. I am using PlatformIO on VSCode

#include <Arduino.h>
#include <LiquidCrystal_I2C.h> // Library for Displays
#include <SoftwareSerial.h> // For Serial Connection
#include <Wire.h> // Library for I2C comm
#include <Adafruit_ADS1X15.h> // Library for Adafruit external ADC
#include <string.h>

Adafruit_ADS1115 ads;  // 16-bit ADC

float VSupply;   // Supply voltage (used in the voltage divider network between VMeasured and VOut)
float VMeasured; // Voltage measured
float VOut;      // Voltage output from voltage follower
float VIn;       // Voltage input to voltage follower
int voltage[n];  // Actual capacitor voltage

void setup() {
  Serial.begin(9600);
  delay(100);
  Wire.begin(); delay(100);

  if (!ads.begin()) {
    Serial.println("Failed to initialize ADS.");
    while (1);
  }

  Serial.println("ADS has begun"); delay(100);
}

void loop() {
  memset(voltage, 0, sizeof(voltage)); // Resets all voltages to 0

  VSupply = float(ads.readADC_SingleEnded(3))*0.0003737950501; // 0.1875mV per division * 1.993543181 (from resistor network)
  delay(10);
  //Serial.println(VSupply);
  

  for (char chanIx = 1; chanIx <= n; chanIx++){

    for (char multiIx = 0; multiIx <= 1; multiIx++){ // Positive signals then negative signal
      multiplexerSelection(multiIx, chanIx);
      
      VMeasured = float(ads.readADC_SingleEnded(1))*0.0001875028611; // Voltage measured at ADC
      //Serial.println(VMeasured);
      VOut = VMeasured*1.92244898 - 0.92244898*VSupply; // Voltage output by voltage followe      
      Serial.println(VOut);
      VIn =        0.030744603353506 + 
            VOut* (1.003118305649884 + 
            VOut*(-0.002849417026801 + 
            VOut* (0.001515368245624 + 
            VOut* (0.001391459694530 + 
            VOut*(-0.000916959891801 + 
            VOut*(-0.000182340997645 + 
            VOut* (0.000152729097959))))))); // 7th order polynomial fit to get accurate VIn from VOut
            
      voltage[chanIx-1] += VIn*correction[ chanIx -1 + 12*multiIx ]*(1 + multiIx*-2);          
    }

    voltage[chanIx-1] = abs(voltage[chanIx-1]);    
  }
}

The setup will work for a bit then I receive this error on the serial monitor.

Exception in thread rx:
Traceback (most recent call last):
  File "C:\Users\William\.platformio\python3\lib\threading.py", line 954, in _bootstrap_inner
    self.run()
  File "C:\Users\William\.platformio\python3\lib\threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "c:\users\william\.platformio\penv\lib\site-packages\serial\tools\miniterm.py", line 499, in reader
    data = self.serial.read(self.serial.in_waiting or 1)
  File "c:\users\william\.platformio\penv\lib\site-packages\serial\serialwin32.py", line 259, in in_waiting
    raise SerialException("ClearCommError failed ({!r})".format(ctypes.WinError()))
serial.serialutil.SerialException: ClearCommError failed (PermissionError(13, 'The device does not recognize the command.', None, 22))

Afterwards, if I reset the Arduino, the code never executes past ads.begin(). It's not that I receive an error that it failed to initialize - it gets hung up and never exits. Seemingly randomly, sometimes if I go away for a bit and plug the Arduino back in it will work again (for a bit). Also, when I probe the signal at CH1 I see a voltage of about 0.2V where I would expect to see 2.5V since the voltage follower is outputting 0 V and the power rail is still 5V. Probing the resistance between CH1 and GND shows about 450 ohms.

When I take the ADS1115 out of the circuit and put a new one the same thing happens. When I put the old ADS1115 on a breadboard and connect it to power, GND, SDA, and SDL it functions.

Quite a weird problem. Any ideas on the cause and what I should do to further troubleshoot?

Your schematic is "chopped off". Please supply the entire page.

Voltages to the ADS1115 inputs must be between 0V and the ADS1115 Vdd at all times.

The ADC can be instantly destroyed by voltages outside those bounds.

I know this. Do you see anyway that this could have happened?

Not with an incomplete schematic.

As I said, the bottom part of the circuit are multiplexers so I cut them off. I didn't say, though, that that part of the circuit is irrelevant because I would send a signal directly to the input of the voltage follower. Typically I would actually just tie the input of the voltage follower to ground.

How about you let us decide what's relevant. Unless you know the solution...

1 Like

Here is the full cicruit. The bottom part including the multiplexers is irrelevant because I would supply a voltage directly to the input of the voltage follower. I.e. I would short the input of the voltage follower to ground.

The schematic would be much easier to understand if the usual rules were followed: V+ power rail at the top, ground rail at the bottom (or center, with V- rail at the bottom), signals flow from left to right, use standard symbol for op amp/buffer amp.

What is this circuit supposed to do? I fail to see the point of using the ADS1115 in a circuit with a bipolar power supply.

I'm using the ADS1115 because I have them and because the specs are enough. I need to measure the voltage across multiple capacitor banks.

You should disconnect A1 and then measure the output from the voltage divider

Yes! I have actually tried that, sorry I didn't mention that. When I do disconnect CH1 the voltage divider reads what I'd expect (about 2.5V).

Now check all the module wiring

CH0 and CH2 read 0, CH3 reads ~2.5V. VCC is 5V and GND is ground (I checked continuity). ADDR is also ground. ALRT is floating. SDA and SCL appear to be working (I checked them in a scope). I don't have SDA and SCL tied to a pullup resistor but the ADS that I have on a breadboard works just fine (and no, I'm not trying to use two ADS with the same address at the same time, I'll disconnect the serial communication from one before using the other).

Hmmmm

BTW what happens when you read CH3 in software?

Also, are you testing this circuit in simulation, or hardware?

With or without pullup resistors the ADS on the breadboard works and the one in the circuit does not. When I've read channel 3 with a scope it's 2.5V - the same as what the Arduino said on the serial monitor when the system worked.

This is not simulation - it's all hardware.

Then there is some wiring error on the breadboard.

A wiring error on the breadboard that causes it (the ADS on the breadboard) to work?

Sorry, I mean wiring error in the circuit (what is it? PCB? Rat's nest? How about some images?)

It's on a perfboard. Yeah, it must be some error somewhere. I'll send images tomorrow (I'm not at work anymore).

It really must be a wiring error but I am baffled. The only lead I have so far is that fact that CH1 appears to have a low resistance from it to ground somehow. But when I've taken an ADS out of the perf board and put it on a bread board the thing starts working again and I can't measure a resistance between CH1 and GND.

Anyway, I'll post pictures tomorrow when I get to work.