Circuit Diagram
Program Code
#include <Wire.h>
#include <Adafruit_ADS1X15.h>
Adafruit_ADS1115 ads; /* Create an instance of the ADS1115 */
void setup(void) {
Serial.begin(9600);
Serial.println("Initializing ADS1115...");
// The ADC gain can be changed to allow for different voltage ranges:
// ads.setGain(GAIN_TWOTHIRDS); // 2/3x gain +/- 6.144V 1 bit = 0.1875mV (default)
// ads.setGain(GAIN_ONE); // 1x gain +/- 4.096V 1 bit = 0.125mV
// ads.setGain(GAIN_TWO); // 2x gain +/- 2.048V 1 bit = 0.0625mV
if (!ads.begin()) {
Serial.println("Failed to initialize ADS1115. Check wiring!");
while (1);
}
}
void loop(void) {
int16_t adc0;
float volts0;
// Read the raw value from Channel 0
adc0 = ads.readADC_SingleEnded(0);
// Convert raw value to Volts (assuming default 2/3 gain)
// 1 bit = 0.1875mV = 0.0001875V
volts0 = adc0 * 0.0001875;
Serial.print("Raw ADC Value: ");
Serial.print(adc0);
Serial.print(" | Voltage: ");
Serial.println(volts0, 4); // Display with 4 decimal places
delay(500);
}
1. The Wiring Connections (Pin-to-Pin)
| ADS1115 Pin | Arduino Uno Pin | Function | Requirement |
| VDD | 5V | Power Supply | Powers the IC (2.0V – 5.5V compatible). |
| GND | GND | Ground | Common ground for signal reference. |
| SCL | A5 | I2C Clock | Serial Clock line for data timing. |
| SDA | A4 | I2C Data | Serial Data line for bit transfer. |
| ADDR | GND | Address Set | Sets I2C address to 0x48 (as defined in code). |
| A0 | Signal Source | Analog Input | The voltage you want to measure (0–5V max). |
2. Circuit Diagram Logic
A. The I2C Bus (A4 & A5)
The Arduino Uno uses dedicated pins for I2C: A4 (SDA) and A5 (SCL).
Pull-up Resistors: While the Arduino has internal pull-ups, for 16-bit precision, it is highly recommended to use external $4.7k\Omega$ or $10k\Omega$ resistors connected from SDA/SCL to 5V. This ensures the signal "edges" are sharp, preventing data errors.
B. The Address Pin (ADDR)
In the code provided below, we initialize the sensor with ads.begin(). By default, the library looks for address 0x48.
To match this code, the ADDR pin must be wired to GND. If you leave it floating or wire it to VDD, the code will fail to find the sensor.
C. The Analog Input (A0)
Since the code calls ads.readADC_SingleEnded(0), the circuit expects your sensor or voltage source to be connected to Pin AIN0.
Voltage Limit: Because we are powering the ADS1115 with 5V from the Arduino, you must ensure the input on A0 does not exceed 5V.
3. How the Circuit Works with the Code
Initialization: When
ads.begin()is called, the Arduino sends a "Start" condition over A4/A5 to the address 0x48. If the ADDR pin is grounded, the ADS1115 wakes up and acknowledges.Configuration: The code sets the Gain. If using
GAIN_TWOTHIRDS, the internal PGA (Programmable Gain Amplifier) is set to handle a range up to +/- 6.144V. Even though the range is 6V, our circuit limits us to 5V because of the Arduino's power rail.Conversion: When
readADC_SingleEnded(0)is executed, the ADS1115 samples the voltage on A0 relative to GND, converts it to a 16-bit number, and sends it back to the Arduino via the I2C bus.Math: The Arduino takes that raw number and multiplies it by 0.0001875 (the voltage value of 1 bit at that gain) to give you the final voltage on the Serial Monitor.

