Lego compatible, compact rotation sensor
This rotation sensor is based on a Bourns 3315 mechanical quadrature encoder. The small size of this encoder makes possible to cram the entire rotation sensor in a hollowed 2x3 brick (Bourns makes an even smaller device, referenced 3375 - see the Acrobat datasheet- but I couln't get one). It is also cheap, about $2.
The main difficulty was to obtain the right electrical levels to be fully compatible with a Lego rotation sensor. The first try I made was to simply use a 10K ohms resistor for S1 and a 22K ohms for S2, but the level obtained with S1 and S2 closed was too high, and the RCX counted pulses strangely. So I came up with this design which gives exactely the same electrical levels than the Lego sensor. It works fine, but two problems remains :
With the same mechanical construction, I also built an angle sensor, using a potentiometer instead of the encoder. For another implementation of angle sensor, see Michael Gasperi Simple Angle Sensor