View Single Post
  #4   Spotlight this post!  
Unread 09-02-2015, 22:51
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,676
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Micro Switch Wiring & Programming

Sorry about this - the NI specifications document for the roboRIO do NOT mention the pullup resistors. You have to go to the RoboRIO User Manual to find this info. I'll leave the post below here alone, as a reference for anyone who wants to wire a board that does not have pullup resistors built in.

As this was posted on the electrical forum, I'll describe how to wire them.

First of all, I'll assume that you're using a standard PWM color-coded cable, black is ground, red is 5V, and white is signal. Crimp a female Dupont (0.1" header-style) connector at one end, red wire in the middle.

I will refer to a setup where the return value is 0V normally and 5V when the switch is engaged as "normal" logic, and the reverse (5V normally, 0V when engaged) as "reverse" logic.
  • To get normal logic for double-throw switches (those with three terminals) such as those shown in the pictures referenced by Ether, wire the white wire to the pole (common), black to the normally closed terminal, and white to the normally open terminal.
  • For a single-pole switch (two terminals), you need to add a resistor. We're using 2K this year based on the numbers I looked up online, but we haven't gotten any answers back to confirm this is the right value.
    • To get normal logic with a normally open switch: Connect the red wire to one terminal on the switch and the white wire to the other terminal. This gives you 5V when the switch is engaged. However, it is "floating" when it is not, so you need to ground it. However, you need to limit the amount of current that will flow through the switch when the switch is closed. This is where the resistor comes in. Connect the black wire to one lead of the resistor, and the other lead of the resistor to the same terminal as the white wire.
    • If your switch is normally closed, wiring it as described above will give "reverse" logic.

For any of these setups, if you want the opposite logic from the one described, swap the black and red wires. Leave the white wire, switch, and resistor (if any) in the same configuration otherwise.


Finally, for any of these setups, plug this into one of the DIO ports, black at ground, white at signal.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.

Last edited by GeeTwo : 10-02-2015 at 00:32. Reason: Prepended first paragraph (retraction)