Skip to main content
Version: ACS CC

GPS Datalogger for Bicycle

A embedded system for recording and monitoring bicycle ride data, with real-time display and event detection.

info

Author: Dorneanu Stefan Cristian
GitHub Project Link: Project Link

Description

The system acquires data from a GPS module (position, speed, altitude), an accelerometer and gyroscope (sudden braking and cornering detection) and a barometric sensor (precise altitude). Data is displayed in real time on a display and saved persistently on an SD card in CSV format. The software runs multiple parallel async tasks: GPS acquisition with data decoding, event detection from the accelerometer and gyroscope with filtering on the magnitude of the acceleration vector, live display and SD card writing. Sensor fusion combines GPS altitude with barometric altitude for improved accuracy.

Motivation

I have been cycling regularly for the past few years and always wanted a deeper understanding of my rides beyond what a simple phone app can offer. Most commercial solutions are either too expensive or too closed to customize. Building this system from scratch on a microcontroller gives me full control over what data is collected and how it is processed. I also wanted to explore how sudden braking and cornering events can be detected in real time using an IMU, which has practical applications in cyclist safety. The project strikes a good balance between hardware integration and software complexity, making it an ideal fit for this project.

Architecture

The system is structured around 4 main components running in parallel:

  • GPS Task — reads position and speed data at 10Hz and calculates distance traveled
  • IMU Task — reads the accelerometer and gyroscope and detects sudden braking events
  • Display Task — updates the OLED screen with current data
  • SD Task — writes data to the CSV file on the SD card once per second

All tasks communicate through Mutex and Channel mechanisms to avoid data conflicts.

Log

Week 5 - 11 May

Ordered all hardware components (GPS module, accelerometer/gyroscope MPU-6050, barometric sensor AHT20+BMP280, OLED display, SD card module, RGB LED, passive buzzer, LiPo battery, TP4056 charger, wires and breadboard). Set up the Rust embedded development environment with Embassy framework. Created individual test projects for each component. Successfully tested the buzzer (PWM signal generation), RGB LED (common anode, color cycling), OLED display (I2C communication, text rendering) and accelerometer/gyroscope (I2C data reading). Started testing the GPS module — UART communication works and NMEA sentences are being received.

Week 12 - 18 May

Week 19 - 25 May

Hardware

The system uses the NUCLEO-U545RE-Q board as the main microcontroller. The GPS module provides position and speed data via UART. The accelerometer and gyroscope (IMU) are connected via I2C and detect sudden movements. The barometric sensor, also on I2C, measures atmospheric pressure to calculate altitude. An OLED display shows data in real time, while an SD card module saves all data in CSV format. The RGB LED and buzzer signal detected events such as sudden braking and sharp cornering.

Schematics

schematici proiect

Bill of Materials

DeviceUsagePrice
NUCLEO-U545RE-QMain microcontroller130 RON
GPS Module NEO-6MPosition, speed, GPS altitude69.99 RON
Accelerometer and Gyroscope MPU-6050Sudden braking and cornering detection14.68 RON
Barometric Sensor AHT20 + BMP280Temperature and barometric altitude12.00 RON
OLED Display 0.96" I2CReal-time data display18.98 RON
MicroSD Card ModuleData logging in CSV format4.99 RON
MicroSD Card 8GBCSV file storage15 RON
RGB LED ModuleVisual event indicator6.39 RON
Passive BuzzerAudio alert for sudden braking2.97 RON
LiPo Battery 3.7V + TP4056 moduleMobile power supply and charging34.67 RON
Wires and BreadboardComponent connections38.96 RON

Software

LibraryDescriptionUsage
embassy-stm32Async framework for embedded RustParallel tasks, peripheral drivers
embassy-timeTime management in EmbassyAsync timers and delays
embedded-sdmmcFAT32 file system for SDCSV writing on SD card
mpu6050Driver for accelerometer/gyroscopeIMU data reading via I2C
bmp280-ehalDriver for barometric sensorTemperature and pressure reading
ssd1306OLED display driverReal-time data display
libmMath functions for no_stdHaversine formula, sqrt
  1. Embassy Rust Framework
  2. STM32U545 Reference Manual
  3. Embedded Rust Programming