DIP switches for autonomous modes

Hi, Were wanting to use DIP switches to select between different autonomous behavior prior to our matches without needing to reprogram. We would connect them to the GPIO pins.

Since the signal pins are pulled to 5V with a 10k resistor, we are thinking of simply pulling the pin to GND to select the autonomous behavior.

I didn’t see any rules against this. Do you guys agree?

Thanks,
windell

Pulling a pin to ground is the common way of connecting to the digital inputs.

A switch connecting a signal pin to ground when pressed is the intended method of operation for Digital Inputs, so you are correct. Have you considered using Digital Inputs on the driver station (many teams prefer this approach) instead of the robot? You can use the virtual digital inputs on the I/O panel or your DIP switch on the PSoC.

Thanks Lucas and apalrd! Unfortunately, I’m not the programmer of the team so I don’t know about the PSoC or the driver station DIO. I know we’re using the classmate, but other than that I’m clueless. Our programmer seems spacey sometimes and doesn’t think of these things. So we’ll probably put the switches on the bot. I’ll pass on the info!

Thanks again,
windell

While there are good reasons for putting the selection on the Operator Interface (you can change it without having to be next to your robot) for me there is nothing as certain as flipping a switch on your robot to be sure that your robot will know what to do.

So… …if #2849 ever gets its autonomous program(s) running, we’ll be flipping switches on the robot to select (or disable) them.

For what it’s worth.

Joe J.

I understand those reasons. We use rotary switches (2 X six pos) on the PSoC and print out the auto routine on the Driver Station LCD so we can confirm that the cRIO sees those switches. In case the PSoC (as it did when the Classmate battery goes low, we will not let that happen again) fails the drivers are trained to use the virtual analog in as a backup. It is important to be sure you run the correct auto.

Another possibility is using a potentiometer and one analog input on the robot.
Theoretically you could have close to 5000 different autonomous options as I believe the analog inputs are 12 bit. (2^12=4096). Practically speaking, you would easily be able to have a couple per zone.
We have a pot on our robot this year that has 10 detented positions, but we are only using 4 modes. This allows us greater room for error in positioning the pot.

For many years we have used a modified Radio Shack rotary switch. This is stock 6 position double pole switch. With a small modification it can be turned into a 12 position single pole switch. Wired with 9.1k resistors in a series string, this switch can function on an analog input either at the robot or on the driver’s console. It effectively steps from 0 volts to five volts.
The modification involves removing the phenolic switch deck, and cutting the inside of one of the follower contacts on one side of the switch. Then remove one of the mechanical stops on the metal detent plate and reassemble the switch. Then wire the two center contacts together and tie to the analog input. Wire the 9.1k resistors from contact to contact around the outside terminals of the switch. Tie one end of the string to 5 volts and the other to negative power supply. The load on the 5 volts supply is in the order of 100 k ohms so there is little current.

Another option is a multiplexed switch. You solder a resistor from each position to the position next to it, with GND on one end and +5 (or +3.3) on the other. The selector goes to SIG. If all of the resistors are the same value, each position is an even increment from the next and the switch clicks from position to position, more accurately than the potentiometer method.

I am going for 3 switches providing 8 choices for autonomous programs (000, 001, 010, 011, 100, 101, 110, 111) It requires a secret decoder ring but it is simple enough to manage and as a practical matter we will probably only use 3 of them.

Works for me.

Joe J.

1501 uses a thumbwheel on our robot. It uses 4 Digital I/0 slots in the Digital Sidecar. it can also be used on the Cyprus Board i believe, but we decided to not use any custom circuits on our Drivers Station. It offers 0-9, and A-F i believe. Overall there is about 15-16 options, and we have never had a problem with it. I can try to get you the supplier if you PM me. We have never had a problem with it. I believe you wire it into a case selector in labview to change between the different modes. If you dont have that many modes, than you can have your code default to a certain auto mode, or default back to no code if the thumbwheel is set incorrectly. (Which we have never had happen, but we code it in as a safety anyways. Also helps prevents watchdog errors)

We built our own DIP switches last year and are able to reuse it this year. We mounted it on the robot and connect it to some of the digital input pins (however many pins we want up to 8). The board was designed to interface with both the digital inputs on the robot (internally pulled up) and the digital inputs on the DS last year (no internal pull-ups). We didn’t have time to play with the PSoC this year but I would imagine it should not be hard to interface it to the PSoC as well.

5820_118646037217_605902217_2471498_6933123_n.jpg


5820_118646037217_605902217_2471498_6933123_n.jpg

For control over autonomous as our team takes the field, we have one SPST switch (enable / disable) and one SPDT switch (offense, defense, midfield). Digital inputs with switches work fine when wired to the digital board to the cRIO, the only issue is that each individual switch requires its own PWM and slot on the digital board. All in all, our setup only requires three inputs, but still, we could be using those for other things and I fear that your DIP Switch may take up too much space on your digital board.

Of course, you’ve probably already accounted for that! I’ve had great success with physical switches though and swear by them - have at it.

Are you seriously close to running out of your 28 DIO’s? I have 2 encoders in the drivetrain (4 inputs), pressure switch, claw sensor, ball-in sensor, and that’s it. 7 inputs, not including analog. Not close to 28. Same with the Cypress board. 16 inputs. We have three buttons plus a 4-pos switch, and we still haven’t filled half of the IO. Plus, you can always use analog triggers as DIO, adding another 16 di’s to the 28 dio’s (total: 44 dio). If you seem to be using lots of DO’s, you can use Relay channels as 2 DO’s each, another 32 DO’s todal.

Team 399 has a little panel on the driver station. There are 4 SPDT Toggle Switches and a Rotary Switch.
There are 15 options with the Toggles times 4 with the rotary switch.
Like Al and apalrd, we wired the rotary the same way giving us the option to use just 1 analog input instead of 4 digitals.
We have also printed the options on the DS LCD.

So we can have a maximum of 60 autonomous modes.

Team 1351 uses our driver station to choose autonomous instead of wiring anything for our DSC. The switches on the I/O tab have buttons on it where the programmers map different autonomous modes to it. So as soon as we open up the laptop at the Driver Station we just go to that tab and click on one of the Digital Inputs. It’s been working great especially moving between zones we are able to choose which autonomous we want.

Hmm, I had an impression that I cannot read anything from the DS during autonomous. Am I wrong? Or may be you are reading it during RobotInit? What’s the rule on this?

The DS now latches the last inputs before autonomous. So you can read them anytime during auto an they will be the same. In previous years you had to read your switches in disable and save them in a variable before auto.