- Overview
- Technologies Used
- Tools Required
- Installation Guide
- Board Enclosure
- How to use Fitnetic
- How the project was made
- Future improvements list
A fitness tracker built using an Arduino Nano 33 BLE Sense. Tracks the user's step count, walking time, sitting time and standing time.
- Tensorflow Lite for Microcontrollers
- P5.js
- p5.ble.js
- Chart.js
- Standard web technologies(HTML, CSS, JavaScript)
- A laptop or phone with Chrome installed
- An Arduino Nano 33 BLE Sense/Arduino Nano 33 BLE
- Micro USB cable
- Portable Battery pack/9V battery
- Enclosure/Cardboard and rubber bands
- Install the Arduino IDE
- Plug in your Arduino Nano 33 BLE Sense/ Arduino Nano 33 BLE
- Follow the instructions to set up your board as given here
- Install the required libraries:
- Navigate to Tools > Manage Libraries
- Search and install the libraries given below:
- Arduino_LSM9DS1
- ArduinoBLE
- Arduino_TensorFlowLite
- Download this repository
- Open the fitness_classify folder and open the fitness_classify.ino file.
- Upload the fitness_classify.ino skecth to the board. The upload process might take a few minutes.
- Once uploaded you are now ready to start using Fitnetic. Go to the Fitnetic website and follow the instructions in the next section.
- Place the Arduino board in an enclosure as shown above with a 9V battery conneted to the Vin and GND pins of the board along with a switch connected in series. Glue a clip to the back of the enclosure.
- Alternative: Cut a piece of cardboard that matches the shape of the board and secure the board using rubberbands or double-sided tape. A binder clip can be used as a clip for this build.
- Once the enclosure is built, clip it onto the front of your pants(in front of left/right leg) and you're ready to start using.
The Fitnetic website is a web interface that connects to the Arduino Board through BLE. Open the website on your laptop/phone (Using a phone is recommended as it allows you to use Fitnetic while you go about your day with the phone in your pocket). On start up you will get a screen that looks like this.
- Enter your details in the settings page and save the data. These can be modified at any time.
- Connect your Arduino to a battery pack and clip in onto your waist. Place the battery pack in one of your pant pockets.
- Turn on bluetooth on laptop/phone. Press the Connect to Bluetooth Button and pair with the Fitness_Data device.
- If all goes well, you should see the connect button turn turquoise. This means you're all good to go about using it.
- Press the start button, minimize your window to keep the website running and go about your day with your phone or laptop nearby. Important: Keep the website/webapp open or minimized to keep it connected to the Arduino.
- The main aim of the project was to that it is possible to make helpful, cool, and groundbreaking projects with Tensorflow Lite for Microcontrollers. In order to see the project to completion, I divided up the tasks that needed to be done into four sections.
- Data Collection
- Training and making the model
- Writing the Arduino sketch that will use the model to infer on new data
- Building the user interface
- For Data Collection I used the Tiny Motion Trainer by Google Creative Lab. Following their instructions, I connected to their online interfaceand used the following settings:
- Capturing threshold: 0.08
- Number of samples: 50
- Delay between captures: 0.2s
- I captured 30 data samples for each of walking, sitting, and standing. I then downloaded the csv files to use for training the model.
- I trained my model on Google Colab using the fitness_model_trainer.ipynb script I wrote. I could have used the inbuilt trainer in Tiny Motion Trainer, however, I decided to write my own script to try and learn more about using Tensorflow.
- Once the model was trained, I downloaded the model.h file and put it in the same folder as the Arduino sketch. This part of the project was the longest as I initially faced issues using both the ArduinoBLE and Arduino_TensorFlowLite libraries.
- After checking off three items from my task list, I was left with the final task of building the user interface. I decided to use standard web technologies and P5.js as I'm comfortable with using these technologies. The whole project took me a month to build and it was an amazing learning experience.
- Build an android app as the user interface
- Build a dynamic site that stores data in a database and stores activity for each day
- Implement more activities eg: running
Thank you for taking a look at this repository!
~ Ushan Fernando😀💻