Introduction: Handheld IR-based Tachometer
This Instructable is based on the circuit described by electro18 in Portable Digital Tachometer. I thought it would be useful to have a handheld device and that it would be a fun project to build.
I like how the device turned out - the design could be used for all kinds of other measuring devices by changing the sensor pod, wiring and Arduino code. The fact that it looks like a blaster or a ray gun from a vintage SF movie is just an added bonus!
The tachometer has a trigger and measures while the trigger is pressed. An indicator LED is lit while measurement is in progress. The device can be powered via USB, or a 9V battery. The device will turn on if the USB is connected. If a battery is used, the tachometer is turned on via a power switch.
During measurement, the LCD shows the current RPM on the first line and the average and max RPM on the second line. If the trigger is not pressed and no measurement is in progress, it shows the average and max RPM from the preceding measurement session.
If the IR photodiode is triggered by ambient heat, "HIGH" will be displayed on the LCD to indicate the sensitivity should be turned down. Sensitivity is controlled by a wheel behind the LCD.
To use the tachometer, you need to put something reflective on the turning object you want to measure. A simple light painter's tape works fine. I've also used a dab of acrylic white paint and I've seen people use a shiny metal plate or a piece of aluminum foil glued to the surface. Well glued to the surface, since whatever you are measuring will be spinning quite fast and the reflector will be subject to a lot of centrifugal force. I've had my painter's tape fly off at 10,000RPM.
Music in the video is from Jukedeck - create your own at http://jukedeck.com.
Step 1: The Circuit
At the "nose" of the tachometer is a sensor pod that contains an IR LED and an IR detector. When the detector is not triggered, it should act as a normal diode and pass the current through from positive (long lead) to ground (short lead). When the detector is triggered, it starts letting the current through in the opposite direction - from negative to positive. I found, though, that my detector does not seem to ever pass the current in the "normal" direction (positive to ground) - your mileage may vary, depending on the detector you get.
When setting up the circuit, we have an option of letting the input port on Arduino be at LOW when there is no signal, or be at HIGH when there is no signal.
If the base state is HIGH, Arduino uses an internal pullup resistor, while if the base state should be LOW, an external pulldown resistor must be added. The original Instructable used LOW base state, while in Optical Tachometer for CNC tmbarbour has used HIGH as the base state. While this saves a resistor, using an explicit pulldown resistor enables us to adjust the sensitivity of the device. Since some current leaks through the resistor, the higher resistance, the more sensitive the device. For a device to be used in a variety of environments, the ability to adjust the sensitivity is crucial. Following electro18s design, I used an 18K resistor in series with two 0-10K pots, so the resistance can be varied from 18K to 38K.
The IR LED and IR diode current are driven from port D2. Port D3 is triggered via RISING interrupt when the IR detector trips. Port D4 is set to HIGH and grounded when the trigger is pressed. This starts the measurement and also turns on the indicator LED that is connected to the port D5.
Given the very limited current that can be applied to any input ports, drive any voltages for reading only from other Nano ports, never straight from the battery. Note also that both IR and indicator LEDs are backed by 220 ohm resistors.
The LCD I used has a serial adapter board and needs only four connections - vcc, ground, SDA and SCL. SDA goes to port A4, while SCL goes to port A5.
Step 2: Parts List
You will need the following parts:
- Arduino Nano
- 16x2 LCD display with serial adapter, such as LGDehome IIC/I2C/TWI
- 2 220ohm resistors
- a 18K resistor
- two small 0-10K potentiometers
- 5mm IR LED and IR receiver diode
- 3mm LED for the measurement indicator
- 5 30mm M3 screws with 5 nuts
- a 7mm diameter or so spring for trigger and 9V battery attachment. I got mine from ACE, but can't remember what the stock number was.
- a small piece if thin sheet metal for various contacts (mine was about 1mm thick) and a largish paperclip
- 28AWG wire
- a small piece of 16AWG stranded wire for the trigger
Before building the tachometer itself, you will need to build the potentiometer wheel for sensitivity adjustment, the trigger assembly and the power switch.
Step 3: STL Files
body_left and body_right make the main body of the tachometer. lcd_housing makes the housing base that inserts into the tachometer body and the housing that will hold the LCD itself. sensor pod provides mounting spots for the IR LED and detector, while battery_vcover makes the sliding cover of the battery compartment. trigger and switch make the printed parts for these two assemblies.
I've printed all these parts in PLA, but almost any material will probably work. Print quality is not that crucial. In fact, I had printer problems (i.e. stupid user errors) while printing both of the body halves and it all still fit well.
As always, when I printed the main parts, various things were slightly wrong. I've fixed these problems in the files in this Instructable, but did not reprint, since I could get it all to work with a bit of scarping and sanding.
I'll attach the OpenSCAD source files to a later step.
Step 4: Sensitivty Adjustment Assembly
I've published this assembly on Thingiverse . Remember, the higher resistance means higher sensitivity. In my build, moving the wheel forward increases the sensitivity. I've found it useful to mark the most-sensitive end on the wheel, so I can visually check how the sensitivity is set.
Step 5: Trigger Assembly
My original design used a bit of wire for contact on the bottom of the moving part, but I found that a thin piece of sheet metal works better. The moving part connect two contacts on the back of the housing. I used a bit of 16AWG stranded wire glued in place for the two contacts.
Step 6: Power Switch
This is the part that gave me the most trouble, since the contacts turned out finicky - have to be just right. While the switch allows for two terminals, you only need to wire up one. The design allows for a spring to force the switch between two positions, but I haven't gotten that part to work.
Glue the leads into the housing. There is not much space in the tachometer body, so make the leads short.
Step 7: Assembly
Dry fit all your parts into the body. Cut two short pieces of the spring and thread them through the holes in the battery mount. The sprint in body_left is VCC, the spring in body_right is ground. I've used body_left to hold all the pieces during assembly.
File the IR LED and detector flat where they face one another - long (positive) lead of the LED should be soldered to the short lead of the detector and to the wire leading to D2 port.
I found it necessary to tack the indicator LED into place with a dab of glue.
The LCD will be a very tight fit into the housing. In fact, I had to sand the PCB of mine a bit. I've increased the size of the housing a bit so hopefully it will fit better for you. I bent the header leads on the LED a bit to have more space and soldered the wires to them - there is no space to plug anything in there. LCD will go correctly only one way into the housing and the base will attach only one way as well.
Solder everything together and fit the parts back in. I had Nano with headers - it would have been better to have a version that can be directly soldered. Make sure that you pull the LCD wires through the LCD base before soldering.
It's all looking quite untidy, since I had left wires a bit too long. Close the body and set the screws.
Step 8: The Arduino Sketch
You will need the Liquid Crystal I2C library to drive the LCD.
If you attach the tachometer to a serial monitor, statistics will be sent over the serial monitor during measurement.
Just in case there is noise, I've incorporated a simple lowpass filter into the algorithm. Three variables in the sketch govern how often the screen is updated (currently every half the second), how often is the RPM computed (currently every 100msec) and the number of measurements in the filter support (currently 29). For low RPM (say, below 300 or so), the actual RPM value will fluctuate, but the average will be accurate. You could increase the filter support to get a more accurate running RPM.
Once you have loaded the sketch, you are good to go!
Step 9: OpenSCAd Source Code
I am attaching all the openSCAD sources. I make no restrictions on this code - you are welcome to modify, use, share, etc., as you like. This also applies to the Arduino sketch.
Each source file has comments that I hope you will find useful. Main tachometer pieces are in the main directory, power switch is in the constructs directory, while the pot_wheel and the trigger are in components directory. All the other sources are invoked from the main part files.
Participated in the