Switch Multiplexer
Go to Home Page

In Stock.       SWMUX    Switch Multiplexer    $24.00                   

This product has been tested with NXT using the Lego NXT conversion cable (W770323).

Switch Multiplexer lets you connect three switches (Touch sensors) to one RCX sensor input.

The Lego Mindstorms RCX has only 3 sensor input connectors.  Many robot designs need more than three sensors.  The Switch Multiplexer lets you attach three Lego switches (Touch sensors) to a single RCX sensor input.  With a few simple decisions, your program can tell which switches are pressed.  A fourth switch may be connected, but it will mask the other switch positions when it is closed.  The Switch Multiplexer only works with Mindstorms Touch sensors, or simple on/off switches you build yourself.  It will not work with any other sensors.

     Switch Multiplexer   .
 

Switch expander connected to RCX       Multiplexer Connection.
 
 


You can program the switch multiplexer just like the Lego light sensor.  Use the Light Sensor block in the Mindstorms program environment to cause program branches.  The switch multiplexer returns eight different values depending on what combination of switches are closed.  In the example below, Motor A will run when switch A is closed.  Motor C will run when switch C is closed.  Both motors run when both switches are closed.

Program for mindstorms switch multiplexer

If you are using Robolab, NQC, or most other programming languages, you can also program the switch multiplexer as an unpowered sensor, and read it in the RAW mode.

For Robolab, use the generic unpowered sensor icons as shown below. NOTE: Early versions of Robolab have a bug where the < and > symbols are reversed in the generic sensor branch instructions. There is a fix available on the Tufts university Robolab web site that corrects the reversed symbols and other bugs.

In this example, Motor A will turn on if any combination of switches is pressed, except for switch C by itself. Switch C by itself produces a RAW value of 881, which is greater than the compare value of 850. See the RAW values in the Specifications section below.

If you are using NXT G-code, program the multiplexer as a temperature sensor and use the raw output from the temperature sensor icon. See the example below.


Bonus switch

A fourth switch may be added, but it operates differently.  This switch is connected to the same RCX input as the switch multiplexer.  Just stack the fourth switch connector on top of the multiplexer cable.  When the fourth switch is pressed, the RCX value will be 100, no matter what other switches are pressed.  This fourth switch is useful to signal an event that can be processed without reading the other switches. When using the Bonus switch with NXT conversion cable you must read the values in raw mode.


Specifications

         Switch        RCX                                 NXT         Switch              RCX                       NXT
        A  B  C     Light sensor     RAW          Light*       A  B  C      Light sensor     RAW      Light*
        0   0   0           0                1023            0             1   0   0         63                  624          60
        0   0   1         22                  881            3             1   0   1         72                  568          75
        0   1   0         39                  775            29           1   1   0         79                  521          86
        0   1   1         53                  692            48           1   1   1         86                  480        100