Wearable tech has come a long way from digital watches to fully functional smartwatches that can double up as phones. Fitness tracking in particular has become really important- we live quantified lives. We track the number of calories we eat, the number of hours we sleep and of course, the number of steps we walk. The idea is that once you attach a number to something, it becomes easier to have a progressive overload in that direction. Because the human body adapts so well, each day you need to walk a little farther and work out a little harder to get the same results.
At the micro:bit code club here, we started with a basic example given in Microsoft MakeCode - the step counter (Also known as Pedometer) and from there we gave the students total liberty (and a reel of scotch tape!) to see what they could manage to track. And we were in for a surprise!
Step Counter
Above are some of the codes the students tried out for the step counter. One notable thing is that MakeCode gradually moves from giving full blown tutorials to giving instructions and letting students figure things out on their own. The students tried out the step counter, and the watch example, and then combined the codes to switch between the two with the press of a button. The step counter registers a step in response to a shake movement - In a normal micro controller with an accelerometer or IMU like the MPU6050, one would only get raw X,Y,Z acceleration values or at the most - roll, pitch and yaw. It is simply impossible to count repetitions of movements that way unless you see the peaks in a graph and make use of some machine learning algorithm- which is way beyond the scope of what we are trying to do here! But fortunately for us, its very easy to trigger the micro:bit to respond to movements such as tilt left, right, logo up, down etc as seen in the below image.
We got the pedometer up and running pretty quick. Here is a video of one of our students trying it out!
Pushup Counter
Now that the students were done with the step counter example, it was time for them to experiment and see what other exercise they could count. They really enjoy doing pushups (and even compete to do the most pushups!) so they decided to track that. By observing how their upper arms, lower arms, back and chest move during a pushup, and by trial and error, they were able to make a pushup counter. It was a little too sensitive (counted a couple of extra repetitions) and the students are currently trying to make a more accurate version.
Here's a video of one student doing pushups with the counter taped to his back!
Arm Rotation Counter
Perhaps the strangest of the bunch, a couple of students built an arm rotation counter to count the number of times you rotate your arm. This was a very easy example to program for, as they just programmed it to increment the counter by one when the logo/screen faces upwards! here's a video of two students trying their device out, to see who built the better one.
Overall, it was a fun activity. It wasn't complicated, but the students had a ton of fun horsing about in the computer lab (who thought that could be a good thing!) and learning programming in the process. The next time they play a game on their phone that involves tilt to control, they will hopefully know the principles behind it, which is basically taking data from an accelerometer and analyzing it.
Thank you for reading! Any comments/criticism are welcome!
Footnotes:
1.) First article: Micro: Bit code club Post 1: Humble beginnings and a game of Hand Cricket.
2.) Second article: Micro: Bit code club post 2: Radio communication and Electronic Voting Machines!
Top Comments