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
- Adafruit’s Bus Device library:
- Adafruit’s Register library:
-
class
adafruit_tla202x.CV¶ struct helper
-
classmethod
add_values(value_tuples)¶ creates CV entires
-
classmethod
is_valid(value)¶ Returns true if the given value is a member of the CV
-
classmethod
-
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_128SPS128 Samples per second Rate.RATE_250SPS250 Samples per second Rate.RATE_490SPS490 Samples per second Rate.RATE_920SPS920 Samples per second Rate.RATE_1600SPS1600 Samples per second Rate.RATE_2400SPS2400 Samples per second Rate.RATE_3300SPS3300 Samples per second
-
class
adafruit_tla202x.Mode¶ Options for
modeMode Description Mode.CONTINUOUSIn Continuous mode, measurements are taken
continuously and getting
voltagewill return the latest measurement.
Mode.ONE_SHOTSetting the mode to
ONE_SHOTtakes a singlemeasurement and then goes into a low power state.
-
class
adafruit_tla202x.Mux¶ Options for
muxto choose the inputs that voltage will be measured acrossMux Positive Pin Negative Pin Mux.MUX_AIN0_AIN1AIN 0 AIN 1 Mux.MUX_AIN0_AIN3AIN 0 AIN 3 Mux.MUX_AIN1_AIN3AIN 1 AIN 3 Mux.MUX_AIN2_AIN3AIN 2 AIN 3 Mux.MUX_AIN0_GNDAIN 0 GND Mux.MUX_AIN1_GNDAIN 1 GND Mux.MUX_AIN2_GNDAIN 2 GND Mux.MUX_AIN3_GNDAIN 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, address=72)¶ I2C Interface for analog voltage measurements using the TI TLA2024 12-bit 4-channel ADC
param i2c_bus: The I2C bus that the ADC is on. param int address: The I2C address for the ADC. Defaults to ~0x48 -
data_rate¶ selects the rate at which measurement samples are taken. Must be a
DataRate. See the documentation forDataRatefor more information
-
input_channel¶ The channel to be sampled
-
mode¶ The measurement mode of the sensor. Must be a
Mode. See the documentation forModefor more information
-
mux¶ selects the inputs that voltage will be measured between. Must be a
Mux. See theMuxdocumentation for more information about the available options
-
range¶ The measurement range of the ADC, changed by adjusting the Programmable Gain Amplifier
rangemust be aRange. See the documentation forRangefor more information
-
read(channel)¶ Switch to the given channel and take a single ADC reading in One Shot mode
Parameters: channel – The channel number to switch to, from 0-3
-
voltage¶ The voltage between the two selected inputs
-
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.
-
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
TLA2024constructor
-
value¶ Returns the value of an ADC channel. The value is scaled to a 16-bit integer from the native 12-bit value.
-
voltage¶ Returns the value of an ADC channel in volts as compared to the reference voltage.