Inspiration
Some members of our team have just started going to the gym and they mentioned how difficult it can be, to be sure that the work they are putting in is actually effective and being done correctly. Whilst it can helpful to watch youtube videos online and try and replicate them, its very difficult to get active feedback about your exercise form unless you get an experienced person to help you. This is where we thought we could help. Leveraging our technical skills we thought we could make some sort of a system to check exercise form using sensors and have this information displayed neatly for the user and that's when Workout Guru was born.
What it does
At this stage, Workout Guru is specifically designed to help perfect pushups. It checks for form and contains details about the number of reps and sets of pushups the user needs to do to achiever their specific exercise goal, whether that be muscular strength of muscular hypertrophy(size). It actively checks the form whilst the user is doing the exercise.
How we built it
We connected an HC-SR04 Ultrasonic sensor to the GPIO pins of a raspberry pi using the trigger and echo pins to calculate the time difference between the sound being triggered from the sensor and then being picked up alongside the known speed of sound to calculate the distance between the ultrasonic sensor.
We then were able to code a program in python using the RPi.GPIO open source library to be able to create a program which does the process mentioned above in a continuous loop and if it detects a value below a certain threshold it sends the information over using the python sockets library to another device which is running the UI.
The UI itself was created using the customtkinter library in python which has runs its own mainloop to display the UI, hence to be able to communicate between the ultrasonic sensor loop and this UI loop we used threading and a socket queue so that the UI updated concurrently to the user doing their push ups in the real world.
We then did some research as to what number of sets and rets are best for muscular strength vs muscular hypertrophy and were able to put that into our program to help guide those who are exercising for the first time with Workout Guru.
Challenges we ran into
Being able to communicate between the raspberry pi and an external device was quite tricky for us as the socket connections weren't intuitive since we haven't created something like that before.
Furthermore the communication between two loops and updating the UI loop from an external input was quite challenging since there was no simple way for that which required us to use threading.
Accomplishments that we're proud of
We are quite proud of our ability to use python sockets to communicate information using the a HEADERSIZE method alongside preceding the message with the length of the message and buffering our information in that way so that it isn't mixed up when it is being received.
We were also proud of management of the two loops and concurrent updates of the UI since that took lots of testing to fine tune and ensure that there were no bugs in all parts of the program so neither of the loops froze.
Our UI looks very modern and we are very pleased with how it turned out.
What we learned
We learned about the correct method to transfer information between two devices using sockets. We learned how to using the RPi.GPIO library to code programs using sensors the the raspberry pi's GPIO pins. We learned how to communicate information between two loops and how threading works. We learned about how exercise for strength and muscle size differ. We learned how to create a modern UI in python.
What's next for Workout Guru
Our team intends to add a time of flight sensor to Workout Guru in the future to track form for a variety of different workouts, such as pull-ups, mountain climbers, sit-ups, free weight training, and more.
Built With
- 4x-female-to-female-jumper-wires
- comfast-wifi-dongle
- customtkinter
- hc-sr04-ultrasonic-sensor
- keji-powerbank
- python
- raspberry-pi-1b+
- rpi.gpio
- sockets
- threading
Log in or sign up for Devpost to join the conversation.