Example Code for Raspberry Pi-Read 4 Channels Analog Signals
This tutorial will demonstrate how to use the ADC module to read 4 channels analog signals with Raspberry Pi. Please switch the I2C address to 0x48.
Hardware Preparation
- Raspberry Pi 4 Model B (or similar) * 1
- Gravity ADS1115 16-bit ADC Module x 1
- Analog Sensors(sound, voltage, temperature, ambient light, etc.) x4
- Gravity 4pin Cable (comes with Gravity ADS1115 module) x1
Software Preparation
Wiring Diagram
Other Preparation Work
![]() |
The voltage on analog input pins must be less than VCC 0.3V! That is, Analog Signal ≤ VCC 0.3V |
|---|
Please switch the I2C address to 0x48.
Step 1. Open the Raspberry Pi I2C interface. If it is already open, skip this step.
Open Terminal, type the following command, and press Enter:
sudo raspi-config
Then use the up and down keys to select “5 Interfacing Options”, press Enter, select “P5 I2C” and press Enter to confirm “YES”. Restart the Raspberry Pi.
Step 2. Install the Python related libraries and git, then Raspberry Pi requires networking. If it is already installed, skip this step.
In the terminal, type in the following commands in order, and press Enter:
sudo apt-get update
sudo apt-get install build-essential python-dev python-smbus git
Step 3. Download the driver and run. In the terminal, type in the following commands in order, and press Enter.
cd ~
git clone https://github.com/DFRobot/DFRobot_ADS1115.git
cd DFRobot_ADS1115/RaspberryPi/Python
sudo python DFRobot_ADS1115.py
Sample Code
In the terminal, type the following commands in order, and press Enter:
cd ~/DFRobot_ADS1115/RaspberryPi/Python/ADS1115_ReadVoltage
sudo python ADS1115_ReadVoltage.py
Result
Was this article helpful?

