The ADS1015 is a +/- 24V Analog Digital Converter implemented by Pimoroni as a Breakout Garden board,
i.e., an [I2C] compatible breakout board. TIt has three channels that can read voltages from -24V to
+24V at sampling rates up to 3.3KHz with 12-bit resolution.
!!! Features
* 12-bit precision
* +/- 24V (DC) measurement range
* Three channels
* Programmable gain
* Up to 3.3KHz sampling rate
* I2C interface (address 0x48/0x49 (cut trace))
* 3.3V or 5V compatible
* Reverse polarity protection
* Compatible with all models of Raspberry Pi, and Arduino
* [ads1015-python library | https://github.com/pimoroni/ads1015-python] on github
* ADS1015 ADC ([original TI datasheet|http://www.ti.com/lit/ds/symlink/ads1015.pdf])
!! Installation
You'll need [Python] and {{{pip}}} (or {{{pip3}}} for Python 3) already installed.
If you're using Python 2, just run:
{{{
sudo pip install ads1015
}}}
For Python 3, use:
{{{
sudo pip3 install ads1015
}}}
!! Example Usage
The board has three input pins, labeled {{{A0}}}, {{{A1}}} and {{{A2}}}. Plugging a signal into {{{A0}}},
here's an example of some code to repeatedly read the voltage on the pin until you type {{{Ctrl-C}}}:
{{{
#!/usr/bin/env python3
import time
from ads1015 import ADS1015
print('''read-all.py - read the A0 input of the ADC.
Press Ctrl+C to exit!
''')
CHANNEL = 'in0/ref'
ads1015 = ADS1015()
ads1015.set_mode('single')
ads1015.set_programmable_gain(2.048)
ads1015.set_sample_rate(1600)
reference = ads1015.get_reference_voltage()
print("Reference voltage: {:6.3f}v \n".format(reference))
try:
while True:
value = ads1015.get_compensated_voltage(channel=CHANNEL, reference_voltage=reference)
print("A0 value: {:6.3f}v".format(value))
time.sleep(0.5)
except KeyboardInterrupt:
pass
}}}
!! References
* [!!! ADS1015 +/-24V ADC breakout|https://shop.pimoroni.com/products/ads1015-adc-breakout] product page
----
[{Tag Sensor}]