Toggle Switch Wiring

My team is looking to install a couple toggle switches onto the robot this year to help us select which autonomous program we want to run. We were looking at getting these toggle switcheshttps://www.adafruit.com/product/3306 from Adafruit. https://cdn-shop.adafruit.com/970x728/3306-02.jpg. But we weren’t sure that we would be able to wire them up with the robo rio. The directions they give are

That means you have a few options for wiring:

If you want to use the switch to turn on/off something, you can use the toggle to connect and disconnect the two pins on the bottom
If you want the LED to always be on, provide 3-12V between the ground and headlamp pin
If you want the LED to be on only when the switch is connected, provide 3-12V on the (+) pin and connect ground to the ground pin.
I was wondering if we could just connect the 12V to the Voltage Regulator Module and then connect the other two pins to the ports on the roborio.

Any help would be greatly appreciated.

The DIOs and Analog Inputs expect 0-5V - do NOT send 12V to the signal inputs.

The easiest and best way to wire these is as you would do with limit switches, one to each DIO. Wire one terminal pin to the 0V/ground pin, and the other to the signal/data pin. With the switch in the open position, you’ll get a one when you poll the DIO. In the closed position you’ll get a zero.

If you want the LEDs to work, you can power these off the 5V from the DIO pin, but check that you aren’t drawing more than an amp on all the 5V pins on the RIO (including MXP). (see Maximum Current for +5.0V output on page 6 of http://www.ni.com/pdf/manuals/375275a.pdf). If you need more current than that, use a 5V output from the VRM.

Not to be that guy, but can’t you just put a selector in software and bring it up on the smart dashboard?

I’ve seen this done on the operator console, but I can’t say I’ve seen this done on the robot. Why did you decide to do it that way? What happens if the switch gets damaged in a match and malfunctions next match?

Dashboards can have issues (selector doesn’t show up, doesn’t send to robot for some reason, etc). Switches usually stay where you put them.

Not when SmartDashboard decides to never to send that data to your robot :o

RIP 159’s Auto Selector

Seriously though, if anyone happens to be a SmartDash wizard we’d like your help or we’ll end have to do this too. Not that it’s a bad solution, just that we would like the one we’ve already got to work.

My team has used the smart dashboard for as long as we can remember but this year we purchased rotary analog selectors to select auto so if we have to switch laptops, something goes wrong with FMS or whatever, it’s still protected. We have a manual over ride on the driverstation too still.

This is the exact reason we are trying this solution. Last year we had to many close calls of the smart dashboard assigned to play a game of July want to show the autonomous actions or not

We also abandoned SmartDashboard for similar reasons 2 years ago and I can’t see ever going back. We use three rotary switches wired with resistor ladders, each hooked to an analog input port, and have never had a problem with them. We do wire up a couple of spares in case they’re damaged, but that’s no more likely than any of the rest of the on-board electronics getting damaged.

We are using a single switch this year and is attached to signal and ground on a DIO to the RIO. We also use two pots with 11 detents so we can set several hard presets depending on what the drive team wants at the start of each match.

You can use any switch you like. We use ones like these from Amazon ($7).

https://images-na.ssl-images-amazon.com/images/I/61g1BZwonWL.SL1000.jpg

Our team picked up two simple metal toggle switches from a local auto parts store, wired the switches’ terminals across the DIO-0 (robot set on left) and DIO-1 (robot set on right) inputs (DIO has pull-up resistors), inverted the logic (switch on/low = true; so if wires got cut open, then the logic would read false), and with a little logic to compare with the gameData[0], thus they had very simple drive-forward (we don’t know how to use a gyro, yet) autonomous setting to decide whether to dump the cube. (or both switches off if robot was in an open channel). Worked great in competition. (Team forgot to set the switches once – and only once!)