Skip to content

Tharunreddym/Sensor-Based-Embedded-Validation-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌑️ Sensor-Based Embedded Validation System

STM32 NUCLEO-F401RE + AHT30 Temperature & Humidity Sensor


Platform Language Protocol Logging Status


πŸ“Œ Project Overview

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.


🎯 Project Objectives

  • 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.

🧰 Hardware Used

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

πŸ’» Software & Tools

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

πŸ”Œ Hardware Connections

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.


🧠 System Architecture

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]
Loading

βš™οΈ Firmware Features

  • 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

βœ… Validation Test Cases

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

πŸ“Ÿ Normal Operation UART Output

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

🚨 Fault Detection Output

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

πŸ“ˆ Environmental Response Validation

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.


πŸ“‚ Repository Structure

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

πŸš€ How to Run

1. Open Project

Open the STM32CubeIDE project.

2. Verify Peripheral Configuration

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

3. Build Firmware

Project β†’ Build Project

4. Flash Firmware

Run β†’ Run

5. Open UART Terminal

Tera Term settings:

Port: STMicroelectronics STLink Virtual COM Port
Baud Rate: 115200
Data: 8 bit
Parity: None
Stop Bits: 1
Flow Control: None

6. Press Reset

Press the black RESET button on the STM32 board and observe the UART validation logs.


πŸ§ͺ Validation Evidence

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

🏁 Final Result

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.


🧩 Skills Demonstrated

  • 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

πŸ“Œ Project Status

βœ… Completed Successfully

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
STM32 AHT30 Wiring Proof

πŸ‘€ Author

Tharun Reddy Mopuru

Embedded Systems β€’ Firmware Validation β€’ STM32 β€’ I2C β€’ UART β€’ Sensor Validation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors