아두이노 우노 Q 온도 센서 OLED

Arduino UNO Q와 OLED 화면에 실시간 온도를 표시하고 원격으로 Telegram 알림을 받고 싶으신가요? 이 튜토리얼은 DS18B20 센서를 128x64 SSD1306 OLED 디스플레이와 결합합니다.

이 튜토리얼에서 배울 내용:

Arduino UNO Q 온도 센서 oLED

필요한 하드웨어

1×Arduino UNO Q 아마존
1×USB Cable for Arduino Uno Q 아마존
1×SSD1306 I2C OLED 디스플레이 128x64 쿠팡 | 아마존
1×SSD1306 I2C OLED 디스플레이 128x32 아마존
1×DS18B20 온도 센서 (어댑터 포함) 쿠팡 | 아마존
1×DS18B20 온도 센서(어댑터 없음) 아마존
1×점퍼케이블 쿠팡 | 아마존
1×(추천) 아두이노 우노용 스크루 터미널 블록 쉴드 쿠팡 | 아마존
1×(추천) Sensors/Servo Expansion Shield for Arduino Uno 쿠팡 | 아마존
1×(추천) 아두이노 우노용 브레드보드 쉴드 쿠팡 | 아마존
1×(추천) 아두이노 우노용 케이스 쿠팡 | 아마존
1×(추천) 아두이노 우노용 프로토타이핑 베이스 플레이트 & 브레드보드 키트 아마존
공개: 이 포스팅 에 제공된 일부 링크는 아마존 제휴 링크입니다. 이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.

온도 센서 및 OLED 정보

DS18B20 센서 또는 SSD1306 OLED 디스플레이를 처음 사용하신다면 먼저 다음 튜토리얼을 확인하세요:

배선도

Arduino UNO Q 온도 센서 oLED 연결 배선도

이 이미지는 Fritzing을 사용하여 만들어졌습니다. 이미지를 확대하려면 클릭하세요.

배선 어댑터가 있는 DS18B20 센서 구입을 권장합니다. 어댑터에는 풀업 저항이 내장되어 있습니다.

DS18B20 연결:

DS18B20 Pin Arduino UNO Q MCU
GND GND
VCC 3.3V or 5V
DATA D4

OLED I2C 연결:

OLED Pin Arduino UNO Q MCU
VCC 3.3V or 5V
GND GND
SDA A4
SCL A5

Arduino UNO Q 코드

Arduino UNO Q는 함께 작동하는 두 프로세서를 가지고 있습니다:

  • STM32 MCU는 DS18B20 센서를 읽고 OLED 디스플레이를 직접 구동합니다
  • Qualcomm MPU는 Debian Linux를 실행하고 Wi-Fi, Python 및 클라우드 연결을 처리합니다
  • 이 섹션에서는 MCU만 프로그래밍됩니다 — Linux 측은 유휴 상태로 유지됩니다. 나중 섹션에서는 두 프로세서가 Bridge를 통해 함께 작동하는 방법을 보여줍니다.

MCU는 매초 온도를 읽고 OLED 중앙에 표시합니다.

