(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:
|0 = no light||0||2M|
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'
|0 = no light||0||130k|
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.