Embedded firmware for the ShapeMate wearable fitness tracker, built on Zephyr RTOS targeting the Nordic nRF5340 SoC.
ShapeMate is a smartwatch-style fitness tracker that collects biometric and motion data, stores it locally, and syncs periodically with a companion phone app over Bluetooth Low Energy.
- Sensor Data Collection — Heart rate, 3-axis accelerometer, 3-axis gyroscope, and step counting sampled every 5 minutes
- Flash Storage — Fitness samples persisted to a 1 MB flash partition using a simple block-based storage layer
- BLE Sync — Hourly sync of accumulated fitness data to a companion app via BLE GATT notifications
- Button-Driven UI — Menu system with programmable shortcut slots for quick access to workouts, step counts, and heart rate display
src/
├── main.c # Firmware entry point and event loop
├── app/ # Application-level update loop (100ms tick)
├── ble/
│ ├── gatt_service.c # BLE GATT notifications and connection handling
│ └── sync_prep.c # Prepares fitness data packets for BLE transfer
├── fitness/
│ └── fitness_data_manager.c # Sensor reading and flash persistence
├── interface/
│ └── menu.c # UI menu and shortcut button handling
├── storage/
│ └── flash_fs.c # Flash memory abstraction layer
└── sync/
└── sync_with_companion.c # Companion app sync orchestration
The firmware runs three periodic tasks:
| Task | Interval |
|---|---|
| Fitness data collection | 5 minutes |
| BLE sync to companion | 1 hour |
| UI update | 100 ms |
Requires the Zephyr SDK.
west build -b <your_board>
west flashKey settings in prj.conf:
| Setting | Value | Purpose |
|---|---|---|
CONFIG_BT |
y |
Enable Bluetooth |
CONFIG_BT_PERIPHERAL |
y |
BLE peripheral role |
CONFIG_BT_DEVICE_NAME |
"ShapeMate" |
Advertised device name |
CONFIG_FLASH |
y |
Flash storage driver |
CONFIG_NVS |
y |
Non-volatile storage |
CONFIG_HEAP_MEM_POOL_SIZE |
8192 |
8 KB heap |
CONFIG_MAIN_STACK_SIZE |
4096 |
4 KB main stack |
- Nordic nRF5340 SoC (dual-core Arm Cortex-M33)
- Heart rate sensor (I2C/SPI)
- 3-axis accelerometer
- 3-axis gyroscope
- Internal flash (1 MB partition, 4 KB blocks)
- BLE radio (peripheral mode, nRF5340 network core)
- Button inputs for menu navigation
This is a demonstration repository. The firmware and hardware descriptions are illustrative and not intended for production use.