2018-07-12 15:17:23 +08:00
|
|
|
.. _adt7420:
|
|
|
|
|
|
|
|
ADT7420: High accuracy digital I2C temperature sensor
|
|
|
|
#####################################################
|
|
|
|
|
|
|
|
Description
|
|
|
|
***********
|
|
|
|
|
|
|
|
This sample application periodically (1Hz) measures the ambient temperature
|
|
|
|
in degrees Celsius. The result is written to the console.
|
2019-12-21 23:26:36 +08:00
|
|
|
|
|
|
|
When configured in trigger mode the update interval is 5 s, and the
|
|
|
|
sample maintains a |plusminus| 1 |deg| C window around a recent
|
|
|
|
temperature. As soon as the temperature goes outside the window an
|
|
|
|
interrupt causes the application to display an event and update the
|
|
|
|
upper and lower window boundaries.
|
2018-07-12 15:17:23 +08:00
|
|
|
|
|
|
|
References
|
|
|
|
**********
|
|
|
|
|
|
|
|
- ADT7420: http://www.analog.com/adt7420
|
|
|
|
|
|
|
|
Wiring
|
|
|
|
*******
|
|
|
|
|
|
|
|
This sample uses the ADT7420 sensor controlled using the I2C interface.
|
|
|
|
Connect Supply: **VDD**, **GND** and Interface: **SDA**, **SCL**
|
|
|
|
and optionally connect the **INT** to a interrupt capable GPIO.
|
|
|
|
The supply voltage can be in the 2.7V to 5.5V range.
|
|
|
|
Depending on the baseboard used, the **SDA** and **SCL** lines require Pull-Up
|
|
|
|
resistors.
|
|
|
|
|
|
|
|
Building and Running
|
|
|
|
********************
|
|
|
|
|
|
|
|
This project outputs sensor data to the console. It requires an ADT7420
|
|
|
|
sensor. It should work with any platform featuring a I2C peripheral interface.
|
|
|
|
It does not work on QEMU.
|
2020-04-03 00:24:56 +08:00
|
|
|
In this example below the :ref:`nrf52dk_nrf52832` board is used.
|
2018-07-12 15:17:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
.. zephyr-app-commands::
|
2019-10-08 01:12:11 +08:00
|
|
|
:zephyr-app: samples/sensor/adt7420
|
2020-04-03 00:24:56 +08:00
|
|
|
:board: nrf52dk_nrf52832
|
2018-07-12 15:17:23 +08:00
|
|
|
:goals: build flash
|
|
|
|
|
|
|
|
Sample Output
|
|
|
|
=============
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2019-12-21 23:26:36 +08:00
|
|
|
*** Booting Zephyr OS build zephyr-v2.1.0-538-g12b2ed2cf7c3 ***
|
|
|
|
device is 0x2000101c, name is ADT7420
|
|
|
|
[0:00:00.011]: temperature 21.203125 Cel
|
|
|
|
[0:00:01.015]: temperature 21.171875 Cel
|
|
|
|
[0:00:02.019]: temperature 21.171875 Cel
|
|
|
|
[0:00:03.023]: temperature 21.187500 Cel
|
|
|
|
[0:00:04.027]: temperature 21.140625 Cel
|
2018-07-12 15:17:23 +08:00
|
|
|
|
|
|
|
<repeats endlessly>
|