Measuring Speed with Infrared Light

Since the last progress check, I managed to get an Arduino to talk wirelessly with a custom iOS app via Bluetooth. Outside of the technical feat, it wasn’t a particularly interesting experience so I’ve been spending a lot of time rummaging through electronic shops looking to find a fuller, funner destination with this project. Today’s update is a pit-stop towards one such destination that will require the ability to measure the speed of a bike – or more specifically, the time it takes a wheel to make a complete revolution. I added the requirement that whatever measurement thingy I build could easily be added to any kind of bike (ie mountain bikes, touring bikes, cruiser bikes, cycle trainers, horizontal trainers, tricycles, big wheels, etc) in a in a non-invasive way.

With that in mind, I started looking at optical ways of measuring speed. The general idea is this: shine an invisible infrared light at a rotating object and count its break-beams through a special IR sensor. A common use is to measure a CPU fan’s RPM by placing an IR light on one side of the fan, an IR sensor on the other end, and counting how often the beam is broken (divided by the number of fan blades). With something as large as a bicycle wheel, it’s impractical to synchronize an IR light with a sensor on both ends, so my plan was to measure the reflection instead of the break-beam. In theory, I could keep both light and sensor on the same side so long as I could get a consistent reflection from a registration point on the wheel once per revolution.

I started building an optical tachometer from scratch, but midway through I came across this convenient little $2 reflective IR sensor on Adafruit. It’s an LED and a phototransistor built into a convenient little plastic case that ensures that their targets concentrate on a shared point.

reflectiveIRSensor.jpgI found that the sensor was not terribly accurate on its own and had different readings in different lighting environments. Sometimes it had the desired effect of only picking up reflections from white/shiny surfaces, but other times I would get false positives from my hand or even matte black surfaces (this would be a problem for a bike tire). To fix this, I added a potentiometer to calibrate the sensor’s sensitivity based on the environment. I also added an LED to give visual feedback whenever the sensor detected IR reflection. These two things worked out really well!

IMG_4974

Next, I needed a way to position the tachometer (and get it out of my messy breadboard situation). I arranged all the components on a small perf board. For my first time doing anything off the breadboard and with no prior electronics experience, I thought the breakout turned out pretty good! I was just pleasantly surprised it still worked!

 

opticalTachometer

For the connection to the Arduino Uno, instead of using conventional 22 gauge wire, I naively bought and used 18 gauge – thicker and harder to plug into the standard pin holes. Turns out, the thickness of the wire was a good thing because it provided enough strength to mold its shape and get the sensor in precise orientations like a goose neck lamp so I ran with it and wrapped it with some shrink wrap. Here is it is with the Arduino board and BLE breakout as a consolidated thingy:

opticalTachometer2

If I were going to iterate on the hardware, it’s very possible this could be 1/4 of its size or less. There seem to be quite a few mini Arduino boards with built in BLE now and if I had more practice I could definitely get the components to be much more tightly packed together. It’s really tempting to try because I think it could be a really fun and focused challenge, but I’ve got to move along.

Next update: Software

5 responses to “Measuring Speed with Infrared Light”

  1. I loved your project but I need a same project details because I am doing my final year project with IoT.So I think so you could help for me.
    My project is vehicle speed detection by IR sensors and it can be monitoring through connecting the arduino in artik cloud service.

Leave a reply to Rajesh kanna G Cancel reply