1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Touch Sensor "Raw" value

Discussion specific to the intelligent brick, sensors, motors, and more.

Touch Sensor "Raw" value

Postby jojoguy14 » 25 Feb 2011, 19:50

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
Creator of LEGO-X TechN'XT! (http://lego-x.com http://techn-xt.blogspot.com)
Known as jojoguy10
User avatar
jojoguy14
 
Posts: 155
Joined: 29 Sep 2010, 12:49

Re: Touch Sensor "Raw" value

Postby mightor » 25 Feb 2011, 20:27

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
| 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)
User avatar
mightor
Site Admin
 
Posts: 1060
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands

Re: Touch Sensor "Raw" value

Postby philoo » 25 Feb 2011, 20:45

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
Philo
User avatar
philoo
 
Posts: 76
Joined: 29 Sep 2010, 09:04
Location: Paris, France

Re: Touch Sensor "Raw" value

Postby doc-helmut » 25 Feb 2011, 20:45

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 :(
regards,
HaWe
±≠≈αγδεωΔΦΣ∫√∅∞
NXC CHESS for NXT: http://www.mindstormsforum.de/viewtopic.php?f=70&t=6790
indispensable for NXC + EV3-C: easy + trouble-free network & sensor+motor remote control for rs485, BT, USB!
User avatar
doc-helmut
 
Posts: 2424
Joined: 29 Sep 2010, 14:25

Re: Touch Sensor "Raw" value

Postby mightor » 25 Feb 2011, 20:48

I stand corrected :)
| 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)
User avatar
mightor
Site Admin
 
Posts: 1060
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands

Re: Touch Sensor "Raw" value

Postby h-g-t » 25 Feb 2011, 21:13

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.
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.
h-g-t
 
Posts: 548
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: Touch Sensor "Raw" value

Postby mightor » 25 Feb 2011, 21:22

This is also how the HiTechnic Touch MUX and the Mindsensors Touch MUX work. It's a resistor network in both cases.

- 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)
User avatar
mightor
Site Admin
 
Posts: 1060
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands

Re: Touch Sensor "Raw" value

Postby doc-helmut » 25 Feb 2011, 21:30

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) :?
Last edited by doc-helmut on 25 Feb 2011, 21:33, edited 2 times in total.
regards,
HaWe
±≠≈αγδεωΔΦΣ∫√∅∞
NXC CHESS for NXT: http://www.mindstormsforum.de/viewtopic.php?f=70&t=6790
indispensable for NXC + EV3-C: easy + trouble-free network & sensor+motor remote control for rs485, BT, USB!
User avatar
doc-helmut
 
Posts: 2424
Joined: 29 Sep 2010, 14:25

Re: Touch Sensor "Raw" value

Postby mightor » 25 Feb 2011, 21:31

I don't have those but I'd say so :)

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

- 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)
User avatar
mightor
Site Admin
 
Posts: 1060
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands

Re: Touch Sensor "Raw" value

Postby doc-helmut » 25 Feb 2011, 21:32

no: no new world has opend - a world threatens to sink :cry:
regards,
HaWe
±≠≈αγδεωΔΦΣ∫√∅∞
NXC CHESS for NXT: http://www.mindstormsforum.de/viewtopic.php?f=70&t=6790
indispensable for NXC + EV3-C: easy + trouble-free network & sensor+motor remote control for rs485, BT, USB!
User avatar
doc-helmut
 
Posts: 2424
Joined: 29 Sep 2010, 14:25

Next

Return to Mindstorms Hardware

Who is online

Users browsing this forum: No registered users and 0 guests