Our current OI includes 3 joysticks. We have a need to use Port 4 to wire in some toggles switches that are not on the current joysticks. I can obviously figure out how to wire up to 4 switches with the base port. Our design requires almost double that. What is the best way to wire a big switch panel to a joystick port.
The only thought I came up with was running each switch through a different value resistor and using an axis. My problem I run in to is sensing multiple switches at a time.
If you don’t need more than eight buttons, and you need to be able to detect each of them independently from the others, recall that you have four analog (“axis”) inputs in addition to the four switch inputs. Your idea for using resistors is fine; you just need to connect each button/resistor to its own joystick connector pin.
There is also the option of using the redundant switch connections available on two of the joystick ports. You can “steal” switch inputs from one joystick and use them via a different port. See the OI documentation for details on which ports support this.
By the way, congratulations on a very good question! You’ve stated the problem well, and your comments show that you’ve thought about the solution and you understand the issues.
Eight digital inputs are available on port 4.
Four of them are also on port 1, but you can
disable them on port 1 with the disable switch.
If you need even more digital inputs, use port
2 and port 4, and then attach two joysticks to
port 1 or port 2 using a Y cable.
One button per axis should work. I was over thinking the problem.
Just out of curiosity, is there an easy way to assign four buttons in place of an analog axis and have them accessable via four digital values in the top four bits of the analog channel like the USB-CHICKLET does?
I don’t know if there is any rule from first but the OI user guide specifically says not to power LEDs off of the joystick ports because current and voltage draw will throw off joystick readings.
“Do not use +5V Aux for lamps or LEDs, excess current will affect joystick readings.
The current limit of the +5V Aux from all 4 ports is about 100mA. The Aux Fault Led will start
illumination when the current draw from the +5V Aux Outputs total about 120 mA and the +5V
Aux voltage will have dropped to about 4.5 volts. Worse case, short condition: after about 30
seconds, the voltage will be at about 300 mV with a current of about 250 mA.”](http://www.ifirobotics.com/docs/oi-ref-guide-5-8-07.pdf)
It actually says that once for each joystick port.
Yes, there is. With the proper choice of five resistors in series between the +5 pin (1) and the analog input, and switches connected across four of them, you should be able to read the switch values directly from the analog value’s bits.
In theory, the resistor values should be 1/2, 1/4, 1/8, 1/16, and 1/32 of 100k. In practice, some tweaking of values might be necessary. The switches go across the large four resistors. The small fifth one serves to offset the final value so small variations in resistance do not cause the high bits to change.
My team uses 6 position rotary switches to set our autonomous modes using 2 analog axis. Basically, you solder resistors across the pins and turn the switches to connect the signal wire to different pins. I can get you a part number if you are interested.
To elaborate, on the OI you have 4 ports. Two of those ports (ports one and three) you have room for four analog signals, four digital signals, and four output signals (used for LEDs) as well as the power and ground. On the other two ports (ports two and four) you have room for four analog signals and eight digital signals as well as the power and ground.
That said you can create a Y cable so that on one joystick your x axis is p3_x and your y axis is p3_y and your trigger and top are p3_sw_trig and p3_sw_top respectively. At the same time, on the same port, the x axis for your second joystick would be p3_wheel and your y axis would be p3_aux and your trigger and top would be p3_sw_aux1 and p3_sw_aux2 respectively.
Call me a noob but what would those values be? Does a 1/2 (50k) resistor exist or is the closest 56k or something else. I was looking through our resistors and didn’t find much. We may just have a limited assortment. I don’t know.