Although LEGO's light sensor is a powered device, the CdS photoresistor is a passive device. This means that you can't blindly configure the photoresistor input as a light sensor input. You
should, instead, make sure the sensor is not powered and read the raw input values.
In NQC, for example, you can configure the input as follows:
SetSensorType (SENSOR_1, SENSOR_TYPE_TOUCH);
SetSensorMode (SENSOR_1, SENSOR_MODE_RAW);
You'll have to experiment to find out what kind of values you get for different lighting conditions. Darker lighting will produce higher sensor readings, while bright lighting produces lower sensor
readings.
Temperature Sensors
A simple device called a thermistor can be used to make a temperature sensor. The thermistor has a resistance that changes according to the temperature. By measuring the resistance of the
thermistor, you can figure out the temperature.
Thermistors are widely available and cost only a couple of dollars each. Chances are, however, that your device won't have the same electrical characteristics as the official temperature sensor.
Thus, your temperature readings will be off slightly. If you are concerned about correct temperature readings, rather than just sensing increases and decreases in temperature, you may want to
convert raw sensors readings into temperature values yourself.
Powered Sensors
It's a little harder to attach a powered circuit to the RCX. Remember, there are only two wires connecting the RCX to each of its sensors. For powered sensors, these wires alternately power the
sensor and read its value.
Active Sensor Magic
The designers of the RCX pulled some magic out of their electrical engineering bag to
enable active sensors. The following figure shows a diagram of an RCX input in active
mode:
The active mode circuit looks a lot like the passive mode circuit, except for the 8V power
supply. Conceptually, at least, there's a switch S that closes for three milliseconds at a time
to supply power to the sensor. At the end of every power intervals, the switch opens for 0.1
millisecond, and the RCX takes a reading from the input.
Page 222
Need help?
Do you have a question about the MINDSTORMS Robots and is the answer not in the manual?
Questions and answers