RNBT
January 3, 2019, 12:56pm
1
Hi guys, I am trying to use the ADS1115 16-bit ADC module with an Arduino uno.
I connected like that. and source code is
#include <Wire.h>
#include <Adafruit_ADS1015.h>
Adafruit_ADS1115 ads; // Default Address 0x48
float DCV = 0.0;
void setup(void)
{
Serial.begin(9600);
ads.begin();
}
void loop(void)
{
int16_t adc0;
adc0 = ads.readADC_SingleEnded(0);
DCV = (adc0 * 0.1875)/1000.0;
Serial.print("* AIN0 = "); Serial.print(adc0);
Serial.print(", DCV = "); Serial.println(DCV, 7);
delay(3000);
}
But serial output is
**AIN0: 15028 DCV: 2.8177499 **
not 3.3~~~
So, i connected A0 to GND,
**AIN0: -585 DCV: -0.1096875 **
And i connected A0 to 0.446V node,
AIN0: -299 Voltage: -0.0560625
The minus value! >:(
When i add AIN0 to 585, other values are incorrect.
What should i do?
MarkT
January 3, 2019, 4:24pm
2
int16_t adc0;
adc0 = ads.readADC_SingleEnded(0);
readADC_SingleEnded returns an unsigned 16 bit int, not signed.
RNBT
January 3, 2019, 4:33pm
3
MarkT:
int16_t adc0;
adc0 = ads.readADC_SingleEnded(0);
readADC_SingleEnded returns an unsigned 16 bit int, not signed.
Then, why serial print minus values?
And, why serial print incorrect values?
Just need Offset? regardless gnd(0V), Serial-output Voltage + 0.5V ≈ Multimeter Voltage (but not at <0.2V)
I tested some voltage node,
Multimeter / Serial-output
4.835V / AIN0: 23040 Voltage: 4.3200001
4.287V / AIN0: 20186 Voltage: 3.7848749
3.78V / AIN0: 17494 Voltage: 3.2801249
2.5V / AIN0: 10703 Voltage: 2.0068125
1.36V / AIN0: 4594 Voltage: 0.8613750
0.6V / AIN0: 515 Voltage: 0.0965625
0.334V / AIN0: -896 Voltage: -0.1680000
0.12V / AIN0: -1161 Voltage: -0.2176875
gnd(0V) / AIN0: -585 Voltage: -0.1096875
system
January 3, 2019, 6:00pm
4
What do you read when you connect the UNO 3.3V pin to ADS1115, AIN0? What does your DMM say?
RNBT
January 3, 2019, 7:35pm
5
outsider:
What do you read when you connect the UNO 3.3V pin to ADS1115, AIN0? What does your DMM say?
DMM: 3.320V
Serial Output
AIN0:15054 Voltage: 2.8226
if i add AIN0 to 2658 as offset, Voltage almost correct at 0.3V~5V. but at < 0.3V, serial is not correct.
Wawa
January 3, 2019, 8:22pm
6
RNBT:
Voltage almost correct at 0.3V~5V. but at < 0.3V, serial is not correct.
Did you connect ADS ground to Arduino ground.
Post a picture of the setup.
Leo..
RNBT
January 3, 2019, 9:14pm
7
I connected ADS gnd to Uno gnd. and A0 to 3.3V
Wawa
January 4, 2019, 3:40am
8
Seems to be connected ok.
I assume you tested/replaced all the wires before posting.
You could try setting the chip to a PGA gain of one (4.096volt FS).
And/or measure in differential mode, with the other input connected to ground.
If none of the above helps, then I would try another ADS board.
Leo..
RNBT:
Then, why serial print minus values?
That's the magic of integers.
If the ADS provides you a value > 32,767 it will be converted to a negative value because you store it in a signed integer type.
MarkT:
int16_t adc0;
adc0 = ads.readADC_SingleEnded(0);
readADC_SingleEnded returns an unsigned 16 bit int, not signed.
Is not true. Excerpt from the lib:
int16_t readADC_SingleEnded(uint8_t channel);
RNBT:
Then, why serial print minus values?
The datasheet says:
because of device offset, the ADS111x can still output negative codes in case VAINP is close to 0 V
But since max offset error is only +/- 3 LSBs, that doesn't seem to explain negative codes at 0.3v.
RNBT
January 5, 2019, 11:44am
11
DaveEvans:
Is not true. Excerpt from the lib:
int16_t readADC_SingleEnded(uint8_t channel);
The datasheet says:
But since max offset error is only +/- 3 LSBs, that doesn't seem to explain negative codes at 0.3v.
Thanks. I try to change arduino, bradboard, wire, computer ... except for ads1115.
I think my ads1115's calibration is wrong or broken. thanks again.