Let's Make Robots!

Rotary Encoder - Hacking a Geared Motor

Rotary Encoder - For positional feedback of a Geared Motor

 My Latest Project "Swiss Milka Cow" needs some Positional feedback on 3 of its motors.

What follows is my Solution using a

Standard Geared Motor and a QRD1114 reflective sensor.

The Mod will give 36 pulses/Rev of the main axle.

That equates to 10° /pulse.

News Extra :- Did same mod to a GM2 motor

(this Yields 50 pulses/Rev) then if you paint 6 bars on the gear then 300 pulses/Rev is possible.


 NoneStreamlink Rotary Encoder link :-

Hacking a Geared Motor


Unscrew the GM Motor casing and carefully crack it open.


Make a Square hole (with a square drill if you have one) just big enough to accept the QRD1114



This is the basic circuit i use - i "Free Formed" the circuit and encased it in Hot Glue for protection

Be careful to follow the Pin numbers and not the physical layout shown here........


I found that Acrylic paint was the best way to make bars on the Gear wheel.


Every rotation of the main axle means that this gear turn 6 times.

Painting 6 bars around the gear yields 36 pulses/rotation .......thats even now......


To fix the Paint a liberal coating of the "Trouble and Strifes"  clear nail varnish giving a tough surface.


Looking into the "Loch" reveals the simple but effective Black/White Bars.


Glue the QRD1114 as close as possible to the gear wheel surface.


Here it is wired up to my Arduino for Test. (using this Arduino Scope ... thanks Aniss1001).

NB. This is without smoothing capacitor as in the circuit above.

Although the trace looks a bit glitchy the arduino reads the pulses very well.

..........just have to make 3 more now ...........


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Just to be obnoxious, Square Drills ;)

Good tip on the acrylic paint. I learned the hard way that A) Sharpie doesn't work really well on white gears, and B) My European friends don't necessarily know what a Sharpie is.

....leads me to this though ....be careful .....what aver you think or say will materialise in front of your eyes..... everything is possible.

BTW:- Yes i had carefully checked over your Rudolphs Servo Encoder log and found it a really good read (very funny actually).....thats why i tried the "indelible pen" aka "CD Marker pen" aka "Sharpie" first. (the nylon like plastic gears are pretty smooth for taking any colour - i sanded the surface of mine first....made no difference ;-) 

On the GM motor i am using the encoder gear does overlap its neighbour - but there is a "gnats hair" gap between them, so i hope there will be no clashing.

I have just modded a GM2 motor and there is absolute no overlap with this guy .....so my hopes are higher for durability.

And here I sat thinking that was the brand name of the varnish. And wondering why in the world wikidictionary would keep a lemma on that. Thanks for the clarifying link. My regards to Mrs 2941.
I'm eager to see them at work, and more so to take a look at the code you will use to get data from all encoders and keep them all in sync ... (tried that once to no avail ... could not manage to write find the right way to do it :( Maybe I should have another take on it thow ... that was long ago.)

Well luckily the cow is a Slow Beast and i plan to take programming a little on the casual side.

Plan is so - 2 QRDs on each motor - one for Sync reference mounted on main axle (pulses once every rotation) and the second clocking each 10° - 36 steps/rev   ,this may change though.........

....... because i am converting some GM2 Motors and i can for sure get 200 pulses/rev which would mean better resolution.

..... however motor "over-run" will be a factor yet to be experienced ;-)

Could it be that if the encoder wheels is positioned so that it is already on a black stripe when it starts a count, that it doesn't see that first transition? So you get 5 transitions (from white to black) the first revolution of the encoder wheel, and 6 for every revolution thereafter.

I would think that after initial startup, you'd get 36/rev though.  Weird. Let us know if you figure that out.

36 Pulses/Rev all ok now....

....must have been a gremlin in the works - (-: or the fact i had High Fever over the weekend :-).

Walkthrough updated........


Such a shame you cannot come with us to Spain! Such a shame! Love your work!