I have a V4.77 VCC input voltage to my ADS1115. The gain is set to GAIN_TWOTHIRDS, so the measuring range should be +/- V6.144. If I connect one of the channels to Vcc, I would assume it can measure V4.77 since it is in the range, but the result I am getting is V6.144 instead of the actual V4.77.
I wonder if the range is +/- CVV(V4.77) or Gain(V6.144), whichever is smaller, meaning it can't read the voltage of Vcc? Can someone confirm/deny this?
And would it be able to measure Vcc if Vcc is also connected to a channel?
The problem is probably in the code that you forgot to post.
Here is what the data sheet says:
Analog input voltages must never exceed the analog input voltage limits given in the Absolute Maximum Ratings.
If a VDD supply voltage greater than 4 V is used, the ±6.144 V full-scale range allows input voltages to extend up
to the supply. Although in this case (or whenever the supply voltage is less than the full-scale range; for example,
VDD = 3.3 V and full-scale range = ±4.096 V), a full-scale ADC output code cannot be obtained. For example,
with VDD = 3.3 V and FSR = ±4.096 V, only signals up to VIN = ±3.3 V can be measured. The code range that
represents voltages |VIN| > 3.3 V is not used in this case.
Have to agree with Jremington in that any error is in your code. I have an ADS1115 sitting here. Gain defaulted to Two-Thirds measuring it's Vcc which is 4.89 volts This is what I see:
AIN0: 26099 Voltage: 4.8935623
AIN0: 26089 Voltage: 4.8916873
AIN0: 26092 Voltage: 4.8922500
AIN0: 26094 Voltage: 4.8926248
Works just fine. May help if you posted your code. To answer your question Yes it can measure its own Vcc.
Ron
Short answer is yes, you can measure up to +/- VCC, and you can measure the VCC itself. An ADS1115 connected to the 5V on my UNO reads 4.979V at the VCC and a DMM reads 4.98.
Without a circuit diagram and your code it is impossible to know why you are getting 6.144V.
Thanks, @jremington , @Ron_Blain , @robertnc. Your input helped me!
I did not post the code because it was part of a much larger project. However, I did go back to the basics and loaded the singleended example that comes with the library: https://github.com/adafruit/Adafruit_ADS1X15/blob/master/examples/singleended/singleended.ino
It worked! and the only difference to my code was that I had an extra ads->setDataRate(860); in the setup to be able to do 860 reads per second; after taking that out in my code, it also started working so I assume I misunderstood the setDataRate() method or there is a bug in the library. Here is the sample code if you want to try and reproduce the issue yourselves:
#include <Adafruit_ADS1X15.h>
Adafruit_ADS1115 ads; /* Use this for the 16-bit version */
//Adafruit_ADS1115 ads; /* Use this for the 12-bit version */
void setup(void)
{
Serial.begin(9600);
Serial.println("Hello!");
Serial.println("Getting single-ended readings from AIN0..3");
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
// THIS LINE IS THE ISSUE!!!!
ads.setDataRate(860);
if (!ads.begin()) {
Serial.println("Failed to initialize ADS.");
while (1);
}
}
void loop(void)
{
int16_t adc0, adc1, adc2, adc3;
float volts0, volts1, volts2, volts3;
adc0 = ads.readADC_SingleEnded(0);
adc1 = ads.readADC_SingleEnded(1);
adc2 = ads.readADC_SingleEnded(2);
adc3 = ads.readADC_SingleEnded(3);
volts0 = ads.computeVolts(adc0);
volts1 = ads.computeVolts(adc1);
volts2 = ads.computeVolts(adc2);
volts3 = ads.computeVolts(adc3);
Serial.println("-----------------------------------------------------------");
Serial.print("AIN0: "); Serial.print(adc0); Serial.print(" "); Serial.print(volts0); Serial.println("V");
Serial.print("AIN1: "); Serial.print(adc1); Serial.print(" "); Serial.print(volts1); Serial.println("V");
Serial.print("AIN2: "); Serial.print(adc2); Serial.print(" "); Serial.print(volts2); Serial.println("V");
Serial.print("AIN3: "); Serial.print(adc3); Serial.print(" "); Serial.print(volts3); Serial.println("V");
delay(1000);
}
type or paste code here
Blockquote
So I did not have time to try to reproduce your error, but have you benchmarked your results for SPS? The library you use can impact the sampling rate you achieve.
There are or at least were issues with the Adafruit library because if you look at the code they introduced a delay in the conversion that limited the SPS to about 110. I have not tried to use that library recently so there may be a newer version that does not have the delays.
Using the WE library I get about 250SPS when configured for 860SPS in single shot mode. I have not really dug into that one to see what is going on with it.
Using the Terry Myers Lite library I can get about 630SPS, but I have chinese knockoff chips so that does not really surprise me.
Here are some resources you might want to look at
ADS1115_WE: Also has links to some good overview pages.
ADS1115-Lite:
More on sampling aspects of the ADS1115:
Hey @robertnc, I have not benchmarked my results so far. Thanks for the heads up!
Luckily for my current project, the architecture changed, and I don't need 860 SPS anymore; I just had that as a remnant that I forgot to clean up in the code.
However, I will keep all of this in mind if I ever need 860 SPS
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.