samples/sensor/mcp9808/README.html · samples/sensor/mcp9808/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Samples · Sensor · Temperature

MCP9808 temperature sensor

0.5 Hz 측정과 현재 온도 중심 alert window를 I2C·GPIO overlay로 실행합니다.

Official pathsamples/sensor/mcp9808/README.html
Source filesamples/sensor/mcp9808/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

측정 범위·정확도·16-device I2C와 interleaved output을 설명합니다.

Range

-20°C to +100°C

Accuracy

±0.5°C max

Trigger

±2°C window

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 C91D54C21B3C4EB6A2509D5D749256BECAE439D0EE18AD75444A5704CC954FA7
.. _mcp9808-sample:

MCP9808 Temperature Sensor
##########################

Overview
********

This sample application periodically (0.5 Hz) measures the ambient
temperature. The result is written to the console.

If triggered measurements are enabled the sample initializes and
maintains a |plusminus| 2 |deg| C window around the current temperature.
When the temperature moves outside the window an alert is given, and the
window is moved to center on the new temperature.

Requirements
************

The MCP9808 digital temperature sensor converts temperatures between -20 |deg|
C and +100 |deg| C to a digital word with |plusminus| 0.5 |deg| C (max.)
accuracy. It is I2C compatible and supports up to 16 devices on the bus.

Wiring
*******

The MCP9808 is available in a discrete component form but it is much easier to
use it mounted on a breakout board.  We used the Adafruit `MCP9808
Sensor`_ breakout board.

.. _`MCP9808 Sensor`: https://www.adafruit.com/product/1782

Building and Running
********************

After providing a devicetree overlay that specifies the sensor I2C bus
and alert GPIO, build this sample app using:

.. zephyr-app-commands::
   :zephyr-app: samples/sensor/mcp9808
   :board: particle_xenon
   :goals: build flash

Sample Output
=============

Note that in the capture below output from the trigger callback and the
main thread are interleaved.

.. code-block:: console

   *** Booting Zephyr OS build zephyr-v2.1.0-537-gbbdeaa1ae5bb  ***
   Alert on temp outside [24500, 25500] milli-Celsius
   Trtrigger fired 1, temp 15.9375 C
   iggAlert on temp outside [15437, 16437] milli-Celsius
   er set got 0
   0:00:00.017: 15.9375 C
   0:00:02.020: 16 C
   0:00:04.022: 16.125 C
   0:00:06.024: 16.1875 C
   trigger fired 2, temp 16.3125 C
   Alert on temp outside [15812, 16812] milli-Celsius
   0:00:08.027: 16.3125 C
   0:00:10.029: 16.375 C
   0:00:12.032: 16.5 C
   0:00:14.034: 16.5625 C
   0:00:16.037: 16.5625 C
   0:00:18.039: 16.625 C
   0:00:20.042: 16.6875 C
   trigger fired 3, temp 16.8125 C
   Alert on temp outside [16312, 17312] milli-Celsius
   0:00:22.044: 16.8125 C
   0:00:24.047: 16.875 C

Part 3

한국어 전문 번역

개요

이 sample application은 ambient temperature를 0.5 Hz로 주기적으로 측정하고 결과를 console에 기록합니다.

Triggered measurement를 활성화하면 sample은 현재 temperature를 중심으로 ±2°C window를 초기화하고 유지합니다. Temperature가 window 밖으로 이동하면 alert를 발생시키고, 새 temperature를 중심으로 window를 옮깁니다.

요구 사항

MCP9808 digital temperature sensor는 -20°C에서 +100°C 사이의 temperature를 최대 ±0.5°C 정확도의 digital word로 변환합니다. I2C와 호환되며 bus 하나에서 최대 16개 device를 지원합니다.

배선

MCP9808은 discrete component로도 구할 수 있지만 breakout board에 장착된 제품이 훨씬 사용하기 쉽습니다. 이 sample에서는 Adafruit MCP9808 Sensor breakout board를 사용했습니다.

빌드 및 실행

Sensor I2C bus와 alert GPIO를 지정하는 Devicetree overlay를 제공한 뒤 다음 명령으로 sample application을 build하고 flash합니다.

# From the root of the zephyr repository
west build -b particle_xenon samples/sensor/mcp9808
west flash

출력 예

아래 capture에서는 trigger callback과 main thread의 출력이 서로 끼어들어 있습니다. 따라서 Trtrigger, iggAlert, er set처럼 나뉜 문자열은 원문 출력 자체의 interleaving이며 그대로 보존합니다.

*** Booting Zephyr OS build zephyr-v2.1.0-537-gbbdeaa1ae5bb  ***
Alert on temp outside [24500, 25500] milli-Celsius
Trtrigger fired 1, temp 15.9375 C
iggAlert on temp outside [15437, 16437] milli-Celsius
er set got 0
0:00:00.017: 15.9375 C
0:00:02.020: 16 C
0:00:04.022: 16.125 C
0:00:06.024: 16.1875 C
trigger fired 2, temp 16.3125 C
Alert on temp outside [15812, 16812] milli-Celsius
0:00:08.027: 16.3125 C
0:00:10.029: 16.375 C
0:00:12.032: 16.5 C
0:00:14.034: 16.5625 C
0:00:16.037: 16.5625 C
0:00:18.039: 16.625 C
0:00:20.042: 16.6875 C
trigger fired 3, temp 16.8125 C
Alert on temp outside [16312, 17312] milli-Celsius
0:00:22.044: 16.8125 C
0:00:24.047: 16.875 C

2초 간격의 main-thread 측정 사이에 temperature가 ±0.5°C alert window를 벗어나면 trigger count와 새 milli-Celsius 경계를 출력합니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.