Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
images changes to readme Dec 12, 2014
.dockerignore print all 4 channels values to logs Dec 12, 2014 initial commit Dec 12, 2014 added pip install smbus-cffi, added stuff Dec 12, 2014
Dockerfile updated wheezy base image Jan 14, 2015 print all 4 channels values to logs Dec 12, 2014 Update Dec 12, 2014

###Analog input for the raspberry pi using the ADS1x15

One of the most common things people want to do is read analog signals from their sensors using the raspberry pi. Unfortunately the pi doesn't have a native analog-to-digital converter (ADC). Luckily there is an awesome family of chips called the ADS1x15 that can help us get analog input using I2C protocol bus.

All the supporting libs for driving the I2C bus and the ADS1x15 board was borrowed from the Adafruit raspberry pi python repo link

##what you'll need

  1. raspberry pi with wifi or ethernet connection
  2. an ADS1015 (12-bit) or ADS1115 (16-bit) depending on what level of accuracy you are in the market for. Adafruit has a nice breakout board here
  3. a breadboard, a couple of pieces of wire
  4. you might also want a pi-cobbler, it makes connecting things to the pi way easier.
  5. and lastly any cool analog sensor you want to read from.

##wiring it all up

connect the pins up like this:

  • ADS1x15 VDD pin -> RPI 3v3 Power pin
  • ADS1x15 SCL pin -> RPI GPIO 1 (SCL)
  • DS1x15 SDA pin -> RPI GPIO 0 (SDA)
  • ADS1x15 ADDR pin -> any RPI GND pin
  • ADS1x15 GND -> any RPI GND pin

Connecting ADS1x15 Setup & Deployment

  1. If you haven't got a alpha account, visit and sign up.
  2. start a new applicaton on, name it something cool, download the .zip file and extract the contents of it to your SD card.
  3. Insert the SD card into the Raspberry pi, connect the ethernet cable and power it up using the micro-usb cable.
  4. After about 7 minutes your new device should show up on the applications dashboard and you are ready to start pushing code updates.
  5. if you haven't already, you can now clone this repository locally:

$ git clone

then add the resin remote: (replacing myUserName and myApplicationName with yours from the dashboard) note: avoid having to type this by simply clicking the little clipboard at the top right of the resin application dashboard.

$ git remote add resin<myUserName>/<myApplicationName>.git

and finally push the code to your raspberry pi:

$ git push resin master

After the push succeeds, you should see our friendly unicorn appear in your terminal. You will also see on the dashboard that your pi's have started downloading the new code.

Go check out the logs for your raspberry pi by clicking on one of your pis in the dashboard and then selecting the logs tab.

note: on first pushing this code to resin, you will get an error on the logs saying something like IOError: [Errno 2] No such file or directory The error will look like this: Circuit diagram

Don't worry, this is just because the modprobe to enable i2c has not loaded yet. You will need to go to your application dashboard on and restart the application, this is done in the actions tab for the application. Once the application restarts, you will see the ADC function as advertised.

When the app restarts, you will see meta logs and 4 voltage readings for your 4 channels on the ADS1x15 chip:

[system] Killing application
[system] Installing application
[system] Starting application
A0 = 3.293375 V
A1 = 0.000000 V
A2 = 3.293250 V
A3 = 0.000000 V

From here you should be able to do all kinds of cool things. Also be sure to check out the different modes and config for the ADS1x15 chip, it is possible to run it as a 2 channel differential ADC and in a comparator mode.

You can’t perform that action at this time.