Home Circuitpython Adafruit Feather M0 and ADS1015 analog-to-digital converters circuitpython example

Adafruit Feather M0 and ADS1015 analog-to-digital converters circuitpython example

by shedboy71

In this example we connect a ADS1015 analog-to-digital converters to an Adafruit Feather M0 running Circuitpython

First lets look at some information about the sensor from the manufacturer


The ADS1015 devices is a precision, low-power, 12-bit, I2C-compatible, analog-to-digital converters (ADCs). The ADS101x devices incorporate a low-drift voltage reference and an oscillator. The ADS1015 also incorporate a programmable gain amplifier (PGA) and a digital comparator. These features, along with a wide operating supply range, make the ADS101x well suited for power- and space-constrained, sensor measurement applications.

The ADS101x perform conversions at data rates up to 3300 samples per second (SPS). The PGA offers input ranges from ±256 mV to ±6.144 V, allowing precise large- and small-signal measurements. The ADS1015 features an input multiplexer (MUX) that allows two differential or four single-ended input measurements. Use the digital comparator in the ADS1014 and ADS1015 for under- and overvoltage detection.

The ADS101x operate in either continuous-conversion mode or single-shot mode. The devices are automatically powered down after one conversion in single-shot mode; therefore, power consumption is significantly reduced during idle periods


12-Bit Noise-Free Resolution
Wide Supply Range: 2.0 V to 5.5 V
Low Current Consumption: 150 µA (Continuous-Conversion Mode)
Programmable Data Rate: 128 SPS to 3.3 kSPS
Single-Cycle Settling
Internal Low-Drift Voltage Reference
Internal Oscillator
I2C Interface: Four Pin-Selectable Addresses
Four Single-Ended or Two Differential Inputs (ADS1015)
Programmable Comparator (ADS1014 and ADS1015)
Operating Temperature Range: –40°C to +125°C

This is the sensor I bought

Parts Required


Name Link
Adafruit Feather M0 Express Adafruit (PID 3403) Feather M0 Express – Designed for CircuitPython – ATSAMD21 Cortex M0
ADS1015 CJMCU-ADS1015 Subminiature 12 Bit Precision Analog To Digital Converter ADC Development Board
Connecting cables Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire



feather and ADS1015 layout

feather and ADS1015 layout

Code Example

I used Mu for development

The following is based on a library , I copied the adafruit_ads1x15 folder which contains a library for this device to the lib folder on my Feather M0 Express – https://circuitpython.org/libraries

[codesyntax lang=”python”]

import time
import board
import busio
import adafruit_ads1x15.ads1015 as ADS
from adafruit_ads1x15.analog_in import AnalogIn

# Create the I2C bus
i2c = busio.I2C(board.SCL, board.SDA)

# Create the ADC object using the I2C bus
ads = ADS.ADS1015(i2c)

# Create single-ended input on channel 0
chan0 = AnalogIn(ads, ADS.P0)
chan1 = AnalogIn(ads, ADS.P1)
chan2 = AnalogIn(ads, ADS.P2)
chan3 = AnalogIn(ads, ADS.P3)
# Create differential input between channel 0 and 1
# chan = AnalogIn(ads, ADS.P0, ADS.P1)

print("{:>15}\t{:>2}".format("raw", "v"))

while True:
    print("Channel 0 : {:>5}\t{:>5.3f}".format(chan0.value, chan0.voltage))
    print("Channel 1 : {:>5}\t{:>5.3f}".format(chan1.value, chan1.voltage))
    print("Channel 2 : {:>5}\t{:>5.3f}".format(chan2.value, chan3.voltage))
    print("Channel 3 : {:>5}\t{:>5.3f}".format(chan3.value, chan3.voltage))



Here is what I saw in Mu REPL window

Channel 0 : 26464 3.308
Channel 1 : 4880 0.616
Channel 2 : 4640 0.578
Channel 3 : 4992 0.620
Channel 0 : 26464 3.308
Channel 1 : 4784 0.618
Channel 2 : 4688 0.580
Channel 3 : 4912 0.626
Channel 0 : 26464 3.308
Channel 1 : 4816 0.618
Channel 2 : 4704 0.582
Channel 3 : 4896 0.622



You may also like

Leave a Comment