Page 2 of 4

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 21:37
by mightor
Good chance that they're still all above the threshold for "on" when pressed.

- Xander

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 21:51
by pbenco
hello
You can multiplex 8 RCX switchs to one NXT sensor port, via I2C, like McNamarra does here: http://www.rjmcnamara.com/2010/06/10/8- ... ensor-mux/
Or use the "old" technique, 4 RCX switchs to one NXT or RCX sensor port, via analogic raw value, all switchs connected to the port by a resistor network, as described here: http://www.techno-stuff.com/swmux.htm.see under specification and technical description

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 22:07
by h-g-t
I don't know if you can really consider the result 'distorted' when it is only meant to register on and off.

The circuit is extremely basic and is just a switch and a resistor. According to this page (http://www.cs.brown.edu/~tld/courses/cs ... nsors.html) the RCX has a 500 ohm resistor but I am sure I saw somewhere that the NXT version uses 800 ohms. Can't be certain about that though. Should be easy enough to check with a meter.

They were never really meant to return anything except on or off and the only reason you get a raw value is probably because they used the same code as for other sensors. Because of variations in the actual resistance (I doubt if they used high-spec components in this situation) you may get a slight difference even if you measured two sensors of the same type.

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 23:02
by mattallen37
doc-helmut wrote:that blows me away!
Could that mean, if I'm using RCX Touch sensors instead of the NXT ones (having different internal resistors), that the returned values could be distorted? :shock:
(actually i intended to use RCX or 3rd company hardware switches for my robot project) :?
Yes it does. It is a proven pact that the RCX touch sensors don't work properly with the touch sensor multiplexers that are available. That was the reason that this multiplexer was made (or one of the reasons anyways). So, as you can see, you can build a really cheap one that supports 8 sensors, and doesn't have a problem with the resistance changing, (not to mention it is about as easy as any I2C interface to build). If you don't want to deal with designing all of the circuit, you could get the Mindsensors PCF8574 kit and solder on 4 RCX wires (cut in half, for 8 ends), and have a nice multiplexer for about $30 worth of products.

Edit: Sorry, I didn't see that there was a second page, with the same answer.

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 23:27
by mattallen37
pbenco wrote:hello
You can multiplex 8 RCX switchs to one NXT sensor port, via I2C, like McNamarra does here: http://www.rjmcnamara.com/2010/06/10/8- ... ensor-mux/
Or use the "old" technique, 4 RCX switchs to one NXT or RCX sensor port, via analogic raw value, all switchs connected to the port by a resistor network, as described here: http://www.techno-stuff.com/swmux.htm.see under specification and technical description
The point, is that a resistor network can cause "errors" with RCX touch sensors.

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 23:32
by HaWe
I actually bought the HT TMux because I wanted a "general" solution and because I didn't want to solder... :((

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 23:50
by mattallen37
The "RAW value" is the number that the NXT senses the ADC voltage is (scaled to 10 bits, based on supply voltage, about 5v). All analog sensors generate a "RAW value" when used with the NXT, and the NXT scales them to the sensor mode you set. For example, in bool mode, anything over about 450 is a 0, and anyhting under is a 1. In percent mode, it takes a window of RAW values, and scales it to the range of 0-100.

The NXT Touch sensor is a simple switch in series with a 2k2 resistor. The sensor either reads 1023 (not pressed) or ~184 (pressed). If you have it in bool mode, it compares those values to 450 (or thereabouts), and if it is less (as if it was pressed and the value is 184), it registers as a 1. If it is not pressed, the value 1023 is greater than the bool threshold of 450, so it is considered 0.

Because the sensor can only return two possible values, 1023 and 184, you can put the sensors into a resistor network, and calculate which sensor(s) is (are) being pressed.

The RCX Touch sensor is a piece of conductive rubber, and two metal contacts (both immobile). The sensor reads 1023 if not pressed, and anywhere from about 40 to about 900 if the rubber comes in contact with the metal contacts (allowing some electricity through). The harder you press it, the harder the rubber gets pressed into the metal contacts, and the lower the resistance (and therefore a lower RAW value). If you have it in bool mode, it compares the values the same as it does for the NXT touch sensor. Anything over 450 is a 0, and anything under 450 is a 1. This means, that if you press it so slightly that it returns a RAW value of over 450, it will register as not being pressed.

Because the sensor can return values in such a wide range, it is not really possible to determine (without a doubt), which sensor(s) in a resistor network is (are) pressed. Pressing one sensor very slightly, could register as pressing two others at a normal pressure. See the problem?

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 23:58
by mattallen37
doc-helmut wrote:I actually bought the HT TMux because I wanted a "general" solution and because I didn't want to solder... :((
Well, unfortunately, the only commercially available solution I can think of, is the HT powered sensor Mux (well, I suppose a second NXT would do the job as well). It costs about $58 plus shipping, so I wouldn't get it just to use RCX touch sensors.

You could try using a solderless breadboard, a PCF8574, two resistors, a chopped NXT wire, and four chopped RCX wires. The only soldering you would maybe want to do, is tinning the stranded wires so they insert into the breadboard easier. That is probably the best solution if you don't want to solder.

Re: Touch Sensor "Raw" value

Posted: 26 Feb 2011, 00:35
by jojoguy14
So, basically, what everyone's is saying is that...the touch sensor can NOT be used as a pressure sensor as it is analog?

jojoguy10

P.S. Thanks for the fast responses! I think this made the high score for most posts during a short amount of time!

Re: Touch Sensor "Raw" value

Posted: 26 Feb 2011, 01:31
by nxtreme
jojoguy14 wrote:the touch sensor can NOT be used as a pressure sensor as it is analog?
Digital, actually. Analog is more like the light sensor.