Touch Sensor "Raw" value

Discussion specific to the intelligent brick, sensors, motors, and more.
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: Touch Sensor "Raw" value

Post by mightor »

Good chance that they're still all above the threshold for "on" when pressed.

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
pbenco
Posts: 71
Joined: 29 Sep 2010, 09:43
Contact:

Re: Touch Sensor "Raw" value

Post 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
pbenco.wordpress.com/
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: Touch Sensor "Raw" value

Post 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.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Touch Sensor "Raw" value

Post 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.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Touch Sensor "Raw" value

Post 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.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: Touch Sensor "Raw" value

Post by HaWe »

I actually bought the HT TMux because I wanted a "general" solution and because I didn't want to solder... :((
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Touch Sensor "Raw" value

Post 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?
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Touch Sensor "Raw" value

Post 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.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
jojoguy14
Posts: 155
Joined: 29 Sep 2010, 12:49
Contact:

Re: Touch Sensor "Raw" value

Post 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!
Creator of LEGO-X TechN'XT! (http://lego-x.com http://techn-xt.blogspot.com)
Known as jojoguy10
nxtreme
Posts: 246
Joined: 29 Sep 2010, 03:53
Location: 192.168.1.2

Re: Touch Sensor "Raw" value

Post 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.
One King to rule them all, One King to find them,
One King to bring them all and in the darkness bind them
On Earth where Shadows lie.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest