Mindstorms RCX sensors

From Brickwiki
Jump to: navigation, search




A touch sensor is a grey 2x3 brick, which is 3 plates high, and it has a hole in side away from the sensor for a rod.

  • Touch sensors are expected to be "Momentary Contact Switches", which detect press and release.
  • The included touch sensors are actually analogue; a threshold is used in firmware to create the pressed/released distinction.
  • Touch sensors normally operate in "Boolean" mode, which means true or false (0 or 1).

You can configure a touch sensor in "Period Count" mode, with RCXcc. This will add 1 to the value each time you press and release, therefore:

  • Sensor value is 15
  • Robot hits wall; sensor is depressed
  • Robot reverses; sensor is released and adds one to its value
  • Sensor value is now 16.

I have also found that putting it into "trans count" mode will add one to the value on press, and one on release.

  • If you have a Lego switch you can hook up the wires in such a way as it works as a touch sensor.


A light sensor is a blue and dark grey 2x4 brick, which is 4 plates high.

  • A light sensor detects reflected light from its red light emitting diode; also can detect ambient light. Unfortunately, the red light emitting diode must always be on. In practice, this tends to narrow the effective range of the sensor values. Short of taking apart the sensor and removing the LED, this can usually be overcome by covering the LED with opaque material, say electrical tape. Or you could mount a 1x2 Technic beam in front of the sensor so the LED is covered up but the sensor can receive light through the hole.
  • Light sensors normally operate in "percent" mode, anywhere from 0 to 100 in value.
  • Light sensors can detect IR light; as someone has noted, you can make a proximity detector by sending a message from the RCX, and watching the value of the light sensor. (Note: Light sensor must be facing same direction as IR emitter.) Placing a shield on the top of the sensor to decrease the amount of overhead light falling on the sensor is a good way to enhance its range.


A rotation sensor is a blue and dark grey 2x4 brick, 6 plates high.

  • A rotation sensor tracks how far an axle has rotated through the hole in the middle of the brick. Each full rotation registers as 16 counts; thus, the sensor has a resolution of 22.5 degrees. This is adequate for most applications, but for really precise jobs you might want a little more accuracy (perhaps in making a scanner head that must move just a few millimeters at a time). This can be easily achieved by gearing up the rotational output. Don't worry about losing track of rotation - the sensor has been found to work reliably even connected directly to the shaft of a motor.
  • Rotation sensors can track up to 32,767 increments in either direction before they have to be reset. Rotation sensors are configured as Angle in Spirit.ocx.


A temperature sensor is a yellow and dark grey 2x3 brick, (3) plates high, with a 3-stud long probe sticking out the front.

  • A temperature sensor measures the ambient temperature via the probe on its front.
  • Temperature sensors can be configured as either Celsius or Farenheit.

Sensor Modes


Raw data for RCX PBrick ( Range: 0 - 1023 )

Raw data for Scout PBrick ( Range: 0 - 255 ) According to NQC Programmer's Guide


Logical True/False ( 1 / 0 )


Any change, false->true or true->false, adds 1 to the sensor value


A change from false->true->false adds 1 to the sensor value. i.e. the sensor must go through a complete cycle to increment its value.


Sensor value in percent.


Value represented in Celsius.


Value represented in Fahrenheit.


The sensor's value is counted as Angle steps, 16 counts per rotation. This leads to roughly 22.5 degrees per step. (accuracy will depend on things like lash in your gear trains, slippage of wheels or clutches, and the like)

Personal tools