/* * 이 Arduino UNO Q 코드는 newbiely.kr 에서 개발되었습니다 * 이 Arduino UNO Q 코드는 어떠한 제한 없이 공개 사용을 위해 제공됩니다. * 상세한 지침 및 연결도에 대해서는 다음을 방문하세요: * https://newbiely.kr/tutorials/arduino-uno-q/arduino-uno-q-temperature-sensor-oled */ #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #include <OneWire.h> #include <DallasTemperature.h> #define OLED_WIDTH 128 #define OLED_HEIGHT 64 #define SENSOR_PIN 4 // Arduino UNO Q MCU pin connected to DS18B20 DATA pin Adafruit_SSD1306 oled(OLED_WIDTH, OLED_HEIGHT, &Wire, -1); OneWire oneWire(SENSOR_PIN); DallasTemperature DS18B20(&oneWire); void oled_display_center(String text) { int16_t x1, y1; uint16_t width, height; oled.getTextBounds(text, 0, 0, &x1, &y1, &width, &height); oled.clearDisplay(); oled.setCursor((OLED_WIDTH - width) / 2, (OLED_HEIGHT - height) / 2); oled.println(text); oled.display(); } void setup() { Serial.begin(115200); delay(1500); if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { Serial.println("SSD1306 allocation failed"); while (true); } oled.clearDisplay(); oled.setTextSize(2); oled.setTextColor(WHITE); DS18B20.begin(); Serial.println("Arduino UNO Q Temperature Sensor + OLED ready"); } void loop() { DS18B20.requestTemperatures(); float temperature_C = DS18B20.getTempCByIndex(0); float temperature_F = temperature_C * 9.0 / 5.0 + 32.0; String display_str = String(temperature_C, 1) + char(247) + "C"; oled_display_center(display_str); Serial.print("Temperature: "); Serial.print(temperature_C); Serial.print("°C ~ "); Serial.print(temperature_F); Serial.println("°F"); delay(1000); }

※ 주의:

코드는 온도 텍스트를 OLED 디스플레이의 수평 및 수직 중앙에 자동으로 배치합니다. 도 기호는 char(247)를 사용하여 표시됩니다.

빠른 단계

Arduino UNO Q를 처음 사용하시나요? 진행하기 전에 아두이노 우노 Q 시작하기 튜토리얼을 따르세요.

  • 연결: 배선도에 표시된 대로 DS18B20 센서 및 OLED 디스플레이를 Arduino UNO Q MCU에 배선합니다.
  • Arduino App Lab 열기: Arduino App Lab을 실행하고 Arduino UNO Q를 감지할 때까지 기다립니다.
  • 새 앱 만들기: Create New App 버튼을 클릭합니다.
create new app in 아두이노 app lab on Arduino UNO Q
  • 앱에 이름을 지정합니다 (예: TemperatureSensorOled)
  • Create를 클릭하여 확인합니다.
아두이노 app lab app folders and files on Arduino UNO Q
  • 스케치 붙여넣기: 위의 MCU 코드를 복사하여 sketch/sketch.ino에 붙여넣습니다. 다른 파일은 기본값으로 유지합니다.
  • Install the library: Click the Add sketch library button (the open book icon with a + sign) in the left sidebar.
add sketch 라이브러리 in 아두이노 app lab on Arduino UNO Q
  • Search for Adafruit SSD1306 created by Adafruit and click the Install button.
My Apps / DIYables Apps
Run
Bricks
No bricks added...
Sketch Libraries
No sketch libra...
Files
python
sketch
.gitignore
README.md
app.yaml
sketch.ino
Add sketch library
Adafruit SSD1306 Adafruit

SSD1306 oled driver library for monochrome 128x64 and 128x32 displays

2.5.9
Install
More Info
  • Search for Adafruit GFX Library created by Adafruit and click the Install button.
My Apps / DIYables Apps
Run
Bricks
No bricks added...
Sketch Libraries
No sketch libra...
Files
python
sketch
.gitignore
README.md
app.yaml
sketch.ino
Add sketch library
Adafruit GFX Library Adafruit

Install this library in addition to the display library for your hardware.

1.12.6
Install
More Info
  • Search for DallasTemperature created by Miles Burton , Tim Newsome , Guil Barros , Rob Tillaart and click the Install button.
My Apps / DIYables Apps
Run
Bricks
No bricks added...
Sketch Libraries
No sketch libra...
Files
python
sketch
.gitignore
README.md
app.yaml
sketch.ino
Add sketch library
DallasTemperature Miles Burton , Tim Newsome , Guil Barros , Rob Tillaart

Supports DS18B20, DS18S20, DS1822, DS1820

3.9.0
Install
More Info
  • Search for OneWire created by Jim Studt, Tom Pollard, Robin James, Glenn Trewitt, Jason Dangel, Guillermo Lovato, Paul Stoffregen, Scott Roberts, Bertrik Sikken, Mark Tillotson, Ken Butcher, Roger Clark, Love Nystrom and click the Install button.
My Apps / DIYables Apps
Run
Bricks
No bricks added...
Sketch Libraries
No sketch libra...
Files
python
sketch
.gitignore
README.md
app.yaml
sketch.ino
Add sketch library
OneWire Jim Studt, Tom Pollard, Robin James, Glenn Trewitt, Jason Dangel, Guillermo Lovato, Paul Stoffregen, Scott Roberts, Bertrik Sikken, Mark Tillotson, Ken Butcher, Roger Clark, Love Nystrom

2.3.8
Install
More Info
  • 업로드: Arduino App Lab에서 실행 버튼을 클릭합니다.
click run 버튼 in 아두이노 app lab on Arduino UNO Q
  • 센서를 손에 쥐거나 뜨거운/찬 물에 담그세요 — OLED에서 온도가 업데이트되는 것을 확인하세요.

App Lab 콘솔 출력

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
Message (Enter to send a message to "Newbiely" on usb(2820070321))
New Line
9600 baud
[2026-04-29 09:00:01] Arduino UNO Q Temperature Sensor + OLED ready [2026-04-29 09:00:02] Temperature: 26.31°C ~ 79.36°F [2026-04-29 09:00:03] Temperature: 26.44°C ~ 79.59°F [2026-04-29 09:00:04] Temperature: 27.06°C ~ 80.71°F [2026-04-29 09:00:05] Temperature: 28.50°C ~ 83.30°F

Bridge: Linux + MCU

이 섹션에서는 Arduino UNO Q의 두 프로세서를 모두 프로그래밍하여 Linux 측이 Bridge를 통해 온도를 모니터링할 수 있도록 하는 방법을 보여줍니다:

  • DS18B20 센서 및 OLED는 모두 MCU(STM32)에 연결됩니다 — MCU는 매초 온도를 읽고 OLED를 자동으로 업데이트합니다
  • MPU는 센서 또는 OLED에 직접 액세스할 수 없습니다 — Bridge 함수를 호출하여 판독값을 검색하거나 디스플레이를 지워야 합니다
  • MPU는 Wi-Fi를 가지고 있습니다 — 완전한 Debian Linux를 실행하여 판독값을 기록하거나, 대시보드에 게시하거나, 인터넷을 통해 알림을 보낼 수 있습니다
  • Arduino_RouterBridge는 두 프로세서 간의 RPC 통신을 활성화합니다
  • ⚠️ /dev/ttyHS1(Linux) 및 Serial1(MCU)은 라우터에 의해 예약됨 — 사용자 코드에서 열지 마세요

간단히 말해서: MCU가 매초 센서를 읽고 OLED를 업데이트 → MPU가 Bridge를 통해 온도를 읽음 → MPU가 Wi-Fi를 통해 게시, 기록 또는 알림.

MCU 코드 (Bridge)

