Programmable button

Hi all, I am intrested to know if any options to create durable programmable buttons. I have seen few interesting devices on this site like Big Dome Push Button - Blue (Big Dome Push Button - Blue | Sparkfun COM-11274 | Core Electronics Australia) and Adafruit NeoKey Trinkey - USB NeoPixel Mechanical Key Switch | ADA5020 | Core Electronics Australia.

I am looking for a combination of these… like if i press on dome button that should be mapped to a particular key in keyboard. (say Enter or a space bar). I am not an electronics person, so excuse my ignorance and any guidance is much appreciated.

3 Likes

Hi @Murali273296

Good to have you here on the forums!

This is totally possible, and an excellent beginner project.

Couple of quick questions.

How would you like the button to connect to the computer?
USB? Wifi?

Would you like fine control over what the button does?
i.e. will it always be a space bar, or would you like keep the option to reprogram later.

4 Likes

Depending on what you are interfacing with i see a few options and I would expect some gadget somewhere may already be made to do each option.

Option1.
Have a controller that can act like a usb keyboard (e.g. ESP32-S2 or S3) then connect each button to a GPIO for input. On buttion press, send keyboard code to computer.

This option, if generic enough should be transparent to everything that accepts a USB-HID-Keyboard at the expense of setting up a device and map GPIO to USB Keystrokes.

Option 2
Have some middle-ware device get the button presses (like above) but send to an API/Service on the target OS.
The allows transparent device, at the expense of needed specific “drivers” for your os.

Option1 Seems like a simple option to me.

e.g. I just got an ESP32-S3, used the example tusb-hid code, compile flashed and it sent the letter ‘a’ to my computer as a keyboard input and then made my mouse move in a square.

4 Likes

Hi Murali,

Welcome to the forum!

Following on from what Michael mentioned, we have this guide on our website that should get you started, you would be looking to replace the push buttons with the big button.

3 Likes

Hi @Pixmusix,

Thanks for your response.
I want to connect that button to a android tablet through USB or bluetooth.

It will always be space bar or enter button what even we program it for first time.

The purpose of this is, user will tap on button to report when cycle completed.
Then i want to store the time taken for him to complete one cycle.
That logic i can write in my app, but i want a mechanism to capture that tap on that button.

Regards,

2 Likes

Hi @Murali273296,

I had a bit of a look around and there’s this library I found for ESP32 that allows you to program it to be a Bluetooth keyboard.

It’s pretty decently documented and the example code shows it’s possibilities.
It should be decently easy to wire up a button and write a program that will do what you need it to.

3 Likes

This will work great :slight_smile:
@Murali273296 if you’re in a language like Kotlin reading bluetooth keyboards is easy through the devices API.

Does this have to work with ANY tablet, (e.g. samsung, google, etc) that could be running ANY version of android? Do you have full control over which device is used and if so is it the same device every time?

3 Likes

Hi Murali,

Sounds like a really interesting project!!

Are you able to tell us a bit more about your project? From this peek inside, another input type might be more suited, what task is the user completing?
Does it have to be sent to a tablet? If you are using a microcontroller you can use that to time the tasks and much more, it doesnt end at keypresses.

If you’re keen on a dive into Maker Electronics and other neat project related stuff I’d recommend checking out these:

Liam

2 Likes

Hi Murali,

Not sure if your project was still ongoing, if its not here’s a link to my GitHub repo where I’ve used one of our makerverse keyboards and a pi pico to make a macropad. I’m certain that you could use this as a basis to make your project work.

1 Like