0

ADS1115 Point Readings
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ADS1115 Point Readings

by shankulah60 on Thu Jun 29, 2017 11:25 am

Hi,
I need a little help in figuring out how to read from the ADS1115 chip at certain points. I have programmed my XY Plotter (using Arduino) to draw a square spiral and move in 1MM increments. After moving each increment there is a pause of a few seconds, during that time I would like the ADS1115 chip to read the voltage. The problem that I am having is when using the example code I move the reading from the loop section of Arduino, to the setup section, and the Voltage readings that I get are all 0.00V, I also don't fully understand the example code and I am in a time crunch to get this project done, so I was wondering if anyone had any ideas on how to fix this.
Thanks for your help!

shankulah60
 
Posts: 8
Joined: Wed Jun 28, 2017 8:53 am

Re: ADS1115 Point Readings

by adafruit_support_bill on Thu Jun 29, 2017 12:21 pm

Please post photos showing how you have everything connected. And also post the code that you are using.

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

Re: ADS1115 Point Readings

by shankulah60 on Thu Jun 29, 2017 12:42 pm

Hi,
Thanks for the reply. Here is the code that I am using. The uploader said that the images were to large, so here is a link to them... https://drive.google.com/drive/folders/0BwZYrMOUWVC4d2VSY0k2ZFEtSlk?usp=sharing

Code: Select all | TOGGLE FULL SIZE
#include <Wire.h>
#include <Adafruit_ADS1015.h>

Adafruit_ADS1015 ads1015;

float Voltage= 0.0000;
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.begin();





}


void loop(void)
{
    int16_t results;

  results = (-1*(ads1015.readADC_Differential_0_1()));
  Voltage= (float(results*3)/1000);
  //Serial.print("Differential: "); Serial.print(results); Serial.print("("); Serial.print(Voltage); Serial.println("V)");
 
Serial.println();
Serial.print("Voltage: ");
Serial.print(Voltage);
  delay(1000);
}

shankulah60
 
Posts: 8
Joined: Wed Jun 28, 2017 8:53 am

Re: ADS1115 Point Readings

by adafruit_support_bill on Thu Jun 29, 2017 12:52 pm

You do not have a connection to the SDA pin. You need both SDA and SCL to communicate with the device:
https://learn.adafruit.com/adafruit-4-c ... and-wiring
Image

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

Re: ADS1115 Point Readings

by shankulah60 on Thu Jun 29, 2017 2:50 pm

Sorry for the late reply,

It must have broken off when I was testing with it earlier. After reattaching that the Voltage that I am getting is no longer always 0.00 Volts.
What do I need to do to my code to be able to read the voltage after each interval has been completed instead of having continuous readings?
Thanks!

shankulah60
 
Posts: 8
Joined: Wed Jun 28, 2017 8:53 am

Re: ADS1115 Point Readings

by adafruit_support_bill on Thu Jun 29, 2017 3:23 pm

Are you using the same Arduino to drive the plotter?

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

Re: ADS1115 Point Readings

by shankulah60 on Thu Jun 29, 2017 3:28 pm

Yes

shankulah60
 
Posts: 8
Joined: Wed Jun 28, 2017 8:53 am

Re: ADS1115 Point Readings

by adafruit_support_bill on Thu Jun 29, 2017 3:37 pm

So your plotter driver code will know when it is paused. You can add in the ADS1115 read code there.

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

Re: ADS1115 Point Readings

by shankulah60 on Thu Jun 29, 2017 4:00 pm

Thanks so much for your help!

shankulah60
 
Posts: 8
Joined: Wed Jun 28, 2017 8:53 am

Please be positive and constructive with your questions and comments.