Introduction: Tamiya 72004 Worm Gearbox Speed Sensor

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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.


vadipp (author)2012-02-04

Hi, thanks for the idea!
How did you "figure out which side was the emitter and which was the detector using a multimeter"?

ejoseph del rosario (author)2011-07-09

hi. shown in the picture at the first part. can use that motor w/ a gear box to become a generator? by putting a blade in the shaft? where can i buy that kind of motor? and the casing of the gear box.? thanks :D

evilgenius 398 (author)2008-08-20


TheInventor (author)2008-03-09

Well done instructable! You had lots of pictures with lots of detail. +1 Added to favs

offlogic (author)2006-08-09

Ame- Checke out the natSemi LM18200 h-bridge driver? It kick the little h-bridges outta the water. it was made to run power seats & power windows, good for 3A continuous at 28 VDC. The Freescale MC33886 is even hardier, and runs up to 7.2 A at 40 VDC. I've got some 1"x2" circuit boards for the Freescale parts. Have you considered using back-EMF to sense speed? No sensor or mods needed, just cut the power for a few millisecods, then read the voltage produced by the motor, proportional to speed. Sure is cheap and easy.

avinashdadialla (author)offlogic2008-01-14

hi. we faced several problems with 33886.. its failing and vcc and ground is getting shorted! can u suggest any precautions to be taken?

dtydc (author)offlogic2006-08-21

You actually don't even need to cut power to the motor to measure back EMF. If you measure the current through the motor and you know the resistance of the motor windings you can figure out how much voltage is being dropped by the motor windings. Once you know that, you know that the rest of the voltage is being dropped by the back EMF "generator" effect. Of course the resistance of the motor windings changes as the motor heats up, but it's a pretty good model. Nothing like an encoder if you want real acuracy though . . .

ame (author)offlogic2006-08-09

Hi, Thanks for your comment. I am actually planning to use the Zetex ZHB6718 H-bridge chip. It is a tiny device rated to 2.5A at 20V, and I have found that the voltage drop on the drive transistors is very small. It's certainly adequate for the Mabuchi motors found in the Tamiya kits. I will mount these on a small piece of stripboard together with some 74-series logic gates to convert my three control signals to switch the transistors. I've seen the back-EMF speed measurement technique, but I haven't tried it yet. For the robot project I wanted to use conventional designs that I have used before. I want to get this robot working, so I can't spend too much time on investigating alternatives at the moment. How about doing an instructable for me?

magiceye (author)2006-11-12

