View Full Version : Programming the Limit Switch?
We have the AutomationDirect.com AAP2T51Z11 limit switch. What I understand is that it keeps the robot from exceeding a certain speed. What I don't know is where to mount it, how to connect it to the cRIO/Digital Sidecar, and how to program it. Any help is appreciated.
imcmahon01
20-02-2010, 21:14
We have used that particular limit switch on our robot. To clarify why you would use one, it's purpose is to stop the motor from turning past a set point. In our setup, we have 2 limit switches. One prevents our grapple arm from extending too far forward by clicking, and the other prevents it from retracting too far into our robot.
First, I'd unscrew the casing on the AAP2T51Z11 limit switch to become familiar with the two possible switch configurations: NC and NO. You only need two wires (signal and ground, no +5V) coming into this box despite the fact that there are 4 terminals. The top 2 terminals are for NO operation and the bottom 2 are for NC. NC means that the switch is Normally Closed (signal wire connects to the ground wire) unless it is pushed to the "clicking" position, at which point the circuit is open (signal and ground are disconnected). NO means Normally Open, and is the exact opposite: Clicking means the circuit closes, neutral position means the circuit is open. The choice of configuration is up to your team's robot and programming needs.
There are two ways that I am aware of to connect these switches to your robot. The first, and easiest by far, is to connect them directly to your Jaguar speed controller's limit switch ports for a particular motor. See page 13 of the Jaguar Getting Started pdf which can be found at http://www.luminarymicro.com/index.php?option=com_remository&func=download&id=1358&chk=9d5259c60d659faed10d2ed87c4e2937&Itemid=591 for an external schematic of the limit switch jumpers. Connect the signal and ground wires coming directly from the limit switch to either the Forward jumpers or Reverse jumpers depending on your switch needs. When using this setup, the NC terminals must be used on your limit switch because you are replacing jumpers that are in fact Normally Closed. This setup does not require any coding since the Jaguar handles it all for you.
The second method is to allow the cRIO to handle any input generated from the limit switch. This can be achieved by routing a PWM wire to the limit switch, but splitting the cable on the switch end and trimming off then electrical taping the red +5V wire. Then place the other female-end of the PWM wire on, say Digital I/O slot 1. As this is the Java forum, will also direct you to the JavaDoc for DigitalInput. There you can find limitSwitch.get() to return a boolean value telling whether the limit switch was pressed (this is assuming you have declared a Digital Input limitSwitch).
I think that should be enough info to get you on the right track. Hope this helps!
Thank you. I can't express how much I appreciate this, being the only programmer for a rookie team.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.