Skip to content

example showing using gain capability #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ladyada opened this issue Jan 30, 2019 · 2 comments
Closed

example showing using gain capability #23

ladyada opened this issue Jan 30, 2019 · 2 comments
Assignees

Comments

@ladyada
Copy link
Member

ladyada commented Jan 30, 2019

we got a bunch o requests to add a gain demo to https://learn.adafruit.com/adafruit-4-channel-adc-breakouts/python-circuitpython

no rush but it is kinda a neat thing this chip can do :) the demo can just be a resistor divider with 1K and 100K ohm resistors. the voltage should end up being the same but the value will be different

@caternuson
Copy link
Contributor

Use the 1k/100k with a pot for a variable voltage divider? So two setups - one with 1k, one with 100k. Ex with 100k:
feather m0 with ads1115_bb
Wired this up with an Itsy M4 and ADS1015, but same general idea:

Adafruit CircuitPython 3.1.2 on 2019-01-07; Adafruit ItsyBitsy M4 Express with samd51g19
>>> import board, 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)
>>> chan = AnalogIn(ads, ADS.P0)
>>> ads.gain
1
>>> chan.value, chan.voltage
(84, 0.168082)
>>> ads.gain = 16
>>> ads.gain
16
>>> chan.value, chan.voltage
(1335, 0.167081)
>>>

@ladyada
Copy link
Member Author

ladyada commented Jan 30, 2019

exactly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants