Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Help with ADC1015 gain values
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Help with ADC1015 gain values

by busterbot on Sat Jun 20, 2020 12:09 pm

Hi, I tried following the example for the ADC1015 i2c ADC breakout board but I'm a little lost with the gain setting.
https://learn.adafruit.com/adafruit-4-channel-adc-breakouts/python-circuitpython Bottom of the page.

The article says changing the gain will not change the output voltage calculation, but that's not what I am seeing when I follow the example, not sure what I'm doing wrong. I'm using a Raspberry Pi Zero and have input 1 tied to Vdd which is powered from the 3.3v pin on the Pi.

Code: Select all | TOGGLE FULL SIZE
import board
import busio
import adafruit_ads1x15.ads1015 as ADS
from adafruit_ads1x15.analog_in import AnalogIn

i2c = busio.I2C(board.SCL, board.SDA)
ads = ADS.ADS1015(i2c)
ads.gain = 1
chan = AnalogIn(ads, ADS.P1)

print(chan.value, chan.voltage)

ads.gain = 16
print(chan.value, chan.voltage)

When I run this I get this output:
Code: Select all | TOGGLE FULL SIZE
26496 3.3121010773033848
32752 0.2558828089236122

I was expecting the second at gain 16 to still show around the 3.3 level like it does in the example.

busterbot
 
Posts: 1
Joined: Sat Jun 20, 2020 11:29 am

Re: Help with ADC1015 gain values

by adafruit_support_carter on Mon Jun 22, 2020 2:05 pm

The gain setting also affects the full scale range for the ADC. See table 3 in the datasheet:
https://cdn-shop.adafruit.com/datasheets/ads1015.pdf
adc_range.jpg
adc_range.jpg (15.21 KiB) Viewed 34 times


So at 16x, the max is ~0.256V, which is what you are seeing the serial prints.

adafruit_support_carter
 
Posts: 17282
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.