IR Tachometer With Debounce Code
by wierzbickimc in Circuits > Arduino
60 Views, 1 Favorites, 0 Comments
IR Tachometer With Debounce Code

There are quite a few good IR based tachometer instructions out there, but the IR module I have seems very susceptible to bounce (seeing 10's or 100's of on/offs per transition.) No matter what I did with sensitivity, I could not get an accurate count.
Using the interrupts approach seems like the correct way to go, but also prevents the use of the typical delay() function to ignore bounces. Also, hardware changes were not appealing.
There is also a great instruction for adding debouncing (filtering) to the sketches that use interrupt, but it took me far longer than I'm willing to admit for figure out where everything fit into the code.
This sketch below is a combined application of both.
The intended application is for a diesel MK1 Rabbit. They didn't come with tachometers and I thought it would be cool to use the camshaft gear to count RPM.
Proof of concept video below!
Downloads
Supplies
Arduino Nano
Arduino Nano screw terminal shield
IR sensor module (should have a clear, black, and knob for potentiometer) like this