4x momentary switches acting as a slide switch  - Page 1
Forum section: electronics / projects

author: GreatGooglyMoogly
author_rank: Newbie
timestamp: April 11, 2018, 07:19:58 pm
content: 4x momentary switches acting as a slide switch. Is there an easy way to do this?I'm trying to wire up an Ultimarc IPac2https://www.ultimarc.com/ipac2.htmlso that I can use four momentary switches to select which key is pressed then another momentary switch as the actual keyboard button.It could be done very easily with a slider switch but this is for a disabled gamer who requires a much easier method of selecting the required key.I've searched on Google and didn't find anything like what I need.

author: BrianHG
author_rank: Super Contributor
timestamp: April 11, 2018, 09:40:34 pm
content: Please explain your idea better.Are all 5 buttons momentary?So you need to push 2 simultaneously at once to make your chosen key pressed?Any, I mean ANY, existing single buttons or momentary switches will do, it's just how you wire them together.

author: GreatGooglyMoogly
author_rank: Newbie
timestamp: April 11, 2018, 10:18:20 pm
content: OK, i'll try.I need 4 momentary switches to work like a slide switch so one (but only one) is open.They need to function like latching switches but if one is pressed the others are unlatched.The IPAC is a USB input device that emulates a keyboard & mouse.I want the 4 momentary switches to select which of the 4 'keypresses' will be used when the 5th switch is pressed.

author: BrianHG
author_rank: Super Contributor
timestamp: April 11, 2018, 10:25:17 pm
content: I think what you are saying that switches, or, 1 switch A-B-C-D is non momentary. It's just a 4 position selection switch. It's only SW5 which is momentary, correct?Are you saying SW5 is a momentary push-button and you want to replace the A,B,C,D with the switch below?https://www.digikey.com/product-detail/en/cw-industries/G-141S-3011/SW120-ND/9610

author: Ian.M
author_rank: Super Contributor
timestamp: April 11, 2018, 11:33:17 pm
content: Oh dear, itsX-Y problemtime again.You are going down the road of coding in hardware, which is invariably expensive, often Heath-Robinson, and is a royal PITA if any unforseen changes are ever required.The smart move would be to use a MCU, which could pull one of four outputs low to simulate a switch closure, from their normal tristate switch open state (as the I-PAC 2 uses switches to ground to trigger it). Then you've got easy options if you have misidentified the user's adaptive assistance needs. If you are a MCU novice, any 5V Arduino would be suitable.If you know your way around a USB stack, and have some experience coding USB devices, an all-in-one solution using an Arduino Leonardo implementing a custom HID game controller would probably be preferable, avoiding the need for the I-PAC 2.

author: GreatGooglyMoogly
author_rank: Newbie
timestamp: April 12, 2018, 01:00:57 am
content: Quote from: BrianHG on April 11, 2018, 10:25:17 pmQuote from: Ian.M on April 11, 2018, 11:33:17 pmYou may be right. I was hoping there was a simple way to implement it with a few components (already have the IPac) that I had overlooked but it seems there isn't. I'll look into the Arduino Leonardo as it seems it should do exactly what I need. Thank you.

author: BrianHG
author_rank: Super Contributor
timestamp: April 12, 2018, 02:23:33 am
content: What's wrong with just using 4 individual buttons if you were going to use 4 bug buttons identical to the fifth one anyways? This way, you have 1 less button and you just hit the one you want to use.I hope this isn't for the Arcade emulator 'LAME'. In 'LAME', for each game, you can re-define what each key does within each game, including duplicates, or, 1 key doing 2 things.

author: GreatGooglyMoogly
author_rank: Newbie
timestamp: April 12, 2018, 05:14:17 pm
content: Quote from: BrianHG on April 12, 2018, 02:23:33 amThe 5th button is a bite switchhttp://conceptusinc.com/biteswitch.htm. Its designed for skydivers but works great for someone with limited motor control. The person requires a way to quickly switch between a number of different inputs (eg LMB, Up, Space) mid-game.

author: Nominal Animal
author_rank: Super Contributor
timestamp: April 12, 2018, 06:38:44 pm
content: I can recommend the Pro Micro microcontrollers for stuff like this. It has the same microcontroller as Leonardo (ATmega32u4), so supports native USB, and thus HID interface without any drivers or daemons on the computer side. The difference between Pro Micro and a Leonardo is in the form factor and pinouts: the Pro Micros are much, much smaller. I've happily used the cheap chinese clones from eBay, too, being dirt poor and all.

author: jimmc
author_rank: Frequent Contributor
timestamp: April 12, 2018, 06:45:21 pm
content: If you want to avoid a MCU, below is a simple way of interlocking 4 momentary switches, only one output high at a time. Resistor values not critical, 1k to 100k should be OK.Power on state is indeterminate.Use the outputs to control '4066 quad switch.Jim

author: Ian.M
author_rank: Super Contributor
timestamp: April 12, 2018, 06:54:10 pm
content: The normal application for that switch is connected to a fully isolated low voltage battery powered device. As its a bite switch and as the USB bus will be connected to a mains powered device, for safety, you'll need isolation between it and the microcontroller.You *SHOULD* use medical grade parts, but if you use a good brand of commercial 5V DC-DC converter with a 5KV isolation rating to power the isolated switches and 5KV rated optocouplers for the bite switch and any switches in direct contact with the operator's skin + pay proper attention to creepage and clearance distances in your PCB layout, it would be sufficient for me to have no worries biting that switch myself.

author: SL4P
author_rank: Super Contributor
timestamp: April 13, 2018, 07:13:00 am
content: How about your drawing in Reply #2FOUR interlocking push-latch switches from the electronics disposal bin - $2ONE momentary - configured as your bite switch (or puff switch)-OR-Preferably - for cleaning and ease of use -The Arduino method is very easy if you need low mass/pressure push buttons like TACT switches orliterallyany other SPST switchThis would also let you use just three conductors (e.g. mic cable) in an R2R ladder arrangement for the buttons.

author: Nominal Animal
author_rank: Super Contributor
timestamp: April 13, 2018, 09:29:11 pm
content: Instead of physical push buttons, it might be interesting to try and see if capacitive proximity sensors like MPR121 (Adafruit break-out board here) might allow for better user-friendliness. You can design the "button areas" yourself with e.g. copper tape. That way, just moving a finger or stylus over the desired action area would choose the button action. I'm thinking of non-rectangular pads, maybe an arc or similar. The optimum shape depends on the actual user, but fortunately experimentation is easy.As to the isolation, the ATmega32u4 is an USB full-speed device (USB 1.0/1.1), so you could use the ADuM4160-based USB isolators. (They provide about 150 - 250 mA from the host USB current via an isolated DC-DC converter (integral in the ADuM4160, external for ADuM3160), which is easily sufficient for ATmega32u4.)For the bite switch, I wonder if a resistor (to limit the current) and suitable diodes to both rails (to clamp the voltage) would work best? I would definitely use two I/O pins, both separately thus limited. One pin would be configured as input, with internal pulldown resistor enabled. The other pin would be configured as output, but set high only when testing the bite switch. This way, if a spike occurs, it must first go through the microcontroller, and the limiting circuits, before it can reach the person's mouth.Maybe add something like 7V diode clamps to the (isolated) USB power rails, too, just to be sure?Do note that I'm not an EE, and would only experiment on myself.

author: SL4P
author_rank: Super Contributor
timestamp: April 13, 2018, 09:38:25 pm
content: Nice disclaimer!