I started by considering various sensing technologies. Switch mats are a bit expensive and would require me to pull up carpeting for installation. Radar and sonar sensors work relatively well for automatic doors but aren't great for pinpoint detection in a confined area. Beam break optical sensors work very well but require wires on both walls. I decided to try a retro-reflective optical sensor because it seemed likely to be reasonably reliable, inexpensive and easy to install. Most optical sensors I've seen use infrared but I worked on a project a few years ago which called for infrared illumination for a video camera and learned that the protective mechanisms built into our bodies to protect our eyes from excessively bright light don't work with infrared so you have to be very careful to limit the brightness of any infrared light which might shine into a living being's eyes. Because of this, I decided to try to use visible light for my sensor.
For this lap counter I defined a lap as walking from the top of the stairs to the bottom of the stairs and then back up to the top of the stairs. I initially considered counting laps by placing a sensor at the middle of the stairs and dividing the number of times the sensor detects me by two (one for down and one for up). Unfortunately, the human body is not fully convex and continuously changes shape while walking so my optical sensor would probably sense me multiple times each time I passed it. I thought I could remedy the situation using techniques similar to debouncing of mechanical switches but thinking about that reminded me of the bounceless switch circuits from the book Engineer's Notebook A Handbook of Integrated Circuit Applications by Forrest M. Mims, III (copyright 1979 by Radio Shack).
All of the bounceless switch circuits in the book use SPDT switches wired to RS latches so that one switch contact activates the Reset input and the other switch contact activates the Set input.
I decided that I could replace the SPDT switch with a pair of optical sensors (one at the top of the stairs and one at the bottom). I then considered that the LEDs for the sensors would probably be the highest power draw in the entire system so it would be nice to have only one of them on at a time. I drew a schematic for a circuit which would use the outputs of the RS latch to control the sensor LEDs and it looked a bit complicated so I tried to figure out a way to simplify it. After about an hour and a half of figuring, I went to bed. Just as I was about to go to sleep, a much simpler circuit occurred to me. I tried following the logic through mentally but quickly realized I was too tired to think straight so I went to sleep.
The next morning, I drew the schematic for the circuit and convinced myself it would work.
I wired a miniature version on a breadboard using photo-interrupter modules I had on hand. The photo-interrupter modules were IR so I wired some visible LEDs in series with the IR LEDs in the photo-interrupter modules to provide visual feedback. I tested the circuit and it worked as expected. I don't know if anyone else has devised and named this circuit but, in case no one has, I call it a bounceless optical switch.
I don't think any exercise program will make me thin enough to fit through the gap in the photo-interrupter modules so the next step is to acquire or make retro-reflective optical sensors.
I searched for existing sensors. I found several which would work at up to 10cm for reasonable prices. I found several which would work at 6m and even longer distances for non-reasonable prices. I did not find any which used visible light so I decided to make my own retro-reflective optical sensors.
I searched for high output visible LEDs with narrow view angles and selected the Vishay VLCS5830 because it had the narrowest view angle (8°) I could find. I prefer surface mount components but could not find any with that narrow a view angle. I then searched for a matching...
Read more »
Cool project, I love that you turned to Mims for a circuit; I still reach for my copy of that book when I need a simple circuit. Wrote this up for the blog, should publish soon. Thanks for the tip!