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.

Thanks for this tip/walkthrough Gareth. By going one step further it gave me the solution I needed for a prototype robot.

I've slapped a cut down encoder PCB from another robot in place of the QRD1114 and added the control circuit from a servo. I now have a continuous rotation servo with encoder output for accurate positioning.

I understand the counting steps. It will give you relative position from where ever you started. But how about absolute position? Does your setup (also) come with some sort of "zeroing" function? In other words: how do you know where you started from?

I have a second simple encoder that monitors the "flat" on the motor axle (every complete rev. it blips).

when this blips you have synced the motor to its self - from then on you can just count the rotational encoder pulses 360°.....

I use this system on my theo leg project. (which is on hold at momment by the way)

Then on power up all you have to do is drive the motor untill its syncs to the axle and after that all "Coool Runnings"


don't you have pins 3 and 4 switched on your schematic?


You know what, each time that i looked at that schematic i had a funny feeling in my bones that something was not quite right...

Schematic has been amended....thanks goncaloc

If anybody wants to print out discs on transparency, there's always this:


That looks like a neat solution to the problem. Makes me wonder if it is worth modifying the motors at the factory.

Haha - the motor was from your Competition win - (i must have choosen the luckiest junkbox).

Yes "Go For It" - after all, the GM range are probably the most popular Robotic motors. (we want to see this in production)


All you would need are markings on the casing (where to drill) and an upgrade Strip-ey gear pack. (DIY).


Or another idea would be something

like this that could slide into a slot on the casing:-


BTW:- its possible to drill more than one hole, you can drill an extra hole near to the motor and pick up the gear directly driven by the pinion- this gives many more pulses/rev.

BTW2 :- If you can squeeze the QRD1114 down in size then i am sure more bars can be sqeezed onto the gear.


Really nice hack , can we use printed paper for the white black lines and then stick it on the gear ?

Yes this is possible and would look neater......however its easier just to paint the lines on.

i think Paper would not be the best.....as the gearing train has a light coating of oil , so some form of plastic transparency may be better.