Adafruit Example Code For ADS1115

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
bcochran1
 
Posts: 497
Joined: Mon Jan 21, 2013 10:46 pm

Adafruit Example Code For ADS1115

Post by bcochran1 »

I downloaded the Adafruit-Raspberry-Pi-Python-Code library from your github repository with the intention of using it on my newly arrived ADS1115 breakout board. I have the board connected to my Raspberry Pi Model B using the Pi T-Cobbler breakout board. I notice that python module ads1015_example.py defaults to initializing for the ADS1015 breakout board so I copied this to a new module I call ads1115_example.py. I want to initialize the ADS1115 board properly. Is this code:

Code: Select all

# Initialise the ADC using the default mode (IC = ADS1115)
adc = ADS1x15(ic=0x01)
the correct way to set up an ADS1115 chip and run the example?

Thanks

Bob

[/color][/size]

User avatar
ashurbr
 
Posts: 28
Joined: Fri Jun 29, 2012 3:14 pm

Re: Adafruit Example Code For ADS1115

Post by ashurbr »

Greetings,

I have some of these modules also. And I started with the Adafruit example Python code. You will need to make several modifications to the example script and the backend script. You will need to read the TI literature on the ADS1115 that Adafruit has linked in the tutorial. Another thing that took me a while to catch is that the conversion from integer to volts is not 3 mV / bit. It is 0.1875 mV / bit when the full scale is 6.144V (16 bit converter vs 12 bit converter). It also clips at negative voltages, although the chip will read correctly small negative voltages. Just wrap the integer by subtracting 0xFFF.

Code: Select all

   
 tempval = (result[0] << 8) | (result[1])
    if tempval > 0x7FFF:
      return tempval - 0xFFFF
    else:
      return (result[0] << 8) | (result[1])

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: Adafruit Example Code For ADS1115

Post by ktownsend »

Thanks for the heads up. I just pushed a quick update that should support either the 1015 or 1115 for single-ended readings now.

Kevin

User avatar
michelv
 
Posts: 11
Joined: Thu Oct 17, 2013 5:13 am

Re: Adafruit Example Code For ADS1115

Post by michelv »

Hey,

Will the erronous multiplier be corrected in the example code for Arduino as well? Cost me a while to find this post (so not *3, but * 0.1875) in the differential example.

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: Adafruit Example Code For ADS1115

Post by ktownsend »

MichelV wrote:Hey,

Will the erronous multiplier be corrected in the example code for Arduino as well? Cost me a while to find this post (so not *3, but * 0.1875) in the differential example.
This should be a bit clearer in the latest code, where a bit more information was added into the example sketches.

You'll always have to set the multiplier yourself, though, since only you know what board you're using and what your gain settings are, but we've added the 16-bit multipliers into the example code as well as a reference.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”