Go to Post "THAT'S NOT SAFE!" "But I'm wearing safety goggles!" - Samheartsrobots [more]
Home
Go Back   Chief Delphi > Technical > Electrical
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 29-02-2012, 11:32
mtnteam mtnteam is offline
3747 - Programmer
AKA: Steven
FRC #3747 (ChaoTech)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Minnesota
Posts: 30
mtnteam is an unknown quantity at this point
Wiring a limit switch.

Question - how to wire a limit switch to the robot.
Question - Is it wired with a spike relay, or a jaguar.

Were thinking about adding an arm to get across the bridge. But the only problem is were trying to figure out how to wire a limit switch to the robot. So some programming can be done to interact with it. Is it wired with a spike relay, or a jaguar. Any help is greatly appreciated, and thank you for your time.
  #2   Spotlight this post!  
Unread 29-02-2012, 11:53
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,753
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Wiring a limit switch.

You have two options with limit switches:

1. Wire it into a Digital Input on the Digital Sidecar. This allows your software to read it and take appropriate action (such as turning off the motor). Doing this, you only need to wire it to signal and ground (there's an internal pull-up resistor on the digital inputs).

2. Wire it into a Jaguar that is using CAN (per R61, nothing else can be attached to a Jaguar using PWM except for the coast/break port). For these, there are 4 pins - two control forward direction, two reverse. There are jumpers in there when its shipped. If you go this route, make sure you wire the limit switch so it's "Normally Closed" - in other words, you should be able to measure 0 (or near 0) resistance when the switch is NOT being pressed, and infinite resistance when it is. That way, the Jaguar will automatically stop when the switch is pressed.


Regardless of which way to wire it up, make sure you add some sort of mechanical stop to ensure the arm won't go past the limit switch. Even with it turning off as soon as the switch is pressed, often an arm will continue moving a bit before it fully stops - a mechanical stop will prevent this.
  #3   Spotlight this post!  
Unread 29-02-2012, 12:05
andreboos andreboos is offline
Registered User
FRC #3021 (The Agency)
Team Role: Programmer
 
Join Date: Dec 2009
Rookie Year: 2010
Location: San Diego
Posts: 132
andreboos is a jewel in the roughandreboos is a jewel in the roughandreboos is a jewel in the roughandreboos is a jewel in the rough
Re: Wiring a limit switch.

Just one more option to consider:

If you're out of Digital I/O ports (like I was this year), you can also wire to the analog breakout. Connect +5v and Signal when the limit switch is engaged, and then check in code whether the analog channel reads above or below 2.5V.

Something you have to remember about programming Jon's first option: the channel will read 1 unless signal and ground are connected, in which case it would read zero. That confused me for a while when our limit switches did not work as programmed.
  #4   Spotlight this post!  
Unread 29-02-2012, 13:45
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Wiring a limit switch.

Quote:
Originally Posted by andreboos View Post
Just one more option to consider:

If you're out of Digital I/O ports (like I was this year), you can also wire to the analog breakout. Connect +5v and Signal when the limit switch is engaged, and then check in code whether the analog channel reads above or below 2.5V.
If you are going to connect it using an analog channel, you need some simple circuit than just a switch. If I understand you correctly, you are connecting +5 and Signal to the "Normal Open" or "Normal Close" and "Common" contacts of the switch. In other words, when activated, you either short signal to +5 or leave signal floating. Leaving the signal pin unconnected will read random values. If you really want to use analog channel, you need to use at least one resistor (e.g. a 10K resistor connected between +5 and Signal), then connect the Normal Open to signal and Common to Gnd. When the switch is activated, the signal pin will give you 0V (shorted to Gnd). When the switch is not activated, the signal pin will give you approx. 5V (open).
__________________
  #5   Spotlight this post!  
Unread 29-02-2012, 12:06
mtnteam mtnteam is offline
3747 - Programmer
AKA: Steven
FRC #3747 (ChaoTech)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Minnesota
Posts: 30
mtnteam is an unknown quantity at this point
Re: Wiring a limit switch.

Quote:
Originally Posted by Jon Stratis View Post
You have two options with limit switches:

1. Wire it into a Digital Input on the Digital Sidecar. This allows your software to read it and take appropriate action (such as turning off the motor). Doing this, you only need to wire it to signal and ground (there's an internal pull-up resistor on the digital inputs).

2. Wire it into a Jaguar that is using CAN (per R61, nothing else can be attached to a Jaguar using PWM except for the coast/break port). For these, there are 4 pins - two control forward direction, two reverse. There are jumpers in there when its shipped. If you go this route, make sure you wire the limit switch so it's "Normally Closed" - in other words, you should be able to measure 0 (or near 0) resistance when the switch is NOT being pressed, and infinite resistance when it is. That way, the Jaguar will automatically stop when the switch is pressed.


Regardless of which way to wire it up, make sure you add some sort of mechanical stop to ensure the arm won't go past the limit switch. Even with it turning off as soon as the switch is pressed, often an arm will continue moving a bit before it fully stops - a mechanical stop will prevent this.
So in order to wire the limit switch to the Digital I/O who wire it to a PWM cable to only the signal and GND?
  #6   Spotlight this post!  
Unread 29-02-2012, 12:14
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,753
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Wiring a limit switch.

Quote:
Originally Posted by mtnteam View Post
So in order to wire the limit switch to the Digital I/O who wire it to a PWM cable to only the signal and GND?
Exactly! Typically, people will cut the male header of a PWM cable off, tape off the end of the power wire (the middle wire), and then wire the switch to the outer two wires.

As mentioned by others, the limit switch may work opposite of what you expect! Switches can be wired up as "Normally Closed" or "Normally Open". Depending on which way you wire it, you may read TRUE and FALSE either way. Looking at the case of the limit switch that came in the KoP, you'll see the three ports are labeled "Com", "NC", and "NO":

Hook up one wire to Com - it doesn't matter which one.

If you hook the other one up to NC (Normally Closed), then you'll read FALSE when the switch is not pressed, and TRUE when it is.

If you hook it up to NO (Normally Open), you'll read TRUE when the switch is not pressed, and FALSE when it is.


Our programming team always writes a small test program for sensors - essentially, they just read the value and print it to the consol output. This lets them see which way its wired up, and adjust their code as needed.
  #7   Spotlight this post!  
Unread 29-02-2012, 15:23
andreboos andreboos is offline
Registered User
FRC #3021 (The Agency)
Team Role: Programmer
 
Join Date: Dec 2009
Rookie Year: 2010
Location: San Diego
Posts: 132
andreboos is a jewel in the roughandreboos is a jewel in the roughandreboos is a jewel in the roughandreboos is a jewel in the rough
Re: Wiring a limit switch.

Hmm, all I can say is that it worked fine for us. Our normally open switch reported 0 volts when open and 5 volts when closed, with a bit of noise. The 2.5V threshold accurately detects the two states.

Why would an unconnected pin report random values? Or do you just mean it would be a noisy zero?
  #8   Spotlight this post!  
Unread 29-02-2012, 15:44
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Wiring a limit switch.

Quote:
Originally Posted by andreboos View Post
Why would an unconnected pin report random values? Or do you just mean it would be a noisy zero?
Mostly, it would be a "noisy zero" as you put it. But, if the pin is floating, it could have residual charge trapped since the last closure of the switch. In other words, when the switch closes and you read 5V. Then the switch opens and it may take a period of time for the charge to drain internally from the signal pin. It depends on the analog bumper design, the period could be long since you did not provide a drain path. The best case is that it drained relatively quickly and you didn't even notice it. The worst case is a delay before the signal pin reads 0. For a limit switch to stop something, a delay may or may not be acceptable. Certainly comparing it to 2.5V instead of 0 helps a lot because it is certainly reaching 2.5V a lot faster than 0. In general, it will probably work in your case but not a best practice to float a pin.
__________________
  #9   Spotlight this post!  
Unread 29-02-2012, 23:27
SuperBK's Avatar
SuperBK SuperBK is offline
Registered User
AKA: BrianK
FRC #1225 (Amperage Robotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Henersonville, NC
Posts: 358
SuperBK is just really niceSuperBK is just really niceSuperBK is just really niceSuperBK is just really nice
Re: Wiring a limit switch.

if the limit switch is a double throw (has common, NO and NC) then you could connect 5V to NO, Gnd to NC, and the signal to common. The switch would then either switch the signal to 5v or ground. Be careful not to put 5v or gnd on the common terminal, or one state will give you a short.

Reversing 5V and ground would change polarity or just change in software.

Get the analog port for greatere or less than 2.5 volts.
__________________
Brian K
Team 1225 Robotics Mentor
  #10   Spotlight this post!  
Unread 01-03-2012, 01:33
andreboos andreboos is offline
Registered User
FRC #3021 (The Agency)
Team Role: Programmer
 
Join Date: Dec 2009
Rookie Year: 2010
Location: San Diego
Posts: 132
andreboos is a jewel in the roughandreboos is a jewel in the roughandreboos is a jewel in the roughandreboos is a jewel in the rough
Re: Wiring a limit switch.

Quote:
Originally Posted by SuperBK View Post
if the limit switch is a double throw (has common, NO and NC) then you could connect 5V to NO, Gnd to NC, and the signal to common. The switch would then either switch the signal to 5v or ground. Be careful not to put 5v or gnd on the common terminal, or one state will give you a short.

Reversing 5V and ground would change polarity or just change in software.

Get the analog port for greatere or less than 2.5 volts.
Genius. Now I have a use for that pesky black wire

I think I'll be wiring any analog limit switches this way in the future; thanks!
  #11   Spotlight this post!  
Unread 01-03-2012, 01:53
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Wiring a limit switch.

Quote:
Originally Posted by andreboos View Post
Genius. Now I have a use for that pesky black wire

I think I'll be wiring any analog limit switches this way in the future; thanks!
Oh no, I can smell the melting plastic
__________________
  #12   Spotlight this post!  
Unread 01-03-2012, 01:53
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,753
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Wiring a limit switch.

Quote:
Originally Posted by SuperBK View Post
if the limit switch is a double throw (has common, NO and NC) then you could connect 5V to NO, Gnd to NC, and the signal to common. The switch would then either switch the signal to 5v or ground. Be careful not to put 5v or gnd on the common terminal, or one state will give you a short.

Reversing 5V and ground would change polarity or just change in software.

Get the analog port for greatere or less than 2.5 volts.
As indicated here, it's important to make sure your electrical set up ensures a definitive value regardless of the input form the sensor. The digital inputs have a pull up which accomplishes this for you, but the analog inputs do not. floating inputs are unreliable, and even if they seem to work in the pit, you know they'll fail to work at the most critical time on the field, and be next to impossible to debug!
  #13   Spotlight this post!  
Unread 02-03-2012, 12:52
Mr. Rogers's Avatar
Mr. Rogers Mr. Rogers is offline
That? That was in the CAD.
FRC #3539 (Byting Bulldogs)
Team Role: College Student
 
Join Date: Apr 2011
Rookie Year: 2011
Location: Romeo, MI
Posts: 67
Mr. Rogers will become famous soon enoughMr. Rogers will become famous soon enough
Re: Wiring a limit switch.

Normal open, red wire (end)

Middle leg, white wire (middle)

Normal Closed, black wire (end)

This will read false when not trigged in the code, true when pressed. If you don't know which end leg is which, just look on the side of the limit switch. The diagram will show the middle leg connected to a side leg (normal closed)
Plug into a digital I/O, pay attention to the orientation on the digital side car.
__________________
Grow the roses of success!
2011 Archimedes 2nd seed,
2011 Waterford Champion, 2011 Troy Simi-Finalist,
2011 Waterford Rookie all star, 2011 Troy Rookie all star
http://www.bytingbulldogs.com/
  #14   Spotlight this post!  
Unread 02-03-2012, 15:44
Unsung FIRST Hero
Al Skierkiewicz Al Skierkiewicz is offline
Broadcast Eng/Chief Robot Inspector
AKA: Big Al WFFA 2005
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1996
Location: Wheeling, IL
Posts: 10,770
Al Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond repute
Re: Wiring a limit switch.

Quote:
Originally Posted by andreboos View Post
Why would an unconnected pin report random values? Or do you just mean it would be a noisy zero?
The open input to the analog board is capable of receiving electrical noise interference from the environment, sparks generated in motors or other electronic signals within the robot. Best practice is to somehow limit analog inputs to prevent this noise intrusion. A limit switch between +5 and power common provides a very low impedance source in either case that minimizes noise pickup. Yes, noise can be picked up of sufficient amplitude that it could be interpreted as a valid signal.
__________________
Good Luck All. Learn something new, everyday!
Al
WB9UVJ
www.wildstang.org
________________________
Storming the Tower since 1996.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 11:08.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi