STM32 Health Monitoring Device STM32 Health Monitoring Device

STM32 Health Monitoring Device

WORK IN PROGRESS

This was the final project for EE2028: Microcontroller Programming and Interfacing. This module covers the basic architecture of microcontrollers, as well as programming them with ARM Assembly (specifically the ARMv7-M instruction set) and C using the STM32CubeIDE.

For the final project, we were tasked to create a wearable device for monitoring elderly’s health using the B-L475E-IOT01A Discovery Kit. This involved interfacing with various onboard sensors to implement a list of features, like detecting falls or measuring body temperatures. We were also given the option to add more components e.g. OLED screen, buzzer, etc., and implement extra features as we saw fit.

Our submission fulfilled all the base requirements with many added enhancements, earning it one of the highest grades in the course and being featured in the inaugural NUS ECE Project Showcase 2025. As this was pair work, I will be largely focusing on my contributions to the project below.

Base Features

As part of the project’s base requirements, the following features were implemented. (Only covered in brief as these were mostly covered by my group mate)

  • Fall detection: Used the accelerometer to detect free falls when acceleration across all 3 axes falls below a threshold.
  • “Abnormal movement” detection: Used the gyroscope to detect rapid changes in orientation across all 3 axes.
  • Improper posture detection: Used the magnetometer to detect when the device is lying on its side.
  • Fever detection: Used the temperature sensor to detect when the temperature exceeds a threshold.
  • Mode switching: Double clicking a button toggles between a standard mode that reports the raw readings collected and an “emergency” mode that shows the warnings instead.

Beyond the base features, some extra features were implemented.

  • Converted the accelerometer free-fall detection to use interrupts, reducing CPU usage.
  • Added step-counting functionality using the accelerometer.
  • Used an OLED screen to display the details that were sent over UART. Additional graphics were added for the emergency mode warnings too.

Orientation Visualiser

STM32CubeIDE

See IMUPoser

Fixing Clock Issues

When first sending bitmaps to the OLED screen, the whole board felt extremely sluggish, hitting refresh rates of 1-2 FPS.

A quick calculation proves this should not happen. With a 128x64 pixel screen, a total of 8192 bits needed to send per refresh (round up to 10000 bits to include overhead) With the I2C clock speed configured to 400 kHz, there should be a 400000 / 10000 = 40 Hz refresh rate.

Another odd observation came from testing the buzzer, where I had to set extremely high frequencies beyond the audible range in order to produce even a low-pitched tone.

With these 2 oddities, I suspected that the clock speed was not being set correctly. With some debugging, I found that the <freq var name> was indeed set to 4000000. This was much lower than the 80 MHz I was assuming the board was operating at this whole time!

<images>

Turns out the boilerplate code provided by the teaching team did not include any clock setup code! With the problem found, a quick reconfiguration within STM32CubeMX fixed the issue.

Wi-Fi Communication and Dashboard

Another key enhancement was the addition of Wi-Fi communication, allowing the device to send data to a dashboard for monitoring.

Other Features

There were other smaller features here

Conclusion


← Back to projects