Panel For Example Panel For Example Panel For Example

IoT Temperature and Humidity Alarm Design Using RT-SPARK 1

Author : Adrian November 17, 2025

IoT-enabled temperature and humidity alarm

Introduction

In today's era of advanced digitization and informatization, monitoring and production equipment are increasingly digital. Timely and accurate data acquisition, multi-device access, and intuitive presentation are central challenges for modern digital devices. Using the RT-Thread real-time operating system and the OneNET IoT platform, these objectives can be implemented efficiently.

Project Overview

Project name

IoT-enabled temperature and humidity alarm

Design concept

The project uses the RT-Thread system and an STM32F407-based development board, Xinghuo-1, to implement a temperature and humidity alarm. The alarm connects via Wi-Fi to upload data to the OneNET cloud and presents data on an LCD for local visualization.

Problem addressed

With growing demand for smart home devices, an integrated temperature and humidity alarm with IoT functionality helps monitor household environmental conditions in real time and provides visualized data to improve device intelligence and residential safety.

Innovation

The design integrates sensors, control, and display devices for direct connection at the device side, aiming to improve living quality and reduce operating and maintenance costs.

System Design

Hardware

The Xinghuo-1 development board uses the commonly adopted STM32F407 microcontroller and provides many onboard resources (Flash storage, Wi-Fi connectivity, multiple sensors) and rich extension interfaces. The peripherals used in this project include:

  • A. AHT20 temperature and humidity sensor
  • B. 19-addressable full-color LEDs
  • C. Buzzer
  • D. 240x240 parallel LCD
  • E. RW007 Wi-Fi module

Software

 

Implementation

LED and buzzer

Download the AHT10 package in RT-Thread Setting for the temperature and humidity sensor and include the header "ath10.h". Enable the I2C3 peripheral in the onboard driver options. Use rt_thread_mdelay and rt_pin_write for delays and GPIO control. Read humidity and temperature with aht10_read_humidity and aht10_read_temperature.

LCD

The application creates two threads: one for receiving sensor data and another for displaying data on the LCD. Icons are used for improved readability. Images are converted to hexadecimal arrays using conversion tools and drawn to the LCD via library functions. Thresholds are set for temperature and humidity and the main function calls helper functions to implement the display logic.

OneNET and data visualization

Download the rw007 package in RT-Thread Setting to connect the Xinghuo-1 board to Wi-Fi and enable SPI2 in the onboard driver configuration. Also download the OneNET package. After network connection, the collected temperature and humidity data are uploaded to OneNET via MQTT and processed for visualization. The commands onenet_mqtt_init and onenet_upload_cycle are used to initialize connectivity and upload periodic sensor data for cloud visualization.

Project Results

Functionality

LED and buzzer: real-time display on the backend console and local alarm when thresholds are exceeded. Temperature threshold is 30°C and humidity threshold is 90%. If both exceed thresholds, the buzzer sounds continuously and both red and yellow LEDs remain on. If only humidity exceeds the threshold, the buzzer double-beeps and the yellow LED flashes twice. If only temperature exceeds the threshold, the buzzer single-beeps and the red LED flashes once. If both are within normal range, the red and yellow LEDs alternate flashing.

LCD: real-time display of temperature and humidity with icons. When both temperature and humidity are within thresholds, a smiling icon is shown to indicate comfortable conditions. When temperature remains above the threshold for a sustained period, a "hot" icon is shown to avoid flicker near the threshold. When humidity remains above its threshold for a sustained period, a "wet" icon is shown.

OneNET visualization: the board connects to Wi-Fi using the rw007 package and transfers collected temperature and humidity data to OneNET via MQTT. The cloud processes and visualizes the data streams.

Status indicators

  • Normal: red and yellow LEDs alternate
  • Over-humidity: yellow LED flashes twice, buzzer double-beeps
  • Over-temperature: red LED flashes once, buzzer single-beeps
  • OneNET IoT visualization