go away spammer

Author Topic: 3 lead bumper switch  (Read 3269 times)

0 Members and 1 Guest are viewing this topic.

Offline MangoBotTopic starter

  • Robot Overlord
  • ****
  • Posts: 185
  • Helpful? 1
    • BeginneRobot
3 lead bumper switch
« on: October 08, 2009, 04:18:35 PM »
From the tactile bumper switch i got the idea that when it is "bumped" power does from lead 1 and 2 to 1 and 3(could be different leads) is this correct or am i wrong? if so what does happen when it is switched.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: 3 lead bumper switch
« Reply #1 on: October 09, 2009, 01:38:04 AM »
Hi,

Link please.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: 3 lead bumper switch
« Reply #2 on: October 09, 2009, 01:52:26 AM »
So, what kind of switch is it?
Do the leads have names? Any pictures? Links?
Howdy

Offline MangoBotTopic starter

  • Robot Overlord
  • ****
  • Posts: 185
  • Helpful? 1
    • BeginneRobot
Re: 3 lead bumper switch
« Reply #3 on: October 09, 2009, 04:30:39 PM »
srry forgot to add links and stuff heres one from radioshack http://www.radioshack.com/product/index.jsp?productId=2049718 same thing. but i scrapped mine so that is why the leads might be different.

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: 3 lead bumper switch
« Reply #4 on: October 09, 2009, 04:40:25 PM »
So its a microswitch then?
It should have three legs: COM, NO and NC.
Com should be connected to one side and NO or NC to the other depending on what you want to do.
NO if you want to close a circuit with a bump and NC to open one with a bump.

Finding out which legs are which shouldn't be hard, NC and COM should be connected with the switch up.
Howdy

Offline Neophite_404

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 0
Re: 3 lead bumper switch
« Reply #5 on: October 09, 2009, 05:34:46 PM »
NO and NC stand for Normally Open and Normally Closed. As in, when the switch is just sitting there and no forces are acting on it. NO means that Com (or Common .. to either state) and the NO pin are in connection when the switch is open, and NC is the opposite.

So, say you're using one as a bump switch: You don't want current running though the switch unless you bump into something (and Close the switch). So, you'd connect a line from your Pos. regulated power rail to the COM pin, then run a lead from the NC Pin to your MCU. This means that the switch is open and reading 0 to your MCU unless you bump something. In that instance the switch closes, causes the IO pin on your MCU to read High (ie digital 1) and you have successfully detected a bump. :)

And if your microswitch isn't labeled then you can just pull out your Multimeter and do some testing on the leads to see what does what.

Hope this helps.

Offline walkercreations

  • Full Member
  • ***
  • Posts: 90
  • Helpful? 1
    • walkercreations
Re: 3 lead bumper switch
« Reply #6 on: October 09, 2009, 05:44:17 PM »
That is a SPDT switch. Single Pole Double Throw like the feelers on the Beetlebot. If you go to Instructables and do a search on Beetlebot, there should be an explanation there of what the switch does.
Peter Walker
Fruitland, MD USA

Offline MangoBotTopic starter

  • Robot Overlord
  • ****
  • Posts: 185
  • Helpful? 1
    • BeginneRobot
Re: 3 lead bumper switch
« Reply #7 on: October 09, 2009, 07:36:04 PM »
thanks for the help guys

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: 3 lead bumper switch
« Reply #8 on: October 09, 2009, 08:07:35 PM »
Hi,

[...] So, you'd connect a line from your Pos. regulated power rail to the COM pin, then run a lead from the NC Pin to your MCU. This means that the switch is open and reading 0 to your MCU unless you bump something.
No, that means you have a floating input until the switch is hit!
Allways use a pull-up/-down resistor on the I/O line when a switch is used, or you'd get strange and unpredicted results.

It is better to connect the com terminal to ground and use a pull-up on the input line, to keep the "loose" power wiring at ground potential.
Allways keep the least amount possible of non-ground wires running around your constructions (and those you need - keep them fused).
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline Neophite_404

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 0
Re: 3 lead bumper switch
« Reply #9 on: October 10, 2009, 12:59:47 AM »
That's a good point Soeren. Thank you for adding.

This site: http://www.micahcarrick.com/05-15-2006/avr-tutorial-switch-debounce.html Has a lot to say about a problem with using switches (like that SPDT micro switch as a digital input. The mechanical action of the switch closing isn't actually instantaneous. Those "strange or unpredicted" results that Soeren was talking about. (An O-Scope view of a switch closing will show you all of the fluctuation in signal which equals to a bunch of inputs. (As seen on that link I just posted)).

Also, when the switch is just sitting open there is no definite signal (either 0Vdc (digital 0) or +5Vdc (digital 1)) on that I/O Pin. In that state the pin is said to be floating. (Do I have that concept correct?) So in this case you'd attach your switch as I had said before, but also running from NC pin of the switch would be a fairly high ohm resistor (10K or some such) going to ground. That way, when the switch is open the input pin is pulled low (definitely) and when the switch closes on bump you get that draw from the + rail and a digital 1 signal to your MCU.
« Last Edit: October 10, 2009, 01:21:04 AM by Neophite_404 »

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: 3 lead bumper switch
« Reply #10 on: October 11, 2009, 01:01:47 PM »
Hi,

Those "strange or unpredicted" results that Soeren was talking about.
Please don't put words in my mouth that I have never spoken!
The strange and unpredictable results I referred to was when an input is floating.
I didn't discuss debouncing at all, since that can be dealt with in software.


So in this case you'd attach your switch as I had said before, but also running from NC pin of the switch would be a fairly high ohm resistor (10K or some such) going to ground. That way, when the switch is open the input pin is pulled low (definitely) and when the switch closes on bump you get that draw from the + rail and a digital 1 signal to your MCU.
Not at all, that will still create a floating condition when the switch is shifting (between the n.c. and n.o. contact points).

It's not that hard, just do this:



Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline Neophite_404

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 0
Re: 3 lead bumper switch
« Reply #11 on: October 11, 2009, 10:33:18 PM »
Ahhh, thank you for clarifying things for me.

 


Get Your Ad Here

data_list