Fitness 'Count It' - Counts Repetitions and Measures Heart Rate

by LoïcVanDam in Circuits > Raspberry Pi

21 Views, 0 Favorites, 0 Comments

Fitness 'Count It' - Counts Repetitions and Measures Heart Rate

Afbeelding van WhatsApp op 2025-06-19 om 16.25.24_74570b0b.jpg
Afbeelding van WhatsApp op 2025-06-19 om 16.25.24_9a20cb86.jpg

Discover a revolutionary smartwatch designed to elevate your workout experience. Our device utilizes advanced gyroscope and accelerometer technology to ensure you execute your fitness exercises with perfect form. Plus, it comes equipped with a heart rate monitor to track your heart rate and measure a variety of other health metrics. Embrace your fitness journey with precision and insight - the future of smart training is here!

Supplies

Afbeelding van WhatsApp op 2025-06-19 om 14.40.31_2bf3ab4f.jpg

Supplies Used for the Project

  1. 3D Design: Custom-designed components
  2. Wristband: For wearable functionality
  3. Raspberry Pi 5: With necessary powercable
  4. LCD Display: For user interface
  5. Potentiometer: For adjusting visibility settings on the LCD
  6. Vibrating Motor: (You can substitute it with a standard DC motor by adding a weight on top, as demonstrated in my build)
  7. 4 Magnets: For attachment and stability of the lid
  8. Passive Buzzer: For auditory feedback
  9. Small Fingerband: For secure wear
  10. Cables: Various types for connections
  11. Push Button: To Shutdown the Pi
  12. Heat Shrink Tubing: For insulation and protection
  13. Ethernet Cable: For connectivity
  14. Soldering Supplies: Necessary for connections
  15. 1kΩ Resistors: (One for the button and one for the transistor)
  16. Heartbeat Sensor and Pulse Oximeter: (The MAX30102 is the model I used)
  17. Gyroscope and Accelerometer: (I used the MPU6050)
  18. Time: Set aside some free time for making this project

I will include a document with links where you can purchase each of these components if you don't already have them.

Preperations

Schermafbeelding 2025-06-19 144913.png

Step 1: Prepare Your Raspberry Pi

  1. Reset Your SD Card:
  2. Clear the history on your Raspberry Pi by resetting the SD card. Use the Raspberry Pi Imager for this process.
  3. Clone My GitHub Repository:
  4. Once the SD card is reset, clone my GitHub repository. There, you'll find all the necessary files for this project.*
  5. Transfer Files:
  6. After cloning, transfer the github to your newly formatted SD card.


Github URL: https://github.com/howest-mct/2024-2025-projectone-mct-LoicVanDam.git


Now you're ready to move on to the next step!

3D-print Your Design

Schermafbeelding 2025-06-19 145239.png
Afbeelding van WhatsApp op 2025-06-19 om 19.59.45_19939c0e.jpg

I have designed my own custom 3D model, and you're welcome to create your own! Just be sure to include the following necessary holes in your design:

  1. LCD Display Hole: For the display component
  2. Raspberry Pi Power Output Hole: For power access
  3. Ethernet/USB Cable Holes: For connectivity
  4. Small Hole for Off Button: For easy access
  5. Holes for Wristband Attachment: To secure the wristband
  6. Hole for Heartbeat Sensor/Pulse Oximeter: For optimal placement

I have also designed an additional weight for the DC motor to enhance its functionality. I have included these designs in the attachment as well.

Connecting Components

Afbeelding van WhatsApp op 2025-06-19 om 15.43.07_c18f84b5.jpg

In this step, you’ll connect all your components together. Here are the detailed instructions:

  1. Transistor Connection:
  2. Use a transistor for the DC motor or vibrating motor to ensure proper operation.
  3. Direct Wiring to Raspberry Pi:
  4. Connect all cables directly to your Raspberry Pi instead of using a GPIO extension board. This may be slightly more challenging, but it can result in a cleaner setup.
  5. Custom Double Cables:
  6. You may need to create custom double cables for GND, 3V, 5V, SDA, and SCL, as the Raspberry Pi does not have enough of these pins available.
  7. You can either buy these cables or make them yourself.
  8. MAX30102 (Heartbeat Sensor and Pulse Oximeter):
  9. You can choose to keep the MAX30102 sensor inside the box or leave it outside for better measurements, as I have done. The choice is yours!
  10. LCD Display Connection:
  11. Attach the LCD display to the Raspberry Pi. Remember to connect the potentiometer to the V0 pin to ensure the display functions correctly.
  12. MPU6050 (Gyroscope) Connection:
  13. Connect the MPU6050 to the appropriate GPIO slots.
  14. I will provide my Fritzing schematic so you can replicate my setup exactly.


