Over the past few weeks, I decided to make a platform called “Swimbuddy” that allows to swimmers in different parts of the world to train and race each other.
The motivation for this project came from:
My little sister who is a swimmer specializing in open-water and often ends up training close to 20km per day alone since no one else is crazy enough to do it
When I was younger my school, would participate in virtual swim meets where two teams would compete against each other by racing in their own respective pools and comparing their times online later.
Below is my demo video
The project was composed of two parts:
- using computer vision to track the swimmer
- using a micro-controller to display the tracked swimmer’s location at the other pool.
RGB LED strip Display
My first plan was to use a laser which I would rotate with a servo motor to show the location of the swimmer. The laser would be placed in the middle of the pool and rotate. I did not like the idea of trying to find and follow a single dot the entire time, so I decided to try a laser line. However in a laser line the light gets dispersed too much that it is not visible after a few meters. At first I was just trying with a 5mW laser so I tried it with a 100mW laser and it was still too weak. Another problem with the laser is that mapping the swimmer location to the laser’s angle would have to be adjusted for each pool depending on the depth. For pools that vary in depth from one side to the other, this is even more of headache.
Due to these reasons above, I switched to LED strips. Although LEDs are something you need to place on the bottom of the pool, it usually only takes me about 5minutes. I bought 4 LED strips off of amazon, each one being 5 meters for a total of 20 meters. The LED strips cost $30/5meters and have a IP67 rating so they are waterproof to up to 1 meter, However I think going up to 2 or 3 meters should be fine as well.
Smartphone Swimmer Tracking
I created a smartphone app that tracks the swimmers head by looking for pixels in the lane that are close in the RGB scale as the RGB of the swimmer’s head. Once I gather these pixels, I average them (after removing the outliers). Due to the flickering properties of water, tracking lighter colors is a bit more challenging than on land. However darker colors, can be tracked quite well so as long as the swimmer has dark color hair or is wearing a dark cap the tracking works.
Combining the two
When starting the app on the smartphone, I enter the IP address of the laptop I want to send the data to. Once I have the location of the swimmer on the smartphone, I send the data over a web socket to my laptop. My laptop is connected to an Arduino micro-controller which I use to power and control the LED strips. Another great part about the LED strip is that unlike the laser and servo, the strip doesn’t require an external power source.
Want to learn how to maintain strength, endurance mobility and prevent weight gain during a vacation? Grab a free e-book where I offer the short bodyweight workouts and nutrition plan that I use that still allows do this without sacrificing your relaxing vacation.
