Old School Touch Sensor Multiplexing on the NXT
I find that I am often using this approach for getting more touch sensors on my NXT without using multiple ports. So, for the sake of prosperity, I wanted to keep a record of the setup.
If you are have a set of Cybermaster Touch Sensors hanging around, you can multiplex them for use on the NXT. Years ago, these sensors were quite rare, but now they can be readily found on Bricklink for a decent price. For those that are unaware of these sensors, they are the trans-green (clear) touch sensors that come with the Cybermaster kit and look similar to the standard MINDSTORMS RIS ones, but with one significant difference – each of them have an inline resistor so that when the circut is closed, each passes current with a different resistance. In addition to this, the value returned varies depending on which combination of sensors is pressed. So, not only can you detect individual sensors, you can also detect states of multiple sensors being pressed. If my memory serves correct, you can detect 6 sensor states (1, 2 or 3 | 1 and 2 | 2 and 3| 1 and 3 )
You can program these sensors easily by setting them up as temp sensors using RAW values. You will get values between 0 – 1023. You can also code in such a way that you are looking for specific values (eg 655), as when a sensor is pressed, the resistance returns an exact value (it does not float between a number range). Also dont forget that you will need an NXT to RCX converter cable.
Sample RobotC program:
Sample NXT-g program:
NXT-g Cybermaster Touch Sensor Multiplexer
Thanks! I was trying to connect the sensors to my RCX but the setups I tried resulted in very unstable readings. Your setup works much better!