(You can select which GPIO pins to use, but make sure to update the code accordingly. Remember, if you don't change the GPIO pins in the code, your project will not function)

Implement and Test

Schermafbeelding 2025-06-19 154636.png
Schermafbeelding 2025-06-19 154735.png

In this step, you'll open Visual Studio Code. If you don’t have it installed, you can download it from the internet.

  1. Remote Connection to Your Pi:
  2. Establish a remote connection with your Raspberry Pi using SSH. Connect using the format: "username@ip-address".
  3. Access the GitHub Repository:
  4. Open the GitHub repository where I have provided test files for each sensor and component.
  5. Create a Virtual Environment:
  6. Before proceeding, you'll need to create a new virtual environment. You can do this by running the following command in your terminal: "python -m venv your-env-name"
  7. Replace 'your-env-name' with a name of your choice for the virtual environment.
  8. Install Required Extensions:
  9. After creating the virtual environment, install all the necessary extensions listed in the requirements.txt file. Use the following command: "pip install -r requirements.txt"
  10. Testing Components:
  11. Before assembling everything, you will need to test each component to ensure they work properly.


Once you have tested all components and confirmed they are functioning correctly, we can move on to the next step.


Setting Up the Database

Schermafbeelding 2025-06-19 160034.png

In this step, you'll need to add my database to your database application.

  1. Database Software:
  2. I use MySQL and recommend that you do the same, as I am unsure if it will work with other database programs.
  3. Connecting to Your Raspberry Pi:
  4. Once you're ready, establish a connection with the Raspberry Pi using its IP address.
  5. Importing the SQL Dump:
  6. After the connection is made, download my SQL dump file (with or without testdata) in My Github Repository and execute it to generate the database on your Raspberry Pi.
  7. Testing the Database:
  8. Once the database is set up, you can test it with some queries if you wish.


After you have confirmed that everything is working properly, we can move on to the next step.

Assemblying Everything

Afbeelding van WhatsApp op 2025-06-19 om 16.11.25_b02ffdf8.jpg
Afbeelding van WhatsApp op 2025-06-19 om 16.11.25_3b447433.jpg
Afbeelding van WhatsApp op 2025-06-19 om 16.11.24_11d06dcd.jpg
Afbeelding van WhatsApp op 2025-06-19 om 16.11.24_af2340a6.jpg
Afbeelding van WhatsApp op 2025-06-19 om 16.13.48_85b00f8b.jpg

Now it’s time to combine all the components into one complete piece.


I have used hot glue for secure reassembly. If you choose to use a different adhesive, please ensure that it won't damage your components, sensors, or Raspberry Pi.

  1. Placing the Raspberry Pi:
  2. Position the Raspberry Pi in the corner where you’ve created holes for it.
  3. Adding Components:
  4. Repeat the process for the MAX30102 sensor and the LCD display.
  5. For the MPU6050, it’s crucial to assemble it horizontally; otherwise, the sensor may not function properly in accordance with the project requirements.
  6. Creating the Off Button Hole:
  7. If you haven’t already designed it, make a small hole for the off button.
  8. Placing Loose Components:
  9. You can place the passive buzzer, transistor, and potentiometer loosely in the box; it’s acceptable for these components to be unsecured.
  10. Attaching the Wristband and Fingerband:
  11. Insert the wristband into the designated holes. For the fingerband, it can be placed loosely, but if you shimmy it in a bit, it will be secure enough for use.
  12. Optional Cable Reinforcement:
  13. This step is optional, but if you want to enhance the durability of the cables at the soldered connections, consider using heat shrink tubing.

Once everything is glued in place, check for sturdiness. If everything feels secure, we can move on to the next step.


Note: If you choose to place the heartbeat sensor outside of the case, you will need to add longer or additional cables to ensure they comfortably reach your finger.


Final Product

Afbeelding van WhatsApp op 2025-06-19 om 14.23.02_6ea52fc9.jpg
Afbeelding van WhatsApp op 2025-06-19 om 13.09.04_fc1ccdc4.jpg
Afbeelding van WhatsApp op 2025-06-19 om 14.23.02_3aeec07d.jpg

Everything is ready now! Once you power on the Raspberry Pi and run the App.py file, it will start working immediately. I hope you will enjoy using my project. And if you do, please consider leaving a positive review below or on my profile!

If you still have any questions, feel free to message me, and I’ll be happy to assist you! :)