1.. _thermometer-sample:
2
3Thermometer sample
4##################
5
6Overview
7********
8
9This sample application periodically measures the ambient temperature
10at 1Hz. The result is written to the console.
11
12Wiring
13*******
14
15VDD pin should be connected to 2.3V to 5.5V
16GND pin connected to 0V
17VOUT pin connected to the ADC input pin.
18
19.. _`MCP970X Sensor`: http://ww1.microchip.com/downloads/en/devicedoc/20001942g.pdf
20
21An overlay is provided for the nrf52840dk_nrf52840 board with the
22sensor connected to pin AIN7.
23
24Building and Running
25********************
26
27To build for the nrf52840dk_nrf52840 board use:
28
29.. zephyr-app-commands::
30	:zephyr-app: samples/sensor/thermometer
31	:board: nrf52840dk_nrf52840
32	:goals: build flash
33	:compact:
34
35
36To build for other boards and ambient temperature sensors, enable the sensor
37node that supports ``SENSOR_CHAN_AMBIENT_TEMP`` and use an overlay to create an
38alias named ``ambient-temp0`` to link to the node.  See the overlay used for the
39``nrf52840dk_nrf52840`` board within this sample:
40``boards/nrf52840dk_nrf52840.overlay``
41
42
43Temperature Alert
44=================
45
46If the attached sensor supports alerts when the temperature drifts above or
47below a threshold, the sample will enable the sensor's trigger functionality.
48This will require the sensor's TRIGGER KConfig setting to be enabled. An
49example of this setup is provided for the ``frdm_k22f`` board, using
50``boards/frdm_k22f.conf``.
51
52Sample Output
53=============
54
55.. code-block:: console
56
57        *** Booting Zephyr OS build zephyr-v3.3.0-2354-gb4f4bd1f1c22 ***
58        Thermometer Example (arm)
59        Temperature device is 0x525c, name is tcn75a@48
60        Set temperature lower limit to 25.5°C
61        Set temperature upper limit to 26.5°C
62        Enabled sensor threshold triggers
63        Temperature is 25.0°C
64        Temperature is 25.0°C
65        Temperature is 25.0°C
66        Temperature is 25.0°C
67        Temperature is 25.5°C
68        Temperature above threshold: 26.5°C
69        Temperature is 26.5°C
70