Construction Tips

Mounting potentiometers:

Lego holes are 5mm in diameter. This is slightly too small for the Digi-Key CT2206-ND potentiometer. Widen this hole with a 15/64" drill bit. This allows the base of the pot to thread into the plastic snugly, with the shaft centered in the hole. Note this will permanently effect the Lego hole. More on ethics of damaging toys later. :)

The 16T Lego gear fits on the pot shaft pretty snugly. I fount this to be tight enough without ever having problems with slip. You may also add heatshrink tubing to the shaft to enlarge it so that other Lego gears, hubs, etc. fit tightly. If heatshrink doesn't do the trick, use epoxy, but try heatshrink first, as it will give you more flexibility if your parts aren't all permanently stuck to each other. :)

Attaching a marker:

Just a suggestion for the manual:


 Plus a zip tie!

Things to Think About

Absolute vs. Incremental Feedback

Roboticists often deal with feedback and sensing in terms incremental vs. absolute information. An example of an incremental (or relative) feedback device is the clicker on the Wheel of Fortune (the actual wheel they spin). If we know a starting point, we will always know where the wheel is taking into account the number of clicks and direction. However, this method is dependent on constantly monitoring the number of clicks. If we are distracted (subtle analogy: the microprocessor is not fast enough, or over taxed), and miss some counts we will not know the exact position of the wheel. If we are distracted repeatedly, the error can accumulate. Note that missing counts is not the only potential source of error.

Absolute information solves this problem. An example of absolute feedback device is a compass. No matter which way we turn, whenever we look at it, it is pointing to magnetic north.

Each of method of sensing has advantages and disadvantages. 

Non-linear angle relationship due to potentiometer-resistor voltage divider.

The good news is that potentiometers provide a cheap and reliable way of getting angle information. The bad news is that there is a non-linear relationship between the angle and the value read at an analog input port of the Handy Board. Here's the scoop:

If you look at the circuit diagram for the Handy Board analog input ports, you'll see that there are 47K resistors attaching each of the analog input ports to +5 volts. These are called "pull-up" resistors, and are used to "pull" the ports up to +5 so they don't "float" between 0 and 5V, which may cause an computational error.

By adding the potentiometer, we are creating the voltage divider circuit shown below. The voltage out of a circuit divider is given by:

Vout =  Vin * R2

R1 + R2

Potentiometer / Pull-up Resistor
Voltage Divider


  • Vout is the voltage read by the analog input
  • Vin is +5V
  • R1 is 47*10^3
  • R2 is the variable

So plugging into the equation, we get:

Vout =  5 * R2

47,000 + R2

...and graphing Vout in terms of R2 looks like this. More good news is that while the relationship is non-linear, it is close to linear over the working range of the potentiometer, R2 (working range is 0K to 25K). So, to summarize, you can model this relationship as linear in your program.

The gear backlash problem

Gear backlash is the "slop" in a joint that results from the space between the gears, and is a common problem to many mechanical systems. Think about how you can write your program so that is is immune to the (relatively large) backlash present in Lego gears. Hint: ask a machinist how backlash is dealt with when using the hand controls on an X-Y table of a milling machine.