/* * 이 Arduino UNO Q 코드는 newbiely.kr 에서 개발되었습니다 * 이 Arduino UNO Q 코드는 어떠한 제한 없이 공개 사용을 위해 제공됩니다. * 상세한 지침 및 연결도에 대해서는 다음을 방문하세요: * https://newbiely.kr/tutorials/arduino-uno-q/arduino-uno-q-temperature-sensor-oled */ #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #include <OneWire.h> #include <DallasTemperature.h>#include "Arduino_RouterBridge.h" #define OLED_WIDTH 128 #define OLED_HEIGHT 64 #define SENSOR_PIN 4 Adafruit_SSD1306 oled(OLED_WIDTH, OLED_HEIGHT, &Wire, -1); OneWire oneWire(SENSOR_PIN); DallasTemperature DS18B20(&oneWire); float last_temp_c = 0.0; float last_temp_f = 0.0; unsigned long last_read_ms = 0; void oled_display_center(String text) { int16_t x1, y1; uint16_t width, height; oled.getTextBounds(text, 0, 0, &x1, &y1, &width, &height); oled.clearDisplay(); oled.setCursor((OLED_WIDTH - width) / 2, (OLED_HEIGHT - height) / 2); oled.println(text); oled.display(); } String get_temp_c(String arg) { return String(last_temp_c, 2); } String get_temp_f(String arg) { return String(last_temp_f, 2); } String clear_oled(String arg) { oled.clearDisplay(); oled.display(); Monitor.println("OLED cleared"); return "OK"; } String get_status(String arg) { return "Temp: " + String(last_temp_c, 2) + "°C / " + String(last_temp_f, 2) + "°F"; } void setup() { Bridge.begin(); Monitor.begin(); if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { Monitor.println("SSD1306 allocation failed"); while (true); } oled.clearDisplay(); oled.setTextSize(2); oled.setTextColor(WHITE); DS18B20.begin(); DS18B20.requestTemperatures(); last_temp_c = DS18B20.getTempCByIndex(0); last_temp_f = last_temp_c * 9.0 / 5.0 + 32.0; oled_display_center(String(last_temp_c, 1) + char(247) + "C"); Bridge.provide("get_temp_c", get_temp_c); Bridge.provide("get_temp_f", get_temp_f); Bridge.provide_safe("clear_oled", clear_oled); Bridge.provide("get_status", get_status); Monitor.println("Arduino UNO Q Temperature Sensor + OLED Bridge ready"); } void loop() { unsigned long now = millis(); if (now - last_read_ms >= 1000) { last_read_ms = now; DS18B20.requestTemperatures(); last_temp_c = DS18B20.getTempCByIndex(0); last_temp_f = last_temp_c * 9.0 / 5.0 + 32.0; oled_display_center(String(last_temp_c, 1) + char(247) + "C"); Monitor.println("Temp: " + String(last_temp_c, 2) + "°C / " + String(last_temp_f, 2) + "°F"); } }

Python 코드 (Bridge)

/* * 이 Arduino UNO Q 코드는 newbiely.kr 에서 개발되었습니다 * 이 Arduino UNO Q 코드는 어떠한 제한 없이 공개 사용을 위해 제공됩니다. * 상세한 지침 및 연결도에 대해서는 다음을 방문하세요: * https://newbiely.kr/tutorials/arduino-uno-q/arduino-uno-q-temperature-sensor-oled */ from arduino.app_utils import * import time def loop(): status = Bridge.call("get_status") print(status) time.sleep(1) App.run(user_loop=loop)

빠른 단계

  • 연결: 배선도에 표시된 대로 DS18B20 센서 및 OLED를 Arduino UNO Q에 배선합니다.
  • Arduino App Lab 열기: Arduino App Lab을 실행하고 보드가 감지될 때까지 기다립니다.
  • 새 앱 만들기: Create New App를 클릭하고 TemperatureSensorOledBridge 이름을 지정한 후 Create를 클릭합니다.
  • MCU 스케치 붙여넣기: 위의 MCU Bridge 코드를 복사하여 sketch/sketch.ino에 붙여넣습니다.
  • Python 코드 붙여넣기: 위의 Python Bridge 코드를 복사하여 앱의 Python 파일에 붙여넣습니다.
  • 업로드: Arduino App Lab에서 실행 버튼을 클릭합니다.
click run 버튼 in 아두이노 app lab on Arduino UNO Q
  • Python 콘솔에 온도 판독값이 표시되고 OLED가 자동으로 업데이트되는 것을 확인하세요.

App Lab 콘솔 출력

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
Message (Enter to send a message to "Newbiely" on usb(2820070321))
New Line
9600 baud
[2026-04-29 09:00:01] Arduino UNO Q Temperature Sensor + OLED Bridge ready [2026-04-29 09:00:02] Temp: 26.31°C / 79.36°F [2026-04-29 09:00:03] Temp: 26.44°C / 79.59°F [2026-04-29 09:00:04] Temp: 27.06°C / 80.71°F
DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
[2026-04-29 09:00:02] Temp: 26.31°C / 79.36°F [2026-04-29 09:00:03] Temp: 26.44°C / 79.59°F [2026-04-29 09:00:04] Temp: 27.06°C / 80.71°F [2026-04-29 09:00:05] Temp: 28.50°C / 83.30°F

Telegram

온도를 원격으로 모니터링하고 온도가 35°C 이상으로 올라갈 때 자동 Telegram 알림을 받습니다.

MCU 스케치: 이전 Bridge 섹션의 동일한 MCU 스케치를 유지합니다.

Python 코드 (Telegram)

/* * 이 Arduino UNO Q 코드는 newbiely.kr 에서 개발되었습니다 * 이 Arduino UNO Q 코드는 어떠한 제한 없이 공개 사용을 위해 제공됩니다. * 상세한 지침 및 연결도에 대해서는 다음을 방문하세요: * https://newbiely.kr/tutorials/arduino-uno-q/arduino-uno-q-temperature-sensor-oled */ from arduino.app_utils import * import requests import time TELEGRAM_BOT_TOKEN = "YOUR_TELEGRAM_BOT_TOKEN" CHAT_ID = "YOUR_CHAT_ID" last_update_id = 0 ALERT_THRESHOLD_C = 35.0 alert_sent = False def get_updates(): global last_update_id url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/getUpdates" params = {"offset": last_update_id + 1, "timeout": 5} try: response = requests.get(url, params=params, timeout=10) data = response.json() if data["ok"]: return data["result"] except Exception as e: print(f"Error getting updates: {e}") return [] def send_message(chat_id, text): url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage" payload = {"chat_id": chat_id, "text": text} try: requests.post(url, data=payload, timeout=10) except Exception as e: print(f"Error sending message: {e}") def loop(): global alert_sent # Auto-alert on high temperature temp_c_str = Bridge.call("get_temp_c") try: temp_c = float(temp_c_str) if temp_c > ALERT_THRESHOLD_C and not alert_sent: alert_sent = True temp_f = Bridge.call("get_temp_f") msg = f"⚠️ High temperature alert: {temp_c_str}°C / {temp_f}°F" print(msg) send_message(CHAT_ID, msg) elif temp_c <= ALERT_THRESHOLD_C: alert_sent = False except ValueError: pass # Handle Telegram commands updates = get_updates() for update in updates: last_update_id = update["update_id"] if "message" not in update: continue message = update["message"] chat_id = message["chat"]["id"] text = message.get("text", "").strip() print(f"Received: {text}") if text == "/start": send_message(chat_id, "Arduino UNO Q Temperature Sensor + OLED Bot\n" "/temp - Read temperature (°C and °F)\n" "/tempC - Read temperature in Celsius\n" "/tempF - Read temperature in Fahrenheit\n" "/clear - Clear the OLED display\n" "/status - Get sensor status") elif text == "/temp": temp_c = Bridge.call("get_temp_c") temp_f = Bridge.call("get_temp_f") send_message(chat_id, f"Temperature: {temp_c}°C ~ {temp_f}°F") elif text == "/tempC": result = Bridge.call("get_temp_c") send_message(chat_id, f"Temperature: {result}°C") elif text == "/tempF": result = Bridge.call("get_temp_f") send_message(chat_id, f"Temperature: {result}°F") elif text == "/clear": result = Bridge.call("clear_oled") send_message(chat_id, result) elif text == "/status": result = Bridge.call("get_status") send_message(chat_id, result) else: send_message(chat_id, "Unknown command. Send /start for help.") time.sleep(1) App.run(user_loop=loop)

