Foot Controlled Push to Talk Button
by tinyboatproductions in Circuits > Arduino
2001 Views, 17 Favorites, 0 Comments
Foot Controlled Push to Talk Button
This is how I made a Push To Talk button that you can use with your feet.
Gather Your Materials and Tools
The first and most important step in any project is gathering your materials and tools, unless you want to be cursed to be wandering around looking for that one tool you need every 2 minutes.
Materials
- Arduino Pro Micro - a knock of will work as long as it uses the MEGA32U4 chip
- RBG LED
- Resistors
- Red - 180 Ω
- Green - 100 Ω
- Blue - 100 Ω
- Arcade Push Button
- Wire
- Solder*
- Shrink wrap tubing - optional*
- USB micro cable, long enough to reach the floor*
A note on the Arduino selection. The Pro Micro uses the MEGA32U4 chip which works great with the keyboard.h library to make the code really simple. A micro controller that uses that chip should work (I used a knock off and it works fine). Also on the version I made I used 330 Ω resistors on all, this does mean that the red is much brighter than the other colors.
Tools
- Soldering Iron*
- Wire cutters*
- Needle nose pliers
- Tools to make case
A note on the case: I used a 3D printer to make a case as I found that to be the easiest. You could use what ever case you want for this, but remember it will be something that you rest your foot on to use it.
*Not shown in pictures
Parts to Print - Optional
I printed 3 parts and they were the longest part of the project so that's why its so early in the project. The parts can be found here.
The first needed is the soldering guide. It is used to hold all of the parts in position while soldering the LED and Button together.
When printing the Top of the case I used supports on the top of the button opening but no other supports were needed.
The next are in any order, the case top and the case bottom. The bottom will snap to the top to encase everything.
Assemble Your Circuit
This step is to actually get all of the parts of the circuit together. I think that this is the most confusing part.
The RGB has 4 leads, one for each color and one for ground. Note here that I have a common cathode LED, if you have a common anode LED your pin layout will be different; to find out which you have, either look at the package, if you have it, or try and plug it in to a voltage source. If you need to apply the ground to the longest lead you have a common cathode, if you need to apply the voltage to the longest lead and ground any of the other leads you have a common anode. I have only made this with a common cathode LED.
- To start with strip the ends of 5 wires, the wires I use came from an old computer ribbon cable.
- Clip the ends of the resistors fairly sort, maybe about 10mm longs or long enough that you feel comfortable soldering too.
- If you are using heat shrink, it will cover the connection between the wire, resistor, and LED. It is just to make sure that none of the wires shift and short out.
- Once you have your LED type figured out solder the LEDs to the right resistors. Don't solder the ground pin yet.
- With the LED soldered onto the resistors put the LED and button into the solder guide printed in the last step. now bend the LED ground lead down to meet one of the button leads.
- Solder the ground wire to the button lead and LED ground lead.
- Solder the button wire onto the other button lead.
- Solder the other ends of the wires to the correct pins on the Arduino.
If you want to change the LED pins make sure that you attach them to a PWM pin on the Arduino. On the Pro micro they are the pins with circles around them. Updates will also need to be made to the code.
Program the Controler
Now its time to plug in the Arduino and load up the program.
The program is fairly simple, it is basically just a diversion of the Keyboard.h example and the RGB LED example, just kinda chopped up and smushed together.
The whole top section is defining some values to be used through out the code, first the pins, the buttons and each LED color get a pin, these can be adjusted if you need.
The first few lines are just defining the on/status colors. They can be changed easily by just entering the RGB value of the color you want. Google has a color picker that will give you the values of any color.
For the setup first we setup our in/out pins, in for the button and out for the LEDs. Then we set the color of the LED to the on color set above. Finally we need to start the communication with the computer, so that it recognizes the Arduino as a "keyboard" so we can send key commands.
Then for the loop we just need to check if the button has been pressed using a digitalRead() on the button pin. Once we see the press we can send the desired key stroke to the computer and change the LED color to the status color. If we don't find that the button has been pressed we release the keystroke set the color back to the on color.
Just a note here on the keyboard stroke we are sending, KEY_LEFT_ALT, when using the Keyboard.h library we want to use press() and release() rather than send() for modifier keys, a full list can be found here. For any key you use press() on you will also need a release() of the same key otherwise that key will be held down until you unplug the Arduino.
#include <Keyboard.h> // define button pin and LED pins int Button_pin = 7; int RLED = 3; int GLED = 5; int BLED = 6; // define LED color during on state int Ron = 0; int Gon = 0; int Bon = 255; // define LED color during status or button pressed state int RStat = 255; int GStat = 0; int BStat = 255; void setup() { // make pin 10 an input and turn on the // pullup resistor so it goes high unless // connected to ground: pinMode(Button_pin, INPUT_PULLUP); // setup LED pins pinMode(RLED, OUTPUT); pinMode(GLED, OUTPUT); pinMode(BLED, OUTPUT); // set LED to on color analogWrite(RLED,Ron); analogWrite(GLED,Gon); analogWrite(BLED,Bon); Keyboard.begin(); } void loop() { //if the button is pressed if (digitalRead(Button_pin) == LOW) { // send the press Keyboard.press(KEY_LEFT_ALT); // chagne the LED color to the status color analogWrite(RLED,RStat); analogWrite(GLED,GStat); analogWrite(BLED,BStat); } else { // release the key Keyboard.release(KEY_LEFT_ALT); // change the LED color to the on color analogWrite(RLED,Ron); analogWrite(GLED,Gon); analogWrite(BLED,Bon); } }<br>
Put It All Together
Now that we've made the case, assembled the circuit, and put the code on our Arduino we can finally get it all together.
Feed the button and LED into place and set the Arduino into position and you are nearly done!
The final step that will be up to you will be to go into the program you are using and programing the button you programed onto the Arduino as the push to talk button. On the Discord desktop app this is done in the User Voice & Video settings.
That's it, you should now have a working external push to talk button!
If you have questions about this project, please leave them below and I will do my best to answer!