Do you want to have a big button? One that works with your computer, so you can use it to perform various tasks.
- When you want to send out an important email, press the big button. π
- When you want to publish an article, publish a project on hackster.io, press the big button. π
- the list goes on...
There are existing products online for sale, but I want to make my own. π
I brought the button box online by searching for "push button box", and picked one with a protector lid. It makes the button look cooler. π
You can buy one, or can combine buttons you have at hand with any kind of box, to make your own version of big button.
Communicate with computersThe hard part of this project is how to communicate with computers and make this button really useful. There are 2 things I can think of:
- mimic a mouse, send a click whenever the button is pressed (and released)
- mimic a keyboard, send a "Enter" key press event when the button is pressed
To simulate mouse/keyboard, I would use the Pro Micro board, which has ATmega32U4 chip on board. With built-in transceiver, it can communicate with computers (I tested it on Windows and Mac) through USB.
If you don't have a Pro Micro board, you can use any compatible board with ATmega32U4 as the main chip. e.g.: Arduino Micro, Arduino Leonardo, Beetle, etc.
The circuit will be fairly simple: connect the GND pin of the board with one leg of the button. Connect the other leg of button to one of the GPIO pin on the board. (Here I chose pin 9, for no particular reason.)
Next thing is to program the Pro Micro. Please follow this guide if you are not familiar with it.
My first version of code is to mimic the behavior of a mouse button. To use the big button, we will move our mouse pointer to some "release" or "publish" button on screen, and use the big button to execute the click.
(see the "As mouse button" code at the end of this article)
My second try is to mimic an Enter key press from a keyboard. To use big button with this code, you will need to set the computer to be able to execute something as an Enter key press -- then press the big button π
(see the "As Enter key" code at the end of this article)
After trying out those 2 modes, I decided that I want to merge the 2 modes, and add a hardware switch to switch between those 2 modes as I need.
(See the "Final version" code at the end of this article. I added code comments)
And here's my final circuit.
- I connected it with solder iron and some wires after everything tests out.
- I also used a piece of cardboard to hold the tiny switch in place.
- Tape everything down firmly, so they will not shift around in the box. (Avoid the metal part to avoid shorting things out)
With the switch set to "mouse pin", move the mouse pointer on your screen to point to something important, and click it with the big button.
Two days after I built this big button, I have already used it in all kinds of important things, like sending out a big email. π
I kept looking for "important things" to do these days. ππ
Technical trivia and notes- Our button works as a HID device. No driver installation required. (As least when I tried it.)
- The details of how to send the events are handled by Arduino libraries.
- Some other Arduino boards use FTDI to communicate with USB, we can't use them for our purpose. (...easily. Technically you can try the V-USB library and build you own outer circuit for communicating with USB)
Comments