Where I live, the cold months seem to go on forever so I have to find some way to exercise that keeps me indoors. I could afford to go to a gym but it takes too much time, I’d have to show off my old body in public, and I wouldn’t be able to watch re-runs of Charlie’s Angels on a big screen TV. Fortunately, our condo has a partially finished basement which gives us room for a treadmill, a manually operated stationary bike, and that big screen TV. I’ve had a pretty set routine for awhile but I recently read in an AARP bulletin that it’s ok for “seniors” to engage in some forms of High Intensity Interval Training (HIIT). After doing some research I found that one of those techniques could be perfectly adapted for use with my stationary bike. I tried it, survived, and decided that I would try it again but decided that it was a hassle counting seconds for my high/low intervals. Not to worry because I have a shoe box full of micro-controller chips and a lot of free time on my hands.
For the uninitiated, HIIT basically involves a warm up time followed by sequences of high intensity activity followed by low intensity activity. In my case, the recommendation I found has 5 minutes of casual bike pedaling followed by 20 seconds of fast pedaling followed by 90 seconds of casual pedaling. The only thing that varies with the high/low intensity sequences is how many you do. For me the range is generally 4-6 sequences and then a few minutes of cool down. The other thing I found was that HIIT should only be done 2-3 times a week, interspersed with other types of activity. I figured that I could do the HIIT and then the next day do my regular treadmill routine. That works for me but I’m no expert so don’t take this as advice.
The schematic for the timer is pretty boring because it just involves several LED’s connected to the PIC outputs. I built it into a small plastic project box that I fastened to my bike frame with Velcro. I run it on two alkaline AAA batteries with an on/off switch. The LED’s are different colors with green being the one for the low intensity intervals (including the warm up time) and red being the one for the high intensity intervals. The other six LED’s keep a count of the number of intervals completed. Given that the maximum number recommended was 6, that’s what I used. It also was a convenient number because it made the software simple when turning on subsequent LED’s (no need for a counter). I couldn’t decide if I should use yellow or blue LED’s so I alternated them.
The software is also pretty boring as it basically just runs a one second timer and counts seconds for each phase of the exercise from warm up through the intervals. There are defines for the length of the intervals so that is easy to change if you need different values. Timing isn’t critical so I chose to use the 250-kHz internal oscillator to help conserve power.
To get the one second interval I used Timer1 and preset it so it would overflow after the desired count. The desired count for one second is the oscillator frequency divided by 4 (62,500). The overflow generates an interrupt and all of the logic is contained in the interrupt handler. The specific routines are assigned based on which portion of the sequence we are in – warm up, high intensity, or low intensity. The only “fancy” part is that I wanted a warning of when the next high intensity interval was coming. To do that I simply determined if there was less than 10 seconds left for the low intensity interval and then turned the green LED on/off every other second. The sequence count LED’s are all assigned to PORT C so a simple shift of a “1” bit will light the next one while keeping the previous ones lit. The high/low intervals don’t stop after all of the LED’s are lit so if you want more sequences you can easily add code to reset the LED’s and start lighting them again. That’s it for this simple project. Check out my other projects at: boomerrules.com