Intro: Tamiya 72004 Worm Gearbox Speed Sensor
I wanted to accurately control the speed of the motor in a Tamiya 72004 worm gearbox for a robot I am building. To do this you must have some way to measure the current speed. This project shows the evolution of the speed sensor. As you can see in the picture, the motor drives a worm gear directly attached to its output shaft, then a series of three gears to reduce the speed of the final output shaft.
Step 1: Research Your Options
Generally, to measure the speed of a motor you need some sort of sensor. There are a few options, but probably the most common is an optical sensor, and these can be implemented in one of two ways: reflective or transmissive.
For a reflective sensor a disc with alternating black and white segments is attached to the motor or somewhere along the drive train. An LED (red or infra-red) shines a light onto the disc and a photodiode or phototransistor detects the difference between the light and dark segments by the amount of LED light reflected as the motor turns.
For an transmissive sensor a similar arrangement is used, but the LED shines directly at the photosensor. An opaque vane attached to the motor or gear train (or a hole drilled in one of the gears) breaks the beam, allowing the sensor to detect one revolution.
I will add links to a few examples of these later. This project used the transmissive sensor design, but I tried several variations, as you will see.
Step 2: Photointerrupter MK I
The first method I tried used a high-intensity red LED and a phototransistor. I drilled two holes in the second-last gear in the gear train and two holes in the gearbox casing. This gave me about 5 pulses per revolution of the output shaft. I was pleased that it worked.
Step 3: Photointerrupter MK II
I wasn't happy with the number of pulses I got from the first design. I thought it would be difficult to add a sensor to the motor itself, so I drilled a hole in the first gear driven by the worm and moved the LED and phototransistor. This time the sensor would generate about 8 pulses per revolution of the output shaft.
Step 4: Photointerrupter MK III
I decided that I had to put the sensor on the motor itself, before any reduction gearing, so that I could capture many pulses per revolution of the output, and it turned out to be not as hard as I thought. The final design uses a vane mounted directly on the motor's output shaft. I found a tiny slotted opto switch inside an old 3.5" floppy drive, and mounted that above the motor shaft. I glued an M2.5 nut to the worm gear in the gap between the gear and the face of the motor, then glued a piece of black plastic about 4mm x 5mm to one of the flats of the nut. As the motor turns a series of pulses are generated by the sensor.
Step 5: Conclusion
It is not necessary to buy a ready-made slotted opto switch- an LED and phototransistor mounted in-line with each other is good enough. Depending on your application you might want more or less pulses per output revolution, which will influence the location of the sensor. For this project I realised I needed as many pulses as possible, but it would have been difficult to install an LED and phototransistor next to the motor shaft, so I was fortunate to have discovered the tiny slotted opto-switch in a floppy drive.
The last step is to connect the LED and phototransistor to your microcontroller or other circuitry. I used a 150R resistor to limit the current into the LED, and a 10K pullup resistor on the collector of the phototransistor. The photo below shows the motor being driven with a single AA battery, and its speed measured on a tachometer I built. 6142rpm is the speed I'd expect, given the typical specifications from Tamiya. Every motor will be different, but, by measuring the current speed and varying the supply voltage the motor speed can be controlled accurately.