basics can be found at http://www.extremenxt.com/rotate.htm . The RCX- counter is incremented or decremented after every 22.5 degrees of rotation, if the voltage at the sensor input follows the diagram shown below.
I didn`t use a cam shaft with four cams, but 4 small magnets (3.4 x 4.2 x 4.2 mm3) mounted on a wheel and 2 small reed switches.
assembly: Use 2 small round lego bricks and sand down each side to make them level and flat. That will allow an exact fit of the 4 magnets and prevents rotor friction. Before attaching the magnets with some adhesive please consider the magnets' polarity. It may be necessary to adjust the reed switches even if they are mounted at an angle of exactly 22.5°. The reason for this is that they may have different sensitivities. Use hot glue and initially attach just the connecting leads inside the white brick. That leaves room to readjust the reed switches.
This Rotation Sensor works well and loses no counts - even at full forward or backward motor speeds .
Links: Language NQC official LEGO MindStorms Robobull LeRobot
The author will appreciate any feedback.
copyright: this page may be passed on only as a whole and
this copyright notice
included. in case of commercial use you need the author's explicit permission