Activity Tracker + Yoga Pants
![IMG_0853.jpeg](/proxy/?url=https://content.instructables.com/F4G/TOBQ/K9YKX766/F4GTOBQK9YKX766.jpg&filename=IMG_0853.jpeg)
This project was designed to monitor your activity and remind those who have been sitting or inactive for a long period of time to move around and take a break.
Supplies
![IMG_0838.jpeg](/proxy/?url=https://content.instructables.com/F68/WJ6P/K9YKWQ63/F68WJ6PK9YKWQ63.jpg&filename=IMG_0838.jpeg)
![IMG_0839.jpeg](/proxy/?url=https://content.instructables.com/F3D/7UEY/K9YKWQQL/F3D7UEYK9YKWQQL.jpg&filename=IMG_0839.jpeg)
![IMG_0845.jpeg](/proxy/?url=https://content.instructables.com/FG0/XEBG/K9YKX40C/FG0XEBGK9YKX40C.jpg&filename=IMG_0845.jpeg)
- 2 BBC Microbits
- 2 battery packs
- 1 pair of yoga pants
- thread (color of your choice)
- sewing kit
Programming Your Activity Tracker (1st Micro:bit)
![m1.jpeg](/proxy/?url=https://content.instructables.com/FU6/60UC/K9YKWPW1/FU660UCK9YKWPW1.jpg&filename=m1.jpeg)
I have listed the code below that I used to measure how many steps the individual was achieving.
Additionally, there is code to program a clock to keep track of the time and the elapsed time between steps. This elapsed time triggers the second micro:bit to play a sound and show an emoji when too much time has passed between steps.
//
input.onButtonPressed(Button.A, function () {
if (hours < 23) { hours += 1 } else { hours = 0 } })
input.onButtonPressed(Button.B, function () { if (minutes < 59) { minutes += 1 } else { minutes = 0 } })
input.onButtonPressed(Button.AB, function () { adjust = hours if (ampm) { if (hours > 12) { adjust = hours - 12 } else { if (hours == 0) { adjust = 12 } } } time = "" + adjust time = "" + time + ":" if (minutes < 10) { time = "" + time + "0" } time = "" + time + minutes basic.showString(time) })
input.onGesture(Gesture.Shake, function () { step += 1 prevStep = step elapsed = input.runningTime() - t0 actual_elapsed = Math.idiv(elapsed, 1000) radio.sendNumber(actual_elapsed) })
let elapsed = 0
let prevStep = 0
let actual_elapsed = 0
let time = "" let t0 = 0
let hours = 0
let minutes = 0
let adjust = 0
let ampm = false
let step = 0
step = 0
ampm = false
adjust = 0
minutes = 0
hours = 0
t0 = input.runningTime()
radio.setGroup(77)
basic.forever(function () { basic.showNumber(step) })
//
Programming Your Activity Notifier (2nd Micro:bit)
![m2.jpeg](/proxy/?url=https://content.instructables.com/FID/2FDI/K9YKWPW3/FID2FDIK9YKWPW3.jpg&filename=m2.jpeg)
This code here is needed to program the second micro:bit to show us an emoji and play a sound when too much time has passed between steps.
//
radio.onReceivedNumber(function (receivedNumber) {
if (actual_elapsed >= 10) { basic.showIcon(IconNames.Asleep) music.beginMelody(music.builtInMelody(Melodies.Prelude), MelodyOptions.Once) } basic.showNumber(actual_elapsed) })
//
Getting Your Yoga Pants Ready
![IMG_0847.jpeg](/proxy/?url=https://content.instructables.com/F40/01YZ/K9YKX6HU/F4001YZK9YKX6HU.jpg&filename=IMG_0847.jpeg)
Here I modeled the best placement for the micro:bit to be in order to capture the most accurate steps and activities. I ended up choosing the left side of the pants due to the placement of the hidden pocket which was perfect for holding the battery pack.
Put Everything Together!
![IMG_0849.jpeg](/proxy/?url=https://content.instructables.com/FPE/O3M7/K9YKX6ND/FPEO3M7K9YKX6ND.jpg&filename=IMG_0849.jpeg)
![IMG_0850.jpeg](/proxy/?url=https://content.instructables.com/FVZ/EC00/K9YKX73W/FVZEC00K9YKX73W.jpg&filename=IMG_0850.jpeg)
In order to put everything together, I used a pair of leggings that already have a hidden pouch in the waistband area. This allowed me to tuck the battery pack for the micro:bit into a place where it wouldn't fall to the ground and made it easily removable. I then sewed a loop on the leggings to control the wires that was big enough. This also made the micro:bit more removable and also controlled where on the hip it was placed by the user.
In the Future...
In the future, there are numerous improvements I would make in order to take this project to the next level. If I had had more time and had taken more time to think about the materials I had needed, I would have used an Arduino or Lilypad. These platforms would have likely allowed for a more versatile and flexible approach to what I actually wanted to do. I think these platforms are more flexible coding wise as well.
Additionally, I would have liked to embed flex sensors or bio sensors into the yoga pants to output even more data for the user. These sensors could take your body temperature and outside temperature and measured it over time. The flex sensors could have probably given a more accurate movement output as well, which could have improved data measurement as well.