Page 1 of 4

Touch Sensor "Raw" value

Posted: 25 Feb 2011, 19:50
by jojoguy14
Hello everyone!

So...the touch sensor has a data plug for the raw value of the touch sensor. I tried using it to create a variable touch sensor (pressure switch), but it only read two numbers. Is there a way to use the raw value to create a "pressure switch"? If not, why is the raw value there???

jojoguy10

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 20:27
by mightor
All analogue sensors have a raw value, as does the touch switch. It's just that when the touch switch closes, you'll create a short circuit, so the analogue value will be "0". When it is open, it will read "1023". There's no in between though, so it's not like a pressure gauge.

- Xander

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 20:45
by philoo
mightor wrote:All analogue sensors have a raw value, as does the touch switch. It's just that when the touch switch closes, you'll create a short circuit, so the analogue value will be "0"
Well... actually it is not a dead short, there is a 2.2k ohm resistor in series with the switch to protect it. So, since the input has a 10k ohm pull-up resistor, the raw value with closed switch is around 1023*22/122=184

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 20:45
by HaWe
no "internal resistance" between the contacts, depending on how tight you press it?
Maybe the values are faked by the firmware, and if you want to read the "real raw values" - : what about configuring it as a "general analog sensor"?

edit... philoo was faster :(

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 20:48
by mightor
I stand corrected :)

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 21:13
by h-g-t
Since it is just a switch with a resistor in line (to limit the current drawn from the port) you are only ever going to get on or off, even if 'on' is not quite a dead short.

I did see a website once where someone had connected a set of switches in parallel into one port, each switch with a different value of resistor. By defining it as one of the analogue sensors he was able to read the various resistances so he knew which switch was pressed.

Saved having to use a separate microchip for multiplexing.

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 21:22
by mightor
This is also how the HiTechnic Touch MUX and the Mindsensors Touch MUX work. It's a resistor network in both cases.

- Xander

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 21:30
by HaWe
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) :?

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 21:31
by mightor
I don't have those but I'd say so :)

A whole new world has just opened up for you, has it?

- Xander

Re: Touch Sensor "Raw" value

Posted: 25 Feb 2011, 21:32
by HaWe
no: no new world has opend - a world threatens to sink :cry: