Due to high demand expect some shipping delays at this time, orders may not ship for 3-4 business days. On MLK Day no orders will be shipped.
0

ADS1115 with OLED Display - Only A0 operational
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ADS1115 with OLED Display - Only A0 operational

by CPW on Tue Nov 30, 2021 5:36 pm

Working a project where I'd like to display several channels from the ads1115 on a small OLED display. All 4 channels of the ads1115 work as expected in isolation. However, when I add an OLED display to the I2C bus, only the A0 channel of the ads1115 is operational. Channels A1, shows a value of unknown origin...about 1.9 V, and A2, A2 show 0. The ads1115 is at 0x48; the OLED is at 0x3C, as detected by the device scanner. I've changed the OLED to 0x3D...same result. Any thoughts?

CPW
 
Posts: 18
Joined: Tue Aug 24, 2021 4:46 pm

Re: ADS1115 with OLED Display - Only A0 operational

by adafruit_support_bill on Tue Nov 30, 2021 5:38 pm

What is connected to those channels?

adafruit_support_bill
 
Posts: 82817
Joined: Sat Feb 07, 2009 10:11 am

Re: ADS1115 with OLED Display - Only A0 operational

by CPW on Tue Nov 30, 2021 5:55 pm

Testing with 4.5 volt DC source.

CPW
 
Posts: 18
Joined: Tue Aug 24, 2021 4:46 pm

Re: ADS1115 with OLED Display - Only A0 operational

by adafruit_support_bill on Tue Nov 30, 2021 6:03 pm

Please post your code and a photo of your setup. That might provide some clues.

adafruit_support_bill
 
Posts: 82817
Joined: Sat Feb 07, 2009 10:11 am

Re: ADS1115 with OLED Display - Only A0 operational

by CPW on Tue Nov 30, 2021 6:54 pm

[img]
A1.jpg
[/img]
A0.jpg
A0.jpg (117.57 KiB) Viewed 105 times
[attachment=0]A2D-OLEDSetup.jpg. Photo with 4.5 v DC source to each A2D input with OLED display of result, one of the whole setup using Arduino UNO and the code the UNO is running..
Code: Select all | TOGGLE FULL SIZE
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_ADS1X15.h>
Adafruit_ADS1115 ads;

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
#define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3D
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);


void setup() {
 
  Serial.begin(9600);
  if (!ads.begin()) {
    Serial.println("Failed to initialize ADS.");
    while (1);
  }
   
  ads.setGain(GAIN_TWOTHIRDS);
 

  if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }

  display.clearDisplay();
  display.setTextColor(SSD1306_WHITE); // Draw white text
  display.cp437(true);         // Use full 256 char 'Code Page 437' font
  display.setTextSize(1);
}

int16_t adc3, adc1, adc2, adc0;
float volts3, volts1, volts2, volts0;
float sum1, sum2, sum3, sum0;
const int n = 1;

void loop() {

  sum0 = sum1 = sum2 = sum3 = 0.0;
  for (int i = 1; i <= n; i++){
    adc0 = ads.readADC_SingleEnded(0);
      adc1 = ads.readADC_SingleEnded(1);
        adc2 = ads.readADC_SingleEnded(2);
          adc3 = ads.readADC_SingleEnded(3);
    sum0 = sum0 + float(adc0);   
      sum1 = sum1 + float(adc1);
        sum1 = sum1 + float(adc1);   
          sum1 = sum1 + float(adc1);
  }

  sum0 = sum0/float(n);
    sum1 = sum1/float(n);
      sum2 = sum2/float(n);
        sum3 = sum3/float(n);
  volts0 = ads.computeVolts(sum0);
    volts1 = ads.computeVolts(sum1);
      volts2 = ads.computeVolts(sum2);
        volts3 = ads.computeVolts(sum3);

  Serial.println("V0 = " + String(volts0,4)); 
    Serial.println("V1 = " + String(volts1,4));
      Serial.println("V2 = " + String(volts2,4));
        Serial.println("V3 = " + String(volts3,4));
       
  display.clearDisplay();
  display.setCursor(0,0);
  display.println("v0 = " + String(volts0,4));
    display.setCursor(0,8);
    display.println("v1 = " + String(volts1,4));
      display.setCursor(0,16);
      display.println("v2 = " + String(volts2,4));
            display.setCursor(0,24);
            display.println("v3 = " + String(volts3,4));
  display.display();
  delay(1000);
  }
Attachments
A1.jpg
A1.jpg (117.21 KiB) Viewed 105 times
A2D-OLEDSetup.jpg
A2D-OLEDSetup.jpg (383.45 KiB) Viewed 105 times

CPW
 
Posts: 18
Joined: Tue Aug 24, 2021 4:46 pm

Re: ADS1115 with OLED Display - Only A0 operational

by CPW on Tue Nov 30, 2021 7:02 pm

I found the problem...opied code and didn't review it closely enough.

CPW
 
Posts: 18
Joined: Tue Aug 24, 2021 4:46 pm

Re: ADS1115 with OLED Display - Only A0 operational

by adafruit_support_bill on Tue Nov 30, 2021 10:59 pm

You only have a connection to A0. All the others are floating. Their values are 'undefined'.

adafruit_support_bill
 
Posts: 82817
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.