This repository contains the Arduino firmware for a TinyML-powered workout wearable based on the Arduino Nano 33 BLE.
It reads 9-axis IMU and heart-rate data, classifies the exercise (bench, squat, deadlift) with a TFLite model, counts repetitions with a second TFLite model, and streams live heart rate and workout summaries over BLE to a companion app.
/
βββserial_logger.py # UART Capture Script
βββREADME.md # (this file)
βββimu_printer/imu_printer.ino # Main Sketch
βββimu_printer/model.h # Header for embedded TFLite models
βββimu_printer/model.c # Embedded TFLite model data
- Board: Arduino Nano 33 BLE
- IMU: Bosch BMI270 + BMM150 (9-axis: accel, gyro, magnetometer)
- Heart-Rate Sensor: MAX30102 (via SparkFun MAX30105 library)
- Connections:
- IMU & MAX30102 β IΒ²C (SDA, SCL), IMU is implicitly connected
- 3.3 V and GND β Sensors
- Power & Programming: USB
Install the following libraries via the Arduino Library Manager:
- Arduino mbed-enabled Boards (to support
Ticker) - ArduinoBLE
- Arduino_BMI270_BMM150
- SparkFun MAX30105 (and its heartRate helper)
- TensorFlowLite Micro by Chirale (or
TensorFlowLite_ESP32fork that includes all_ops_resolver) - Wire (core)
- Service UUID:
181C(Fitness Machine) - Characteristics:
- Heart Rate
2AB4(Read + Notify) β live heartβrate buffer - Workout Summary
2AC8(Read + Notify) β JSON string:{"exercise":"<bench|squat|deadlift>","reps":<float>} - Command
2A3A(Write) β (reserved for future control commands)
- Heart Rate
- Clone this repo into your Arduino sketchbook folder.
- Open
imu_printer.inoin Arduino IDE. - Install all required libraries via Sketch β Include Library β Manage Librariesβ¦
- Select board Arduino Nano 33 BLE and correct COM port.
- Upload the sketch to your board.
- Pair with your smartphone app (implements BLE TFT Fitness Machine central).
- Live heart rate β updates on the app.
- When the phone disconnects, the device sends a final workout summary.
-
Sensor Setup:
- BMI270_BMM150 IMU sampled in bursts for motion data.
- MAX30102 streamed into a small circular buffer for heart rate.
-
TinyML Inference:
classification_model- Inputs sliding-window IMU data for exercise classification.
rep_count_model- Inputs processed sensor features to increment a reps counter.
-
BLE Communication:
- Periodically notify live heart rate.
- On workout completion or disconnect, notify workout summary JSON.
- Model Updates: Replace
model.h/model.cwith your own.tflitearrays. - Buffer Sizes: Tweak
CL_BURST_LEN,RC_BURST_LENinimu_printer.inoto adjust window lengths. - Battery & Power: Ensure 3.3 V supply to sensors; the Nano 33 BLEβs regulator handles USB power or LiPo input.