Go Down

Topic: Challenging gearwheel sensor problem (Read 1 time) previous topic - next topic


Hi all,
First of all: Thx to all of you for developing arduino and sharing your knowledge. (Big Fan)

I have a challenging sensor problem:
I have to sense the rotation on 3 DC gear motors - lame and easy problem at the beginning BUT everything is very tiny.
They are the motors for a motorized CCTV lens.

Have a look on the attached images to get an idea. (The scale is in mm)

The thing is, there should be a higher resolution than just one tick per rotation. --> counting the teeth of the gearwheel would do a perfect job.
I have thought on three different solutions:

- using a tiny SMD photointerrupter like this on: http://de.rs-online.com/web/p/photointerrupter/6165670/
Here trying to accurately place it, that one passing teeth of the gear creates a usable signal.
Do you have experience in using them with such small objects (the teeth of the wheel). To increase contrast it would be good to paint them black and do some additional signal processing.  Can I get an analog signal from them?

- mechanically attaching a rotary encoder (with an additional gearwheel) Main problem is the lack of space.  I once had one from a very old mechanical computer mouse. Does anyone know where I can by such things in small?

- trying to resolve the motion of the motor rotor by simply attaching a hall-effect sensor on the outside of the DC motor. (I have no experience in this. It is probably challenging because the magnetic changes are quite weak on such small motors)
Pro on this solution: great resolution because directly the higher frequency signal before the gearbox is grabbed.

Thanks in advance for your ideas.

Greetings Max


Just a totally off the wall thought but if you could find a sensor that when bent produced an electrical signal you could let the end of it ride on the gear teeth. Then as the gear turned it would bend and produce a signal proportional to rotation.

Something like this:
Is probably too long but it looks like it can be shortened.


I think you have two things to sense.
When the lenses are at (either) end of travel, you need 3 or 6 (home) limit-switches also. VCR's use a small hole drilled in the gear with opto-sensor, or microswitches and a cam lobe to find home.

Next, to measure position- a slotted (quadrature) optical encoder wheel, from an old computer mouse, old DSLR lens or plastic cutout from laser print out. A hall-sensor on the motor might work but I have not tried. The gear teeth themselves are really small and aligning the sensor would be difficult.

What I have done is used ~1" plastic tubing to connect a rotary encoder to the mech. shaft. The tubing allows misalignment and stretches snug on the shafts, or use glue/clamps but it's low torque.


Thx so far for you posts.

I liked the idea with the bending sensor. I have checked it and it seems to me that you cannot shorten them.
Also I think the signal to noise ratio of those is not good enough for sensing this small height changes.

To clairify : The lens is commercially available as it is now. There are no limit switches for zoom and focus, there are small mechanical clutches between the motor and the gearbox. So the motor still operates when the mechanics are at the limit. (quite lame or not ?) . So homing the hole system would just be drive to "-" until the motion stopps.
The iris motor is already equiped with limit switches.

Thanks for the idea to check in a SLR camera (this thought was too straigth forward for me..)
If anyone knows a commercial available tiny sensor rotation sensor?   this would be the best. (as this is for research and it should be possible to easily reproduce this thing).
Also it is not nesseary to encode the rotation direction here. I know the direction from the analog motors.


Not to labor the point but it looks like the flex sensors use conductive paint for connections so you could just cut to length and reconnect with paint. I'm sure a differential amp (instrumentation amplifier) would take care of the noise problems.

I'm not sure how big your motors are but you can buy motors with built-in shaft encoders. They are used in various drives and may be available to retrofit. Maybe too much modification though. The smallest separate encoder I'm aware of is still 12mm diameter. Probably too large.


Have you thought about sensing the back-EMF spikes off the motor to gain a "pulse count" to tell whether the motor was turning, and how many pulses-per-revolution, etc (rpm and such as well)? To sense end-stops, monitor the current - if it rises close and fast toward its stall current, then that indicates end-of-travel, and so you should stop the motor.

Not the easiest solution, but one that could work without needing to fit small parts in small spaces...
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.


Here's a thought...  If you have a little semiconductor laser (or other well collimated light source) pointing down at the gear teeth from the side, then as the wheel moves there will be reflections that go to one side or the other depending on which side of the tooth is lined up with the beam.

Place two light sensors either side and they will pick up such reflections.  If the width of the beam is adjusted to the right width they could act as a quadrature detector?  Relies on the teeth being shiny and not scattering too much light though.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Hi all,

thanks for all of you wonderfull ideas.

I liked the back-EMF spikes most. this would be a real elegant solution without additional hardware.

In the meanwhile the photo interrupter I ordered have arrived and they already give quite promising results. (I was supprised that it worked out that good)
Because the open aperture for 2mm was a bit too smal I had to break the thing and solder it to an PBC again.
Find an image and the matlab plot for analog readout attached. I think this works quite robust and is still an easy enought solution.



That looks quite usable. What are the units on the two axes?


this was just the first look on the sensor using this code:

void loop() {
  sensorValue = analogRead(analogInPin);           
I did not know the needed frequency, so for the prototype its "fullspeed". I just copy pasted the output to matlab.

so the axis are:
X: index of the measured output
Y: the analog read signal. ( 0 ... 1024)  so there I am not in a good dynamic range. Probably using the internal 1.1 reverence voltage should be a good idea and I have just used some resistors for the diod and pullup which where available.
Anyhow it seems that the gearwheel tooth are not completly opaque at this wavelength and I will use the analog inputs for "productive mode" 
A slight move of the sensor chainges the datarange, so it could fail if you connect this to digital in and have slight inacurencies on the mounting.


I see. If you only have the one encoder, you could consider using the analog comparator inputs (PD6, PD7) to make sensing when the input is above a certain threshold a little easier. Otherwise, you could condition it external to the microcontroller to make it digital. If you treat it as purely analog, you will have to poll the value more often to catch the transition.

Go Up