빠른 단계

  • YOUR_TELEGRAM_BOT_TOKEN을 BotFather에서 받은 실제 봇 토큰으로 바꿉니다.
  • YOUR_CHAT_ID를 실제 Telegram 채팅 ID로 바꿉니다.
  • 이 Python 코드를 앱의 Python 파일에 붙여넣습니다 (MCU 스케치는 동일하게 유지).
  • 실행 버튼을 클릭합니다. Telegram에서 /temp를 보내거나 센서를 잡아 높은 온도 경고를 트리거합니다.

App Lab 콘솔 출력

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
[2026-04-29 09:10:00] Waiting for Telegram messages... [2026-04-29 09:10:15] ⚠️ High temperature alert: 36.25°C / 97.25°F [2026-04-29 09:10:30] Received: /temp [2026-04-29 09:10:45] Received: /clear
Telegram
Telegram 12:45
Welcome to Telegram!
ArduinoBot 10:19
Chatting with Arduino...
telegram-botfather
BotFather Yesterday
Your bot has been created.

ArduinoBot

bot
Today
/temp
10:15 AM ✓✓
Temperature: 26.31°C ~ 79.36°F
10:16 AM
/tempC
10:17 AM ✓✓
Temperature: 26.31°C
10:18 AM
/tempF
10:19 AM ✓✓
Temperature: 79.36°F
10:20 AM
/clear
10:21 AM ✓✓
OK
10:22 AM
/status
10:23 AM ✓✓
Temp: 26.31°C / 79.36°F
10:24 AM
⚠️ High temperature alert: 36.25°C / 97.25°F
10:25 AM

OpenClaw

You can adapt the OpenClaw to this tutorial by refering the instruction on 아두이노 우노 Q - OpenClaw Tutorial

프로젝트 아이디어

Arduino UNO Q와 온도 센서 및 OLED를 결합하여 많은 유용한 프로젝트를 구축할 수 있습니다:

  • 휴대용 디지털 온도계: 배터리로 작동되는 온도계로 OLED에 큰 읽기 쉬운 텍스트로 온도를 표시합니다 — 전력을 절약하기 위해 변경이 없으면 30초 후에 OLED가 꺼집니다
  • 서버실 모니터: 센서를 서버 랙에 마운트하고 OLED에 실시간 온도를 표시합니다; MPU는 냉각이 실패할 때 Telegram 알림을 보냅니다
  • 온도 제어식 LED 스트립: MCU가 온도를 읽고 범위에 따라 LED 스트립의 색을 조정합니다 (파란색 = 차가운, 녹색 = 정상, 빨간색 = 뜨거운) OLED에 현재 판독값이 표시됩니다
  • 다중 라인 OLED 대시보드: OLED의 1번 라인에 온도, 2번 라인에 세션에 대한 최소/최대값, 3번 라인에 현재 시간(Bridge를 통한 MPU에서)을 표시합니다
  • 클라우드 온도 로거: Linux MPU가 Bridge를 통해 매분 온도를 읽고, CSV 파일에 데이터를 저장하고, 매일 Google Sheets 또는 IoT 대시보드에 업로드합니다

도전 과제

Arduino UNO Q에서 온도 센서 및 OLED를 사용하여 더 나아가 준비가 되셨나요? 다음 도전 과제를 시도하세요:

  • 쉬움: MCU 스케치를 수정하여 OLED에 별도 라인에 화씨와 섭씨를 모두 표시하고, 3초마다 디스플레이를 전환합니다.
  • 중간: set_unit(String) Bridge 함수를 추가하여 "C" 또는 "F"를 허용하고 기본 센서 코드를 수정하지 않고 OLED가 표시하는 단위를 설정합니다.
  • 고급: 날씨 스테이션 대시보드를 구축합니다: DS18B20에서 온도를 읽고 DHT11 센서(연결된 경우)에서 습도를 읽고, OLED에 형식화된 레이아웃으로 둘 다 표시하고, MPU가 30초마다 모든 판독값을 MQTT 브로커에 게시하도록 합니다.