adafruit_tla202x
¶
Library for the TI TLA202x 12-bit ADCs
Author(s): Bryan Siepert
Implementation Notes¶
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- class adafruit_tla202x.CV¶
struct helper
- class adafruit_tla202x.DataRate¶
Options for
data_rate
, to select the rate at which samples are taken while measuring the voltage across the input pinsRate
Measurement Rate
Rate.RATE_128SPS
128 Samples per second
Rate.RATE_250SPS
250 Samples per second
Rate.RATE_490SPS
490 Samples per second
Rate.RATE_920SPS
920 Samples per second
Rate.RATE_1600SPS
1600 Samples per second
Rate.RATE_2400SPS
2400 Samples per second
Rate.RATE_3300SPS
3300 Samples per second
- class adafruit_tla202x.Mode¶
Options for
mode
Mode
Description
Mode.CONTINUOUS
In Continuous mode, measurements are taken
continuously and getting
voltage
will return the latest measurement.
Mode.ONE_SHOT
Setting the mode to
ONE_SHOT
takes a singlemeasurement and then goes into a low power state.
- class adafruit_tla202x.Mux¶
Options for
mux
to choose the inputs that voltage will be measured acrossMux
Positive Pin
Negative Pin
Mux.MUX_AIN0_AIN1
AIN 0
AIN 1
Mux.MUX_AIN0_AIN3
AIN 0
AIN 3
Mux.MUX_AIN1_AIN3
AIN 1
AIN 3
Mux.MUX_AIN2_AIN3
AIN 2
AIN 3
Mux.MUX_AIN0_GND
AIN 0
GND
Mux.MUX_AIN1_GND
AIN 1
GND
Mux.MUX_AIN2_GND
AIN 2
GND
Mux.MUX_AIN3_GND
AIN 3
GND
- class adafruit_tla202x.Range¶
Options for
range
, used to select the measurement range by adjusting the gain of the internal amplifierRange
Measurement Range
Resolution
Range.RANGE_6_144V
±6.144 V
3 mV
Range.RANGE_4_096V
±4.096 V
2 mV
Range.RANGE_2_048V
±2.048 V
1 mV
Range.RANGE_1_024V
±1.024 V
0.5 mV
Range.RANGE_0_512V
±0.512 V
0.25 mV
- class adafruit_tla202x.TLA2024(i2c_bus: I2C, address: int = 72)¶
I2C Interface for analog voltage measurements using the TI TLA2024 12-bit 4-channel ADC
- param ~I2C i2c_bus:
The I2C bus that the ADC is on.
- param int address:
The I2C address for the ADC. Defaults to ~0x48
- property data_rate: int¶
Selects the rate at which measurement samples are taken. Must be a
DataRate
. See the documentation forDataRate
for more information
- property input_channel: int¶
The input channel number (0-4) to measure the voltage at, referenced to GND.
- property mode: int¶
The measurement mode of the sensor. Must be a
Mode
. See the documentation forMode
for more information
- property mux: int¶
selects the inputs that voltage will be measured between. Must be a
Mux
. See theMux
documentation for more information about the available options
- property range: int¶
The measurement range of the ADC, changed by adjusting the Programmable Gain Amplifier
range
must be aRange
. See the documentation forRange
for more information
analog_in
¶
AnalogIn for ADC readings.
Author(s): Bryan Siepert
- class adafruit_tla202x.analog_in.AnalogIn(tla, pin)¶
AnalogIn Mock Implementation for ADC Reads.
- Parameters:
tla – The TLA202x object.
pin (DigitalInOut) – Required ADC channel pin.
- deinit()¶
Release the reference to the TLA202x. Create a new AnalogIn to use it again.
- property reference_voltage¶
The maximum voltage measurable (also known as the reference voltage) as a float in Volts. Assumed to be 3.3V but can be overridden using the
TLA2024
constructor
- property value¶
Returns the value of an ADC channel. The value is scaled to a 16-bit integer from the native 12-bit value.
- property voltage¶
Returns the value of an ADC channel in volts as compared to the reference voltage.