Recycled angle-sensor

(last update : 27/12/01)

Several advanced mindstormers already suggested the re-use of these perfect switches which you may extract from an old computer-mouse. The following lines explain how to make an angle/rotation-sensor with a recycled mouse-encoder.

The encoder we are using is made of two IR-LEDs, two photo-transistors, the encoderdisk (45 slots), its axle and a two-slot-panel. If the disk is rotated, alternatively one transistor is hit by the infrared-beam from the opposite LED. In our case there are also moments when none of the transistors is hit and where both are activated.

We transplanted this encoder into a small box of LEGO bricks, then we added an elementary electronic circuit as shown:

T2 T1 Rtheor
0 = no light 0 2M
0 1 10k
1 0 20k
1 1 6k

There are four significant states which make the sense of rotation readable. Driven by the RCX this sensor has the following forward output:

Knowing that the RCX has 10kOhm pull-ups, we may deduce the real resistor-values from this graphics.

R=10000 * x / ( 1023 - x ) cf. Mike Gasperi, 'Extreme Mindstorms'

T2 T1 Rprat
0 = no light 0 130k
0 1 17k
1 0 30k
1 1 13k

The fact that the transistors are not completely disactivated when there is no direct light impact explains the bad low value. 

The shaft-encoder has 45 slots, so we get a higher resolution than the original LEGO rotation-sensor. Generating an event for the high-peaks only, we may count 45 impulses per rotation (8°-resolution). If a second event is used for the low-peaks you get a 4°-resolution. The medium positions may be taken to determine the sense of rotation.

This rotation-sensor should not be used at high speed, because of the event-monitoring time-limits. 


RetourMain Page