Motor Speed/Torque Sensor
It would be helpful to know how much a motor is being loaded or even if it is stalled. This sensor can be used to determine the speed of a powered motor. Generally a motor slows down as load is applied to it, so the torque can be measured as well. The sensor is hooked in parallel with a motor output and is also connected as a sensor input.
To understand how it works you need to understand how the RCX produces motor output power. It makes variable output power by rapidly turning on and off the output. For the lowest power setting it turns on for 1 count and off for 7 counts and for the second to the highest power level it is on for 7 and only off for 1. The very highest power level is on all the time. This is called pulse width modulation or PWM. When the RCX has the power off, the motor keeps spinning due to momentum and actually works like a generator. It produces a voltage that is directly proportional to its speed. Eight volts is about 380RPM for a mini-motor, 0 volts is obviously 0RPM, and so 4 volts would be 190RPM.
This sensor watches the motor voltage during the RCX off period and sends the value of it back to the RCX where it can be read like a Light sensor reading. The circuit is shown below. D1-D6 along with C2 makeup the usual powered sensor interface. D8-D11 rectify the voltage applied to the motor while R5 and R6 step it down to a 5V full scale value. D7, C3 and R4 are used to measure the peak voltage that the RCX is applying during the on periods. U1B compares this peak on voltage to the voltage across the motor. If the present voltage is less than the peak then RCX must be in an off period and analog switch U2 (4066) is told to close. This passes the motor (really generator) voltage to low pass filter R2 and C1, buffer U1A and out to the RCX through R1. The scheme doesn't work for the highest power setting since there is no off period to measure. I added R3 across the switch so that the sensor will still detect motor voltage in this case, but it is the applied on voltage, not the speed.
In operation the sensor input is configured as a Light sensor. The reading will be 0 for a motor at full speed and 100 for a motor that is stalled. This may seem backwards, but you can also think of the reading as torque where 0 is 0 torque and 100 is full torque.
Click Here to Return to the Main Page