The ADS1115 is a 16-bit Analog-to-Digital Converter (ADC) that allows the Raspberry Pi to read analog signals from sensors, potentiometers, and other analog devices. This guide will walk you through setting up the ADS1115 ADC module with the Raspberry Pi to read analog sensor data using Python.
What You Will Need
- Raspberry Pi (any model with I2C support, e.g., Pi 3, Pi 4)
- ADS1115 ADC Module
- Analog Sensor (e.g., potentiometer, temperature sensor, soil moisture sensor, etc.)
- Breadboard and Jumper Wires
- Python installed on the Raspberry Pi
Step 1: Understanding the ADS1115
The Raspberry Pi lacks analog input pins, so the ADS1115 is used to convert analog signals to digital. The ADS1115 provides:
- 4 Analog Input Channels (A0, A1, A2, A3)
- 16-bit Resolution for High Precision
- I2C Communication Interface
- Programmable Gain Amplifier (PGA) for adjustable sensitivity
Step 2: Wiring the ADS1115 to the Raspberry Pi
The ADS1115 communicates via I2C, so we connect it to the Raspberry Pi’s I2C pins.
Connections
ADS1115 Pin | Raspberry Pi Pin |
---|---|
VCC | 3.3V (Pin 1) or 5V (Pin 2) |
GND | Ground (Pin 6) |
SDA | SDA (Pin 3, GPIO2) |
SCL | SCL (Pin 5, GPIO3) |
A0-A3 (Analog Inputs) | Connect to sensor output |
Step 3: Enable I2C on the Raspberry Pi
- Open the Raspberry Pi configuration tool:
- Navigate to Interface Options > I2C and enable it.
- Reboot the Raspberry Pi:
- Verify that the ADS1115 is detected on the I2C bus:
0x48
.
The ADS1115 should appear at address
Step 4: Install Required Libraries
- Update your Raspberry Pi’s package list:
- Install the required I2C tools and Python libraries:
Step 5: Reading Analog Data from the ADS1115
Python Code to Read Sensor Data from ADS1115
Step 6: Applications of ADS1115 with Raspberry Pi
- Reading Analog Sensors – Temperature, light, humidity, or gas sensors.
- Battery Voltage Monitoring – Measure voltages safely with high resolution.
- Soil Moisture Monitoring – Use for smart irrigation systems.
- Potentiometer Readings – Use as a user input controller for projects.
Troubleshooting
-
ADS1115 Not Detected (
i2cdetect
does not show0x48
)- Ensure the SDA/SCL pins are correctly wired.
- Verify that I2C is enabled using
sudo raspi-config
.
-
Inaccurate Readings
- Use PGA settings in the Python code to adjust voltage range.
- Ensure a stable power supply to the ADS1115 module.
-
Multiple ADS1115 Modules
- Modify the I2C address using the ADDR pin to avoid conflicts.
Conclusion
The ADS1115 ADC module enables the Raspberry Pi to read analog sensor data with high precision. Whether you're building environmental monitoring, battery sensing, or IoT applications, this guide provides a simple way to integrate analog inputs into your projects! 🚀