API Reference
adafruit_adt7410
CircuitPython driver for reading temperature from the Analog Devices ADT7410 precision temperature sensor
Author(s): ladyada, Jose David M.
Implementation Notes
Hardware:
Adafruit ADT7410 analog temperature Sensor Breakout (Product ID: 4089)
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
Adafruit’s Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
- class adafruit_adt7410.ADT7410(i2c_bus: I2C, address: int = 72)
Interface to the Analog Devices ADT7410 temperature sensor.
- Parameters:
Quickstart: Importing and using the ADT7410 temperature sensor
Here is an example of using the
ADT7410class. First you will need to import the libraries to use the sensorimport board import adafruit_adt7410
Once this is done you can define your
board.I2Cobject and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA adt = adafruit_adt7410.ADT7410(i2c_bus, address=0x48)
Now you have access to the temperature using
temperature.temperature = adt.temperature
- property alert_status
The current triggered status of the high and low temperature alerts as a AlertStatus named tuple with attributes for the triggered status of each alert.
import time import board import adt7410 i2c = board.I2C() # uses board.SCL and board.SDA adt = adt7410.ADT7410(i2c) tmp.low_temperature = 20 tmp.high_temperature = 23 tmp.critical_temperature = 30 print("High limit: {}".format(tmp.high_temperature)) print("Low limit: {}".format(tmp.low_temperature)) print("Critical limit: {}".format(tmp.critical_temperature)) adt.comparator_mode = adt7410.COMP_ENABLED while True: print("Temperature: {:.2f}C".format(adt.temperature)) alert_status = tmp.alert_status if alert_status.high_alert: print("Temperature above high set limit!") if alert_status.low_alert: print("Temperature below low set limit!") if alert_status.critical_alert: print("Temperature above critical set limit!") time.sleep(1)
- property comparator_mode: str
Sensor comparator_mode
Mode
Value
adt7410.COMP_DISABLED0b0adt7410.COMP_ENABLED0b1
- property critical_temperature: float
Critical temperature limit value in Celsius When the temperature goes above the
critical_temperature, and ifcomparator_modeis selected. Thealert_statuscritical_alert clears to 0 when the status register is read and/or when the temperature measured goes back below the limit set incritical_temperature+hysteresis_temperatureThe INT pin is activated if a critical over temperature event occur The default setting is 147°C
- property high_resolution: bool
Whether the device is currently configured for high resolution mode.
- property high_temperature: float
High temperature limit value in Celsius When the temperature goes above the
high_temperature, and ifcomparator_modeis selected. Thealert_statushigh_alert clears to 0 when the status register is read and/or when the temperature measured goes back below the limit set in the setpointhigh_temperature+hysteresis_temperatureThe INT pin is activated if an over temperature event occur The default setting is 64°C
- property hysteresis_temperature: float
Hysteresis temperature limit value in Celsius for the
critical_temperature,high_temperatureandlow_temperaturelimits
- property low_temperature: float
Low temperature limit value in Celsius. When the temperature goes below the
low_temperature, and ifcomparator_modeis selected. Thealert_statuslow_alert clears to 0 when the status register is read and/or when the temperature measured goes back above the limit set in the setpointlow_temperature+hysteresis_temperatureThe INT pin is activated if an under temperature event occur The default setting is 10°C
- property operation_mode: str
Sensor operation_mode
Continuous Mode
In continuous conversion mode, the read operation provides the most recent converted result.
One Shot Mode
When one-shot mode is enabled, the ADT7410 immediately completes a conversion and then goes into shutdown mode. The one-shot mode is useful when one of the circuit design priorities is to reduce power consumption.
SPS Mode
In this mode, the part performs one measurement per second. A conversion takes only 60 ms, and it remains in the idle state for the remaining 940 ms period
Shutdown Mode
The ADT7410 can be placed in shutdown mode, the entire IC is shut down and no further conversions are initiated until the ADT7410 is taken out of shutdown mode. The conversion result from the last conversion prior to shutdown can still be read from the ADT7410 even when it is in shutdown mode. When the part is taken out of shutdown mode, the internal clock is started and a conversion is initiated
Mode
Value
adt7410.CONTINUOUS0b00adt7410.ONE_SHOT0b01adt7410.SPS0b10adt7410.SHUTDOWN0b11
- property resolution_mode: str
Sensor resolution_mode
Mode
Value
adt7410.LOW_RESOLUTION0b0adt7410.HIGH_RESOLUTION0b1
- property temperature: float
Temperature in Celsius In normal mode, the ADT7410 runs an automatic conversion sequence. During this automatic conversion sequence, a conversion takes 240 ms to complete and the ADT7410 is continuously converting. This means that as soon as one temperature conversion is completed, another temperature conversion begins. On power-up, the first conversion is a fast conversion, taking typically 6 ms. Fast conversion temperature accuracy is typically within ±5°C. The measured temperature value is compared with a critical temperature limit, a high temperature limit, and a low temperature limit. If the measured value exceeds these limits, the INT pin is activated; and if it exceeds the
critical_templimit, the CT pin is activated.