Customizable USB Foot Switch for PC
by Self Taught Stuff in Circuits > Computers
254 Views, 2 Favorites, 0 Comments
Customizable USB Foot Switch for PC
Having a push to talk foot switch is really useful when you play multiplayer games and I don't like the commercially available ones. The cheap ones are hard to setup and the good ones are expensive, above all you need to install software. So I build one that suits my needs, its reliable and fun to make.
Supplies
- USB to Micro USB cable
- 10kOhm resistor
- Foot switch (https://www.aliexpress.com/item/32970094427.html)
- Arduino Micro clone (ATmega32U4) (https://www.aliexpress.com/item/32768308647.html)
Programming the Arduino
- Using the USB cable, connect the Arduino to your PC.
- Start the Arduino IDE.
- From the Tools menu, go to Port and select the port on which your Arduino is connected (mostly it will show Arduino Micro after the port name, in my case it was showing as Arduino Leonardo).
- Open the Tools menu again, this time go to Boards and select the Arduino Micro board.
You are now ready to program the Arduino with code. Follow this link and download the code https://github.com/SelfTaughtStuff/pc_foot_switch
There are two ino files:
- "ctrl_c_combo" which is example showing how to use modifier keys, its sending CTRL+C keypress to the PC
- "p_key" example showing how to send simple keypress, sending only "p" to the PC
You can use any combination of chars and modifier keys (like Ctrl, Alt, Win, Shift, Tab, CapsLock,...).
Here is a link for the modifier keys: https://www.arduino.cc/reference/en/language/functions/usb/keyboard/keyboardmodifiers/
Link to the ASCII table: https://www.asciitable.com/
Once you are done with modifying the code, just click Upload in the Arduino IDE, when the upload is done, you should see the key you programmed being pressed continuously, this is normal don't panic, just unplug the Arduino from your PC.
Preparing the Foot Switch
The foot switch has a spring and a push switch inside. If you got the same like me, then the white wire is the common wire, the red wire is normally open and the black wire is normally closed. We want the foot switch to activate when we press it, so we don't need the black wire and the connector where the black wire is soldered on the push switch can be cut to free some space for the Arduino.
Schematic
This is the schematic, a simple pull-up switch connected to the pin 2 of the Arduino.
Putting It All Together
Disassemble the foot switch and insert the Micro USB side of the cable in the foot switch and fix it to the case using the metal strap with the screws. Solder the white push switch wire to the VCC pin on the Arduino, solder the red wire to the pin number 2 on the Arduino. On the bottom side of the Arduino, solder one of the lead of the resistor to the GND pin of the Arduino and the other lead of the resistor to the same place where you soldered the red wire. Check the photos for reference.
Plug in the cable to the Arduino and then glue the Arduino on the side of the bottom part of the foot switch case using hot glue. Then assemble the foot switch.
Done
You are done, just plugin the foot switch to your PC, set the key you programmed in the Arduino as your "push to talk key" in your software (example Discord) and enjoy using your feet instead your finger to talk to your teammates.