adafruit_adt7410
CircuitPython driver for reading temperature from the Analog Devices ADT7410 precision temperature sensor
Author(s): ladyada, Jose David M.
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
Interface to the Analog Devices ADT7410 temperature sensor.
Quickstart: Importing and using the ADT7410 temperature sensor
Here is an example of using the
ADT7410
class. First you will need to import the libraries to use the sensorimport board import adafruit_adt7410Once this is done you can define your
board.I2C
object 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
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)
Sensor comparator_mode
Mode
Value
adt7410.COMP_DISABLED
0b0
adt7410.COMP_ENABLED
0b1
Critical temperature limit value in Celsius When the temperature goes above the critical_temperature
, and if comparator_mode
is selected. The alert_status
critical_alert clears to 0 when the status register is read and/or when the temperature measured goes back below the limit set in critical_temperature
+ hysteresis_temperature
The INT pin is activated if a critical over temperature event occur The default setting is 147°C
Whether the device is currently configured for high resolution mode.
High temperature limit value in Celsius When the temperature goes above the high_temperature
, and if comparator_mode
is selected. The alert_status
high_alert clears to 0 when the status register is read and/or when the temperature measured goes back below the limit set in the setpoint high_temperature
+ hysteresis_temperature
The INT pin is activated if an over temperature event occur The default setting is 64°C
Hysteresis temperature limit value in Celsius for the critical_temperature
, high_temperature
and low_temperature
limits
Low temperature limit value in Celsius. When the temperature goes below the low_temperature
, and if comparator_mode
is selected. The alert_status
low_alert clears to 0 when the status register is read and/or when the temperature measured goes back above the limit set in the setpoint low_temperature
+ hysteresis_temperature
The INT pin is activated if an under temperature event occur The default setting is 10°C
Sensor operation_mode
Continuous ModeIn continuous conversion mode, the read operation provides the most recent converted result.
One Shot ModeWhen 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 ModeIn 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 ModeThe 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.CONTINUOUS
0b00
adt7410.ONE_SHOT
0b01
adt7410.SPS
0b10
adt7410.SHUTDOWN
0b11
Sensor resolution_mode
Mode
Value
adt7410.LOW_RESOLUTION
0b0
adt7410.HIGH_RESOLUTION
0b1
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_temp
limit, the CT pin is activated.
Alias for field number 2
Alias for field number 0
Alias for field number 1
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4