The ADS1115 is a device that converts Analog to Digital (ADC) driven by i2C Protocol, ADS1115 is a precision analog to digital converter with 16bits of resolution in an ultra-small leadless (QFN) and on a MSPO-10 package. The ADS1115 are designed with precision, power and easy to implement. These device as a feature an on-board reference and oscillator. Data will be communicating via i2C serial interface and can be connected 4 slaves on i2c addresses selection. These device runs on 2.0v to 5.5v.
Block Diagram
ADS1115 can perform conversions at rates up to 860 SPS (samples per second) and an on-board PGA is integrated on ADS1115 that offers input range for the supply as low as -+256mV allowing both large and small signals to be measured on a high resolution. Other feature of ADS1115 it has MUX (Multiplexer) that provides two differential or four single ended inputs and operate either on continuous conversation mode or a single-shot mode that automatically powers down after a conversation and reduces current consumption during idle period. The ADS1115 can be used for Portable Instrumentation, Consumer Goods, Battery Monitoring, Temperature Measurement, and Factory Automation and Process Controls.
Internal ASD1115 Registers
As you can see the registers of the ADS1115 below. The first block is an 8bit pointer register that directs the data either the 16bit read only conversion register (0) or the 16bit read/write configuration register (1). While the program goes into all the configuration register bits ill cover the most important parts of the configuration register. please refer to the ADS1115 Datasheet
Component Required
- Arduino Microcontroller, TENSSY (TeensyDuino), ESP8266, ESPDUINO
- ADS1115 Chip / ADS1115 Breakout Module
- Thermistor
- Solderless Bread Board
- Jumper Wires
Tested on
- ATMEGA328 16/12
- ATMEGA32u4 16/8/ MHz
- ESP8266
- ATMEGA250 16 MHz
- ATSAM3x8E
- ATSAM21D
- ATTINY85 16/8 MHz
Wiring Guide
Multiple ADS1115 i2C Address Selection
ADS1115 Chip has a base of 7-Bit i2C Address of 0x48 (1001000) and i2c addressing that allow four different addresses using one address (ADR). To program the address connect the pin address as diagram below, up to four boards can be wired.
Source Code / ADS1115 Single Ended on Thermistor
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
/********************************************/ /* 14CORE | TEST CODE FOR ADS1115 ANALOG to DIGITAL CONVERSION www.14core.com / [email protected] */ *********************************************/ #include <Wire.h> #include <Adafruit_ADS1015.h> //Please refer to the diagram above for i2C Address Selection Adafruit_ADS1115 ads(0x49); int doDelay = 1000; int getVal; void setup(void) { Serial.begin(9600); Serial.println("14CORE | Thermistor Test with ADS1115"); Serial.println("Reading single-ended data from A-IN-0"); Serial.println("====================================="); ads.begin(); } void loop(void) { int16_t adc0; adc0 = ads.readADC_SingleEnded(0); getVal = (adc0); Serial.print("Analog IN A0 Thermistor Value: "); Serial.println(getVal); delay(doDelay); } |
Test Code for Deferential
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
#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(1000); } |
Test Code for Comparator
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
#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("Single-ended readings from AIN0 with >3.0V comparator"); Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)"); Serial.println("Comparator Threshold: 1000 (3.000V)"); // 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(); // Setup 3V comparator on channel 0 ads.startComparator_SingleEnded(0, 1000); } void loop(void) { int16_t adc0; // Comparator will only de-assert after a read adc0 = ads.getLastConversionResults(); Serial.print("AIN0: "); Serial.println(adc0); delay(100); } |
Downloads