SmartBike: Cyclometer and Smart Anti-Theft System
A bicycle speed monitoring system and anti-theft alarm, developed on an STM32 platform.
Author: Nicolae Andrei
GitHub Project Link: https://github.com/UPB-PMRust-Students/acs-project-2026-nikoeu.git
Description
The project consists of developing a "dashboard computer" for a bicycle, featuring two main functionalities: a cyclometer and an anti-theft system. The cyclometer function uses a magnetic sensor (Reed switch) mounted on the fork and a magnet on the spoke to calculate the speed and distance traveled, displaying the data on a small screen. The anti-theft function uses a gyroscope/accelerometer module to detect unauthorized movements or shocks when the bicycle is "armed". In case of suspicious movement, the system sends a notification to the user's phone via a Bluetooth Low Energy (BLE) connection, compatible with iPhone.
Motivation
Cycling is a useful and relaxing activity, but securing the bike and monitoring performance can often require the purchase of expensive commercial equipment. I chose this project to combine my passion for cycling with electronics and embedded programming. It represents an excellent challenge to learn how to manage hardware interrupts for the speed sensor, I2C communication for the gyroscope, and serial communication for the Bluetooth module.
Architecture
The system is centralized around the STM32 development board, which receives and processes signals from the sensors, updates the display, and manages wireless communication.
Components and Connections:
- Microcontroller (STM32): The brain of the project. It manages the state logic (Armed/Disarmed/Riding).
- Speed Sensor (Magnetic Contact / Reed): Connected to a digital pin on the STM32 acting as an interrupt (EXTI). With each wheel rotation, the sensor sends a signal that helps calculate the speed based on the wheel's circumference.
- Motion Sensor (MPU6050): Connected via the I2C protocol to the STM32. It detects the acceleration and tilt of the bicycle for the alarm function.
- 0.96" OLED Display: Also connected via I2C, used to display the current speed, alarm status, and distance.
- Bluetooth Module (HM-10 / BLE): Connected via UART (TX/RX) to the STM32. It transmits data and alerts to a Bluetooth terminal application on iOS.
Log
[Week 27 April - 1 May]
Defined the project architecture, selected the final components, and ordered the necessary hardware parts (development board, sensors, Bluetooth module).
Hardware
The project requires components that are energy-efficient and small enough to be mounted on the bicycle's handlebars/fork.
- STM32 Development Board: The central processor executing the code.
- Magnetic Sensor (Reed Switch): A magnetically actuated switch, essential for counting wheel rotations.
- MPU6050 Gyroscope/Accelerometer: Used to detect sudden changes in position (anti-theft).
- HM-10 Bluetooth Module (BLE): Enables communication with iOS devices, which support the Bluetooth Low Energy standard.
- 0.96" OLED Display: For the visual interface on the handlebars.
- Power Module and Li-Ion Battery: To provide portability to the system.
Schematics

Photos

Bill of Materials
| Device | Usage | Price |
|---|---|---|
| STM32 | The main microcontroller | 129 RON |
| HM-10 BLE Bluetooth Module | iOS compatible wireless communication | 27 RON |
| MPU6050 Accelerometer Module | Motion detection for the alarm | 16 RON |
| Magnetic Sensor / Reed Switch | Wheel rotation detection | 14 RON |
| 0.96" OLED Display I2C | Displaying speed and status | 25 RON |
| Battery and TP4056 charging module | Powering the system | ~25 RON |
| Wires, Breadboard, Misc | Connecting the components | 17 RON |
Software
Because the project is part of the PMRust course, the main ecosystem relies on the Rust programming language for embedded systems.
| Library | Description | Usage |
|---|---|---|
| embassy-stm32 | Hardware Abstraction Layer (HAL) | Pin configuration, UART for Bluetooth, and I2C for sensors |
| embassy-executor | Async executor | Managing asynchronous tasks (reading sensors and transmitting BLE simultaneously) |
| mpu6050 (or similar) | MPU6050 Driver | Interfacing and reading data from the accelerometer |
| embedded-graphics | 2D graphics library | Drawing text (speed) on the OLED display |
| ssd1306 | OLED Display Driver | Hardware control of the small screen on the handlebars |