A couple of years ago, a tech gadget team created Pressy, an external button for your smartphone that could placed in the headphone jack and remapped for different uses. The button lets you control some phone functions without turning on the screen.
To make your own “Pressly” (the name given by the project maker), you’ll need a 3.5mm male audio connector, of which you probably have dozens since they are standard smartphone plugs. Make sure it is the four-pole kind (four rings). You’ll also need a momentary switch, or electronics push button, which you can pick up at your local electronics store or online for just a few bucks.
After trimming some of the extra terminals and connecting the button to the jack using the included circuit map, you can download the configuration app and customize the button’s use. There are a number of Android apps that work with a remapping button. The project’s author, Jonathan Pereira, recommends KeyCut for Android (iOS owners would need to jailbreak their device and install the Activator app by Ryan Petrich).
Apps like KeyCut allow you to preset certain actions to different numbers of presses. For example, you could map the button to take a picture with one press and turn on your flashlight with two presses.
Of course, $5 and an hour of your time are more costly than just getting Xiaomi’s version of the Pressy for a buck. But DIY-ers are never concerned with cost and time. It’s all about making stuff from other stuff in your garage.