General Purpose Analog Interface:
The following circuit is a very simple way to input analog signals in the 0 to 5 volt range. The input signal could be from a device like an ultrasonic distance sensor. The RCX should think it has a Light sensor on its input and the voltage will be scaled to about 0v=100 and 5v=0. The effect of R1 on the voltage scaling is shown in the plot to the right.
This circuit should work as a more general purpose analog interface where the RCX thinks it has a Light sensor input. The Opamp provides gain (1+R2/R3) and could be used where the input signal is too small for the 0 to 5 volt range. R1 has a similar effect on the scaling as shown in the plot below. The +7V is an auxiliary output from the circuit to provide about 10mA of power to operate other sensor electronics.
Stef Mientki has pointed out that with the addition of a single NPN transistor you can get a more linear interface than the one above. The circuit below will create a reading from 0 to 100 on the RCX with an input from 0 to 5V.
Click Here to Return to the Main Page