Cross-talk when using ADS1115 with a mux

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
alexdry
 
Posts: 16
Joined: Sun Aug 16, 2020 4:51 am

Cross-talk when using ADS1115 with a mux

Post by alexdry »

I'm trying to read several pots with 16-bit resolution using an ADS1115 and a CD4051 mux with a Teensy LC. It works fine except from when I twist a pot close to its maximum value. When a pot starts rising above approximately 58,000 in the serial values I read, there is a horrible cross-talk and the other pots rise in values too. For example if pot 1 goes above 58,000 and pot 2 is at 12,000, when pot 1 reaches its maximum limit, pot 2 will have gone up to 28,000.

Here's the circuit:
Image

And here's the code (the code is written for a 16 channel mux, since it's for a project that should support those, it shouldn't matter here though):

Code: Select all

#include <Wire.h>
#include <Adafruit_ADS1X15.h>

#define POTDELAY 50

Adafruit_ADS1115 ads;

const int numMuxCtlPins = 4;
const int numPots = 2;

unsigned int pots[numPots];

int muxCtlPins[numMuxCtlPins] = {2, 3, 4, 7};
int muxCtlValues[numMuxCtlPins] = { 1, 3, 7, 15 };

void readPots() {
  int16_t results;
  Serial.print("pots");
  for (int pot = 0; pot < numPots; pot++) {
    for(int pin = 0; pin < numMuxCtlPins; pin++) {
      digitalWrite(muxCtlPins[pin], (pot & muxCtlValues[pin]) >> pin);
    }
    delayMicroseconds(POTDELAY);
    results = ads.readADC_Differential_0_1();
    // add 32768 to offset the value to start from 0
    uint32_t uResults = results + 0x8000;
    pots[pot] = uResults;
    Serial.print(" ");
    Serial.print(responsivePots[pot]);
  }
  Serial.println();
}

void setup(void)
{
  for (int i = 0; i < 4; i++) {
    pinMode(muxCtlPins[i], OUTPUT);
    digitalWrite(muxCtlPins[i], LOW);
  }
  // 2x gain   +/- 2.048V  1 bit = 1mV      0.0625mV
  ads.setGain(GAIN_TWO);
  ads.begin();

  Serial.begin(115200);
  while (!Serial);
}

void loop(void)
{
  readPots();
}
Any help is greatly appreciated.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Cross-talk when using ADS1115 with a mux

Post by adafruit_support_mike »

It looks like you're using 4.096V as your reference voltage for the ADC. Is your VCC 5V or 3.3V?

User avatar
alexdry
 
Posts: 16
Joined: Sun Aug 16, 2020 4:51 am

Re: Cross-talk when using ADS1115 with a mux

Post by alexdry »

adafruit_support_mike wrote:It looks like you're using 4.096V as your reference voltage for the ADC. Is your VCC 5V or 3.3V?
My VCC is 5V. The voltage reference should be correct.
Thinking twice, the 4051 mux is powered with 3.3V and not 5V as shown in the circuit image. Could that be an issue? I am currently away from the circuit so unfortunately i can't check right now. Still, when I twist one potentiometer, its readings seem correct, excluding the cross-talk.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Cross-talk when using ADS1115 with a mux

Post by adafruit_support_mike »

Powering the 4051 with a voltage lower than the voltage across the potentiometers would cause problems, yes. Make sure the 4051 has 5V and see if that has any effect on the crosstalk.

User avatar
alexdry
 
Posts: 16
Joined: Sun Aug 16, 2020 4:51 am

Re: Cross-talk when using ADS1115 with a mux

Post by alexdry »

Powering the mux with 5V solved the issue. There is a bit a cross-talk now, but nothing compared to the initial problem. Still I think it's better to use one ADS1115 for every two pots and mux the ADS1115 with an I2C mux, there should be no cross-talk. Thanks for the help.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Cross-talk when using ADS1115 with a mux

Post by adafruit_support_mike »

You could also look at other analog switches. The 4051 is an old standby, but its nominal channel resistance is about 500 Ohms.

The TS3A44159 is a quad 2-SPDT mux with a nominal channel resistance of about 0.5 Ohms, and a worst-case resistance of a couple Ohms:

https://www.ti.com/lit/ds/symlink/ts3a4 ... 6570884423

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”