Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShapeMate Fitness Tracker Firmware

Embedded firmware for the ShapeMate wearable fitness tracker, built on Zephyr RTOS targeting the Nordic nRF5340 SoC.

Overview

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.

Features

  • 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

Architecture

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

Main Loop

The firmware runs three periodic tasks:

Task Interval
Fitness data collection 5 minutes
BLE sync to companion 1 hour
UI update 100 ms

Building

Requires the Zephyr SDK.

west build -b <your_board>
west flash

Configuration

Key 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

Hardware

  • 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.

About

Demo: AI-powered autofix for embedded firmware issues detected by Memfault

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages