Precision Positioning Robot by Nicholas H

This project started on the first day of summer vacation after finishing the seventh grade when
I began thinking about how to built a rotary positioning device. Two obvious solutions were
servomotors and stepper motors. There are things about both of these that I dislike. I dislike
servos because their rotation is limited to 180 degrees. The reason that stepper motors aren’t
perfect is because they can’t spin very fast. I decided to use a standard DC motor with an optical
encoder. Once I started building it things got more and more complicated…
     Like most of my projects, almost all of the mechanical structure is built out of Legos. First,
I used sticky-tack to connect an LED to a Lego. This LED functions as the emitter that shines on the
optical encoder. I connected the LED’s leads to the circuit via springs, wire, and masking tape. I
don’t solder unless I can help it; I like to keep my parts reusable for other projects. Next, I
connected a phototransistor (using sticky-tack) so that the emitter LED shone on it. After that, I
built the optical encoder. This was done simply by connecting some Legos to the motor shaft so that
they stuck out at different angles – kind of like spokes on a bicycle wheel, but without the tire
and rim. There were four “spokes”. The spokes stop the LED’s light from reaching the phototransistor
when the motor shaft is at certain positions. Finally, I designed the circuit. The more I designed,
the more I saw how complicated it would have to be. 
     I wanted the motor control circuit to be able to correct the motor shaft’s position if some
external force turned it. The problem was, with only one light sensor I couldn’t tell which
direction the external force turned the motor shaft. After a while, the solution came to me: use the
current generated by the rotation of the motor shaft to determine the direction that it was turned.
If the motor shaft was turned clockwise the current would go one way, but if the shaft was turned
counterclockwise, the current would go the other way. To detect this would require even more
     Finally, I had completed the circuit. It used five bits of memory to remember what it was doing
and which way it was spinning and stuff like that. This information was stored using RS Flip-Flops.
These are circuits, each of which can store one bit. I turned it on. I gave it a clockwise pulse.
This should have spun the motor shaft clockwise until the next spoke blocked the light from the
emitter LED. Instead, the motor shaft started to spin in all weird directions seemingly randomly. I
showed my dad, and he thought that it was pretty cool even though it didn’t do anything useful.
After about five minutes of watching it spin crazily, I realized what was causing the strange
behavior. The motor would spin until the next spoke was in position, and then turn off. This is what
it should have done. Then, the motor shaft’s inertia would cause it to keep spinning a little. This
was ok, ‘cause of the position-correcting-circuit that I had made. As it should have, the circuit
would try to correct the motor’s position, but of course this wouldn’t work for the same reason that
it had to correct its position for in the first place. The shaft would coast, causing the circuit to
try to correct itself again. This would happen over and over. Soon it was completely out of control.
I came up with a solution: when the circuit was correcting the motor’s position, it would use PWM so
that the shaft would spin slowly. Of course, this required more circuits.
     After many hours of work, I had finished. There were two buttons, one for spinning clockwise,
and another for spinning counterclockwise. When a button was pressed, the shaft would spin ¼ of the
way around. After adding some gears, the final gear would spin 1/20 of the way around when a button
was pressed. People who saw it weren’t very impressed, however. I decided to put it on a robot to
demonstrate how it could be used.
     I decided that I would make a tricycle robot. The rear wheels would be driven by one motor, and
the front wheel would be used to steer and would be controlled by a second motor. I didn’t want to
make an entirely different motor control circuit, so I decided to make it so that the same circuit
could control both motors. Each motor would need its own optical encoder, emitter LED, and
phototransistor. The circuit wouldn’t be able to control both motors at once, but that was ok. The
original motor control circuit used an H-Bridge circuit to control the direction of the motor. I
won’t go into the details, but I tried many, many different ways to switch between controlling two
motors, none of which worked, before I thought of the obvious solution: use two H-Bridge circuits. I
also ended up making two current-direction-sensing circuits – one for each motor. One mechanical
problem had to do with turning. I had to add a differential. Finally, after six days, I had
finished. There is one switch and two buttons. The switch determines which motor the circuit
controls, and the buttons are used to give clockwise or counterclockwise pulses.
     This is the largest robot project that I have built yet, and it had many more problems than any
of the other. I decided that the relationship between the size of the project and the number of
problems is not linear; I came up with this equation: problems = size2. The problems were not only
electrical; building the base was very frustrating – Legos work well for building small robots, but
there is a certain size limit past which they get increasingly difficult to work with. My wiring job
isn’t that good. I almost ran out electrical components. I used my last 10k resistor, and almost ran
out of NPN transistors. I had to go to Radio Shack to get more wire. One of the many annoying things
that happened while I was building this robot was that I burnt an LED. One of the methods I have
come up with to prevent short circuits is to tape the leads of all of the electrical components. I
have done this on all of my robots. I have thought of a few other interesting applications for my
motor control circuit. One was an idea that I got from The Robot Builder’s Bonanza, Written by
Gordon McComb. He described a robot that read instructions represented by black and white spots on a
piece of paper that told the robot where to go. If this was built onto my robot, some examples of
instructions given could be “go forward 7 inches, turn right 90 degrees, go forward 46 inches” etc.
Another idea I had was to build a robot arm like ones used in factories that would perform the exact
same motion over and over very precisely. Many things can be built from this motor control circuit.


Length: 11.5”
Width: 7”
Height: 11”
Cost: $5.08 for wire
Time to Build: 6 days

E-mail me at for any questions, comments, or circuit schematics.


Return to The Robot Menu