Hi Ame, I was thinking about your project,could you use magnets connected to a Hall effect IC and obtain a voltage to control the speed. I understand that car speedo`s work this way,using a rotating disc (with magnets).

ame (author)magiceye2006-11-12

Yes, this is a common technique. You can attach a magnet to one of the gears, or the output shaft, and place a hall-effect sensor nearby, so that it detects one revolution. If you have a gearbox with metal gears you can use a sensor that detects the individual teeth and gives you a pulse-per-tooth. In a conventional car speedo there is a spinning magnet (driven by a cable from the transmission) which is next to an aluminium disc. The disc is connected to the speedo pointer, and has a spring attached to it to stop it rotating freely. Aluminium is not magnetic, but the spinning magnet induces eddy currents in the metal, which in turn produce a magnetic field proportional to the speed of rotation of the magnet. The spinning magnet then acts on this magnetic field and 'drags' the aluminium disc round, against the spring, and the pointer indicates how much force is being applied, which is proportional to the speed. A

el_roboto_loco (author)ame2007-08-02

Another easy way would be to use an infra-red reflective proximity sensor, and use a little strip of aluminum tape on the gear. The IR reflective sensors are about 50 cents from a surplus store. It wouldn't be a digital output, you'd have to use a comparator or A/D to see the return signal jump up in voltage when the shiny strip of tape went past it. Basically the same thing as using the hall-effect sensor, except the hall effect sensor can give you a digital output, if using the bi-polar digital type hall-effect sensor .

theRIAA (author)2006-08-08



lol sorry I have this habit of fixing everything.

Mohit Don (author)2007-04-10

hi i want ask you about the robot you ARE MAKING?

The Real Elliot (author)2006-11-23

Sweet project, and a cool instructable. Thanks for stepping through all 3 phases. It's nice to see a few solutions to the same problem.

Favorite H-bridges are like (ummm) bellybuttons -- everyone's got one. I'll throw the SN754410 in the ring. Full control over 2 motors, each at 1A. (Or gang them together for serious juice.) And best is that it's un-smokeable -- you can't turn one side's transistors all on at once, which would short the thing out (and burn it up).

But anyway... Nice encoders!

electronicfreak22 (author)2006-10-19

Wow thanks I was just thinking about if you can generate power from a motor I have about a million air hog engaines. Can I get more info on this? Thanks.

stonehenge360 (author)2006-09-28

i have a stupid question. if you have an electric motor, could you run it backwards; turning the gear and producing electrisity out the motor wires??

ame (author)stonehenge3602006-10-01

Hi, It's not a stupid question- and in fact you can turn the motor and produce electricity, although this is known as a generator. Common types of generator are dynamos (found on bicycles for lighting) or alternators (found in cars to charge the battery and run the car electrical system). You cannot turn the gearbox attached to this particular motor backwards because of the worm gear, but you could take the motor out of the gearbox and turn it directly. Why not find a small motor like this and hook it up to a voltmeter then spin it with your fingers? You should get a reading on the meter. Try both the ac and dc settings on the meter, and see what you get.

bored boy (author)2006-08-23

not bad you can use a transistor with binary code to control motor direction and speed

offlogic (author)2006-08-15

Tamiya? "Don't you know you can't stop Godzilla with conventional weapons!?!!" - R. Burr Cooking up a new Instructable on back-EMF system, yeah. Sharing is caring (to a point, anyway).

malgolad (author)2006-08-12

Old computer mouses (not the optical models) are also a great source of opto-electronic parts. You get four phototransitor+led pairs and two encoder wheels out of each one.
Those wheels usually produce quite a lot of impulsions per revolution :

Also, what about driving a very narrow beam through the teeth of one of the gear?

ame (author)malgolad2006-08-12

I agree about the mouse sensors, but, if you have an old floppy drive, but not an old mouse, what are you going to do? The encoder wheel in a (mechanical) mouse does indeed have many teeth, so maybe the opto sensors in a mouse could be used in conjunction with gear wheel teeth.

CementTruck (author)2006-08-09

What kind of robot are you building?

I'm in the process of collecting all the items needed for a remote control lawnmower. So far I have the lawnmower, wheelchair motors, wheels, and batteries, but I still need an alternator, speed controller and RC transmitter(radio). This project of yours might come in handy for me this winter. and to see some RC Lawnmowers that I am trying to emulate. I've had this idea since I was a kid but never had the time, or $$ to do it. Looks like a few people beat me to the punch.

I'll post my Instructables when I finally get to this project.

ame (author)CementTruck2006-08-09

I am building a holonomic platform (or Killough Platform). It has three wheels at 120° spacing, and can translate or rotate itself by adjusting the relative speeds of the three wheels. In my design I have three of these Tamiya motor/gearbox kits driving the wheels. Movement accuracy will be affected by variations in motor speed, so I need to be able to tightly control that, hence I need to be able to measure it. The photo shows the robot as it is, but I still have to add three motor control boards and other bits and bobs. I also have a robot lawnmower project languishing in the spare room. I am using two motors from 12V cordless drills for the drive. I have built a temporary chassis from plywood and tinkered with a MOSFET motor driver, but that's all at the moment. It won't be remote controlled- it will be autonomous.

About This Instructable




More by ame:Tamiya 72004 worm gearbox speed sensor
Add instructable to: