|
Danny's Lego Mindstorms® RCX 8 Input Multiplexer |
| Home/ Sensors/ Lego proximity sensor |
Disclaimer
This page is not connected with or endorsed by The LEGO Company. LEGO, LEGOLAND,
LEGO SYSTEM, LEGO TECHNIC, DUPLO, LEGO PRIMO and LEGO MINDSTORMS are trademarks
of The LEGO Company.

With this wonderful device, you can connect
up to 8 active sensors to one single RCX Input port.
It works bad only for Lego rotation sensors, because of their particular signal,
but it works perfectly with temperature sensors, light sensors, touch sensors...
The project comes from an idea by Michael Gasperi, but I solved problems, such as the limited number of inputs (8 instead of 4) and the limitation about the RCX values that his MUX uses to "tell" which sensor is on.
My Multiplexer does not modify readings from sensors;
The sensors are toggled by switching from touch to light sensor.
When the port is in passive mode for about 20 hundreths of second, it automatically reset, toggling the first sensor: this is obtained using a particular power-on-reset net. This way you know walways which sensor is being reading.
It's incredibly useful and easy to use in programs.
For now, I developed
only the circuitry, but I haven't built yet a final version on PCB or somewhat
else.
The display will not be present in the final version, because it distorts readings, forcing output value to 89.
I used it only for the prototype, to test the power-on-reset net.
After long time, here's the schematic:

Here's an example, that stores sensor readings in 8 variables, one complete cycle per second.
| #define p 2 #define t 25 void reset () { SetSensor (SENSOR_1, SENSOR_TOUCH); Wait(p); } task main () { int sens_1=0,sens_2=0,sens_3=0,sens_4=0,sens_5=0,sens_6=0,sens_7=0,sens_8=0; SetSensor (SENSOR_1, SENSOR_TOUCH); Wait(2*p); while (true) { // sensor one reading SetSensor (SENSOR_1, SENSOR_TOUCH); SetSensor (SENSOR_1, SENSOR_LIGHT); Wait(t); sens_1=SENSOR_1; // sensor two reading SetSensor (SENSOR_1, SENSOR_TOUCH); SetSensor (SENSOR_1, SENSOR_LIGHT); Wait(t); sens_2=SENSOR_1; SetUserDisplay(sens_2,0); // sensor three reading SetSensor (SENSOR_1, SENSOR_TOUCH); SetSensor (SENSOR_1, SENSOR_LIGHT); Wait(t); sens_3=SENSOR_1; // sensor four reading SetSensor (SENSOR_1, SENSOR_TOUCH); SetSensor (SENSOR_1, SENSOR_LIGHT); Wait(t); sens_4=SENSOR_1; SetUserDisplay(sens_4,0); // sensor five reading SetSensor (SENSOR_1, SENSOR_TOUCH); SetSensor (SENSOR_1, SENSOR_LIGHT); Wait(t); sens_5=SENSOR_1; // sensor six reading SetSensor (SENSOR_1, SENSOR_TOUCH); SetSensor (SENSOR_1, SENSOR_LIGHT); Wait(t); sens_6=SENSOR_1; // sensor seven reading SetSensor (SENSOR_1, SENSOR_TOUCH); SetSensor (SENSOR_1, SENSOR_LIGHT); Wait(t); sens_7=SENSOR_1; // sensor eight reading SetSensor (SENSOR_1, SENSOR_TOUCH); SetSensor (SENSOR_1, SENSOR_LIGHT); Wait(t); sens_8=SENSOR_1; SetUserDisplay(sens_8,0); //discharge phase reset(); } } |
I invented a new male electric attachment: here it is.
August 2004, schematic update April 2007