This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

  • TI Thinks Resolved

ADS1015: not properly reading negative values

Prodigy 10 points

Replies: 1

Views: 59

Part Number: ADS1015

Hi there,

So I have this ADS1015 hooked up to my Arduino, but it doesn't really work properly.

I'm measuring differentially, and when I'm measuring positive values, it works completely fine. No problems there.

However, problems start to arise when I want to measure negative values. Sometimes it measures value of about 1.6 volts just fine, but when you change the voltage in even the slightest way, it just stops measuring anything and returns nothing. It also seems to work fine around 400mv, and 5.1v. I have no clue what could be cousing this.

I have the Addres pin pulled to ground, i'm feeding it with 5V and I'm using A0 as the positive input and A1 as the negative input.

I'm using a lab bench power supply to supply different voltages, and my arduino is hooked up to a laptop which doesn't have it's charger plugged in, so it won't be shorted to ground.

I've included my code at the bottom of this post (taken from the Adafruit ADS1015 library example)

I'm looking forward to your suggestions,

Thanks in advance,

-Daan

This is how I've wired everything. L_IO1 and LIO_2 can either be GND or +30V.

(the insert image option didn't work so I uploaded it somewhere else)

https://imgur.com/HKEw8FV

#include <Wire.h>
#include <Adafruit_ADS1015.h>

// Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */
Adafruit_ADS1015 ads;     /* Use thi for the 12-bit version */

void setup(void)
{
  Serial.begin(9600);
  Serial.println("Hello!");
  
  Serial.println("Getting differential reading from AIN0 (P) and AIN1 (N)");
  Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");
  
  // The ADC input range (or gain) can be changed via the following
  // functions, but be careful never to exceed VDD +0.3V max, or to
  // exceed the upper and lower limits if you adjust the input range!
  // Setting these values incorrectly may destroy your ADC!
  //                                                                ADS1015  ADS1115
  //                                                                -------  -------
   ads.setGain(GAIN_TWOTHIRDS);  // 2/3x gain +/- 6.144V  1 bit = 3mV      0.1875mV (default)
  // ads.setGain(GAIN_ONE);        // 1x gain   +/- 4.096V  1 bit = 2mV      0.125mV
  // ads.setGain(GAIN_TWO);        // 2x gain   +/- 2.048V  1 bit = 1mV      0.0625mV
  // ads.setGain(GAIN_FOUR);       // 4x gain   +/- 1.024V  1 bit = 0.5mV    0.03125mV
  // ads.setGain(GAIN_EIGHT);      // 8x gain   +/- 0.512V  1 bit = 0.25mV   0.015625mV
  // ads.setGain(GAIN_SIXTEEN);    // 16x gain  +/- 0.256V  1 bit = 0.125mV  0.0078125mV
  
  ads.begin();
}

void loop(void)
{
  int16_t results;
  
  /* Be sure to update this value based on the IC and the gain settings! */
  float   multiplier = 3.0F;    /* ADS1015 @ +/- 6.144V gain (12-bit results) */
  //float multiplier = 0.1875F; /* ADS1115  @ +/- 6.144V gain (16-bit results) */

  results = ads.readADC_Differential_0_1();  
    
  Serial.print("Differential: "); Serial.print(results); Serial.print("("); Serial.print(results * multiplier); Serial.println("mV)");

  delay(100);
}

  • Hello,

    Seeing how you are getting correct reading at times, this eliminated timing issues in the digital communications.

    I also suggest using an oscilloscope connected to the digital bus lines to visually check the communications are as expected.

    Can you also elaborate when you say the device stops working? at certain input voltages, the devices simply does not respond?

    Let's begin eliminating:

    can you confirm that the voltage at each pin is a positive voltage? The device can only read positive voltage. The differential voltage between the two can be negative, but the voltage at each pin has to be within GND and VDD.

    Are you interpreting the output correctly? note the table below for the output code.

    Regards

    Cynthia

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.