This project is a sensor-based embedded validation system built using an STM32 NUCLEO-F401RE development board and an AHT30 temperature/humidity sensor.
The system communicates with the AHT30 sensor over I2C, reads real-time temperature and humidity values, validates sensor behavior using structured test cases, and logs all results through UART using Tera Term.
The project also includes fault validation by disconnecting SDA and SCL lines to confirm that the firmware can detect I2C communication failures and recover after reconnection.
- Interface an AHT30 temperature/humidity sensor with STM32 using I2C1.
- Configure STM32 peripherals using STM32CubeMX and STM32CubeIDE.
- Implement firmware in Embedded C using STM32 HAL drivers.
- Log validation results through UART2 at 115200 baud.
- Validate sensor detection, initialization, temperature reading, humidity reading, and data range.
- Detect sensor communication failures caused by SDA/SCL disconnection.
- Use LD2 LED as a firmware heartbeat indicator.
- Capture UART validation logs as project evidence.
| Component | Purpose |
|---|---|
| STM32 NUCLEO-F401RE | Main microcontroller board |
| AHT30 Sensor Module | Temperature and humidity sensing |
| Breadboard | Sensor prototyping |
| Jumper Wires | Hardware connections |
| USB Cable | Power, programming, UART serial communication |
| PC / Laptop | Development and serial monitoring |
| Tool | Purpose |
|---|---|
| STM32CubeIDE | Firmware development, build, and flashing |
| STM32CubeMX | Peripheral configuration |
| STM32 HAL Drivers | GPIO, UART, and I2C firmware abstraction |
| Tera Term | UART serial logging |
| GitHub | Version control and project showcase |
| AHT30 Pin | STM32 NUCLEO-F401RE Pin | Function |
|---|---|---|
| VCC / VIN | 3V3 | Sensor power |
| GND | GND | Common ground |
| SCL | D15 / PB8 | I2C clock |
| SDA | D14 / PB9 | I2C data |
AHT30 VCC / VIN β STM32 3V3
AHT30 GND β STM32 GND
AHT30 SCL β STM32 D15 / PB8
AHT30 SDA β STM32 D14 / PB9
β οΈ Use 3.3V for the AHT30 sensor connection.
flowchart LR
A[AHT30 Sensor] -->|I2C: SDA/SCL| B[STM32 NUCLEO-F401RE]
B -->|UART2 Serial Logs| C[Tera Term on PC]
B -->|GPIO PA5| D[LD2 Heartbeat LED]
C --> E[Validation Logs]
- GPIO-based LD2 heartbeat blink
- UART serial logging through USART2
- I2C communication using I2C1
- AHT30 detection at I2C address
0x38 - AHT30 initialization command
- Temperature and humidity acquisition
- PASS/FAIL validation messages
- Sensor range validation
- SDA disconnect fault detection
- SCL disconnect fault detection
- Recovery validation after reconnecting sensor lines
| Test Case ID | Validation Scenario | Expected Result | Status |
|---|---|---|---|
| TC_01 | AHT30 sensor detection | Sensor responds at I2C address 0x38 |
β PASS |
| TC_02 | AHT30 initialization | Initialization command completes successfully | β PASS |
| TC_03 | Temperature reading validation | Valid temperature value is printed | β PASS |
| TC_04 | Humidity reading validation | Valid humidity value is printed | β PASS |
| TC_05 | Sensor range validation | Temperature and humidity remain within valid range | β PASS |
| TC_06 | AHT30 read failure detection | Read failure or timeout is detected | β PASS |
| TC_07 | SDA disconnect fault | Sensor detection fails and error is logged | β PASS |
| TC_08 | SCL disconnect fault | Sensor detection fails and error is logged | β PASS |
| TC_09 | Reconnect recovery | System returns to PASS after reconnect | β PASS |
| TC_10 | Environmental response | Humidity/temperature changes when exposed to breath or warmth | β PASS |
Sensor Validation System Started
[TC_01 PASS] AHT30 detected at I2C address 0x38
[TC_02 PASS] AHT30 initialization successful
Starting temperature and humidity readings...
Temperature: 24.96 C | Humidity: 51.32 %
[TC_03 PASS] Temperature reading valid
[TC_04 PASS] Humidity reading valid
[TC_05 PASS] Sensor data within valid operating range
When SDA or SCL is disconnected, the firmware detects I2C communication failure:
Sensor Validation System Started
[TC_01 FAIL] AHT30 not detected at I2C address 0x38
[TC_02 FAIL] AHT30 initialization failed
Starting temperature and humidity readings...
[TC_06 FAIL] AHT30 read failed or sensor timeout detected
The sensor responded correctly when exposed to environmental changes.
Example humidity response:
Temperature: 26.19 C | Humidity: 62.40 %
Temperature: 26.49 C | Humidity: 67.35 %
Temperature: 27.56 C | Humidity: 73.92 %
Temperature: 26.57 C | Humidity: 74.13 %
This confirms that the AHT30 sensor responds to humidity and temperature changes in real time.
Sensor-Based-Embedded-Validation-System/
βββ README.md
βββ validation_test_cases.md
βββ project_summary.md
βββ project_summary_for_linkedin.txt
βββ resume_bullets.txt
βββ firmware/
β βββ Core/
β βββ Src/
β βββ main.c
βββ logs/
β βββ aht30_validation_uart_log.txt
β βββ aht30_sda_disconnect_fail_log.txt
β βββ aht30_scl_disconnect_fail_log.txt
βββ docs/
β βββ images/
β βββ aht30_wiring_proof.jpeg
βββ .gitignore
Open the STM32CubeIDE project.
Make sure the following peripherals are enabled:
| Peripheral | Configuration |
|---|---|
| GPIO | PA5 / LD2 as output |
| USART2 | Asynchronous, 115200 baud |
| I2C1 | PB8 = SCL, PB9 = SDA, 100 kHz |
Project β Build Project
Run β Run
Tera Term settings:
Port: STMicroelectronics STLink Virtual COM Port
Baud Rate: 115200
Data: 8 bit
Parity: None
Stop Bits: 1
Flow Control: None
Press the black RESET button on the STM32 board and observe the UART validation logs.
The repository includes UART log evidence:
| Log File | Description |
|---|---|
logs/aht30_validation_uart_log.txt |
Normal PASS readings |
logs/aht30_sda_disconnect_fail_log.txt |
SDA disconnect failure test |
logs/aht30_scl_disconnect_fail_log.txt |
SCL disconnect failure test |
The system successfully validates the AHT30 sensor over I2C using STM32. It captures real-time temperature and humidity values, validates sensor range, detects I2C communication failures, and logs validation results through UART.
- Embedded C firmware development
- STM32 HAL programming
- STM32CubeMX peripheral configuration
- GPIO, UART, and I2C implementation
- Sensor interfacing
- Hardware/software integration
- Fault detection and recovery testing
- UART log-based validation
- Embedded validation documentation
| Module | Status |
|---|---|
| GPIO LED Heartbeat | β Working |
| UART Logging | β Working |
| I2C Communication | β Working |
| AHT30 Detection | β Working |
| Temperature Reading | β Working |
| Humidity Reading | β Working |
| Fault Detection | β Working |
| Recovery Testing | β Working |
Tharun Reddy Mopuru
Embedded Systems β’ Firmware Validation β’ STM32 β’ I2C β’ UART β’ Sensor Validation