Overview
FocusFlow+ is an embedded student wellness assistant designed to help students manage healthy desk habits during long study sessions. The system combines an STM32 Nucleo-F401RE for real-time control (OLED UI and physical inputs) with an ESP32 that provides a stand-alone Wi-Fi web interface for each wellness mode.
System Architecture
The system uses a dual-microcontroller architecture to separate real-time embedded control from web-based visualization.
- STM32: OLED page UI + lock status, joystick + 5 buttons, UART messaging
- ESP32: SoftAP web server, webpage sections (pages 0–4), routes STM32 button events after a UART “ready” handshake
Controls
- Joystick Left/Right: scroll pages
- Joystick Up/Down: unlock current page
- Button 5: only way to lock a page
- Buttons 1–4: page-specific actions when locked
Modes (ESP32 pages 0–4)
- Page 0: Focus Timer (start/pause, +5/−5 minutes)
- Page 1: Eating Log (log/edit, adjust goal 4–8)
- Page 2: Exercise (log/edit, adjust goal 1–4)
- Page 3: Mood (log/edit, show/hide reflection prompt)
- Page 4: Posture (designed: 20s calibration + monitoring, adjustable sensitivity)
Planned Alerts (Designed, Not Integrated)
- Focus timer completion alarm
- Global inactivity alert after 5 minutes of no interaction
- Posture-specific alerts (yellow vs red zone)
Wiring & Hardware Integration
FocusFlow+ uses a shared-ground, mixed-voltage hardware setup centered on the STM32 Nucleo-F401RE, which serves as both the primary controller and power source for external devices. The STM32’s 5V rail powers the ESP32 and the VL53L0X time-of-flight sensor, while the OLED display and joystick operate at 3.3V. The OLED and VL53L0X share an I2C bus, and a joystick provides analog navigation through ADC inputs. Five external push buttons are configured as active-low inputs with internal pull-ups, ensuring reliable operation with minimal external components. The UART link between the STM32 and ESP32 enables synchronized page state and button event handling. Only the ESP32 is connected to USB during operation. The joystick’s built-in push button was intentionally excluded due to unstable readings, and posture alerts via a buzzer were designed but not integrated due to time constraints.
Pin Mapping Summary
STM32 Nucleo-F401RE
| Component | Signal | STM32 Pin | Notes |
|---|---|---|---|
| Joystick | VCC | 3.3V | Analog joystick power |
| Joystick | GND | GND | Common ground |
| Joystick | X-Axis | PA0 (ADC) | Page scrolling |
| Joystick | Y-Axis | PA1 (ADC) | Page unlock |
| External Button 1 | Input | PA7 | Active-low, pull-up |
| External Button 2 | Input | PB6 | Active-low, pull-up |
| External Button 3 | Input | PC7 | Active-low, pull-up |
| External Button 4 | Input | PA9 | Active-low, pull-up |
| External Button 5 | Page Lock | PA6 | Active-low, pull-up |
| OLED Display | VCC | 3.3V | I2C OLED |
| OLED Display | GND | GND | — |
| OLED Display | SDA | PB9 | I2C |
| OLED Display | SCL | PB8 | I2C |
| VL53L0X Sensor | VIN | 5V | Powered from STM32 |
| VL53L0X Sensor | GND | GND | — |
| VL53L0X Sensor | SDA | PB9 | Shared I2C bus |
| VL53L0X Sensor | SCL | PB8 | Shared I2C bus |
| VL53L0X Sensor | XSHUT | PA5 | Software-controlled enable |
STM32 ↔ ESP32 UART & Power Interface
| Function | ESP32 GPIO | Connected To |
|---|---|---|
| Power | VCC | STM32 5V |
| Ground | GND | STM32 GND |
| UART RX (ESP32) | IO16 | STM32 TX |
| UART TX (ESP32) | IO17 | STM32 RX |
The STM32 provides both logic coordination and system power, while the ESP32 handles all web-based visualization through a SoftAP interface.
Planned (Not Integrated)
| Component | Signal | ESP32 GPIO |
|---|---|---|
| Buzzer | Output | IO21 |
| Buzzer | Ground | GND |
Results
Completed: OLED navigation, locked-page input mapping, UART handshake + button routing, and dynamic webpage sections per mode.
Not completed: VL53L0X distance streaming (sensor bring-up issue during I2C initialization), so posture distance did not display on the webpage; buzzer integration was cut due to time.
Here is the video of me operating the project: Video link
Tools & Skills
STM32Cube HAL (GPIO/I2C/SPI/UART/TIM), state-based UI design, UART messaging/handshake, ESP32 SoftAP + web server, embedded-to-web integration. This project emphasizes embedded system architecture, real-time input handling, and reliable communication between firmware and web interfaces.
Recent Comments