Working with Rotation Sensors  PART I


What if you wanted Roverbot, or any other robot, to travel 66 inches and then stop? Working with touch or light sensors you got it to stop when the sensor state changes (pressed or released for the touch sensor; light or dark for the light sensor). Using the On For command, you estimated the amount of time it would take the robot to travel a certain distance, then tested it in a program.

In this activity, you will figure out how to program a robot to travel a certain distance using input from a rotation sensor.


What you will need:

Rotation Sensor

Hand-cranked wheel

A calculator (optional)



What to do:

If this is the first time that you are working with a rotation sensor, you will have to add the sensor to the Sensors bin and prepare your RCX to display rotation sensor data.


To add the rotation sensor to the Sensors bins, do the following:

  1. Click on Settings in the Main Menu.

  2. Click on Advanced.

  3. Select the Rotation Sensor by clicking the box next to it.

  4. Click on Accept.

Tech Guide


In order to use the View button to check rotation (axle turning) information that is being read by the sensor, you must first download a program that uses a rotation sensor, and run it at least once, similar to what you’ve done with the light sensor.


To prepare your RCX to display rotation sensor data, do the following:


  1. Recreate the following program. Note that each Sensor Watcher is connected to a different input port, 1, 2, or 3 as shown by the numbers on the lower right hand side of each watcher.





© The LEGO Group



  1. Download the program onto your RCX.

  2. Run it.


Your RCX is now ready to display rotation sensor data when the View pointer points at the rotation sensor input port.



About the Rotation Sensor

When we say that an axle (or a wheel) completed 1 rotation, it means that it turned one full circle, returning to its starting position.

A Rotation Sensor measures how much an axle connected to it turns. In the starting position, as you turn on the RCX, the sensor value is 0. When the axle turns in one direction, the sensor value displayed on the RCX increases; it decreases (indicating a negative number in some cases) as the axle turns in the opposite direction.



A. Taking Rotation Sensor measurements using a hand-cranked wheel.

  1. Build the hand-cranked wheel. Follow the building instructions below.


  1. Turn on the RCX.
  2. Press the View button until you see a small arrow pointing to input port 1.
  3. Crank the wheel clockwise and watch the number change on the display window.
  4. Crank the wheel counterclockwise. Look at the display window. How does the number change?


B. What is the rotation sensor value when an axle (or a wheel) turns a full circle, called a rotation?

  1. Place your hand-cranked wheel and RCX on a clean sheet of paper the size of a notebook page.
  2. Mark a short line on the paper perpendicular to the wheel as shown in the illustration.
  3. Turn off the RCX.
  4. Turn the wheel so that the handle is exactly above the line (move your head side-to-side as you check it).
  5. Turn on the RCX and set it to View Port #1. (It should read 0).
  6. Turn the wheel clockwise until the handle returns to its original position (a complete turn).
  7. Record the rotation sensor value shown on the display window on the 1st reading line below.
  8. Repeat steps 3 through 7 two more times.




Rotation Sensor values: 



1st  reading  


 2nd reading    


 3rd reading   







Important Note: It’s important to turn Off the RCX, and then On again before each trial so each reading starts at 0.


  1. Calculate the average sensor value and write it on the line above. How close are you to 16?


In fact, when an axle turns full circle—1 rotation—the sensor value is 16. You can think of it as the rotation sensor counting 16 ticks as it goes around one rotation, similar to the seconds hand on a clock, counting 60 ticks per minute, a tick for each second.

In other words, when the sensor value is 16, you know the wheel (or axle) has completed exactly one rotation—one full circle.


C. Will it matter if you turned the wheel quickly or slowly—will the sensor value change as you turn the wheel full circle ?


Turn the wheel so that the handle is exactly aligned with the line on your sheet. Turn on the RCX and have the View arrow pointing to Port #1. (Sensor value should be 0).


Turn the wheel slowly until the handle is back to its original position. Write down the sensor value.


Sensor value when turning slowly: __________   Sensor value when turning fast: __________


Now, do the same, only this time turn the wheel fast but accurately, stopping at the line (you can go back a bit if you turned too much).


Does it look as if the speed you turn the wheel affects the rotation sensor value?


D. Will the wheel size matter—will the sensor value change if you replaced the large wheel with a smaller one?


Remove the large wheel and mount a small wheel instead.

Remove this wheel:

Replace it with this wheel:




Turn the wheel full circle clockwise. What is the sensor value? _________



Click here to go to Working with Rotation Sensors Part II