# Programmable button

**URL:** <https://forum.core-electronics.com.au/t/programmable-button/20229>\
**Category:** Uncategorized\
**Created:** [13 June 2024 02:54 UTC](https://forum.core-electronics.com.au/t/programmable-button/20229 "2024-06-13T02:54:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Murali273296](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@Murali273296](https://forum.core-electronics.com.au/u/Murali273296)\
**Post date:** [13 June 2024 02:54 UTC](https://forum.core-electronics.com.au/t/programmable-button/20229/1 "2024-06-13T02:54:44Z")

</div>

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](https://core-electronics.com.au/big-dome-push-button-blue.html)) and [Adafruit NeoKey Trinkey - USB NeoPixel Mechanical Key Switch | ADA5020 | Core Electronics Australia](https://core-electronics.com.au/adafruit-neokey-trinkey-usb-neopixel-mechanical-key-switch.html).

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.

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [13 June 2024 03:50 UTC](https://forum.core-electronics.com.au/t/programmable-button/20229/2 "2024-06-13T03:50:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Michael99645](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/michael99645/32/11893_2.png) [@Michael99645](https://forum.core-electronics.com.au/u/Michael99645)\
**Post date:** [13 June 2024 03:53 UTC](https://forum.core-electronics.com.au/t/programmable-button/20229/3 "2024-06-13T03:53:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Dan](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/dan/32/10815_2.png) [@Dan](https://forum.core-electronics.com.au/u/Dan)\
**Post date:** [13 June 2024 06:54 UTC](https://forum.core-electronics.com.au/t/programmable-button/20229/4 "2024-06-13T06:54:34Z")

</div>

Hi Murali,

Welcome to the forum!

Following on from what Michael mentioned, we have [this guide](https://core-electronics.com.au/guides/teensy/usb-keyboard-mouse-with-teensy/) on our website that should get you started, you would be looking to replace the push buttons with the big button.

---

<div class="post-metadata">

**Author:** ![Murali273296](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@Murali273296](https://forum.core-electronics.com.au/u/Murali273296)\
**Post date:** [20 June 2024 03:42 UTC](https://forum.core-electronics.com.au/t/programmable-button/20229/5 "2024-06-20T03:42:56Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![Aaron](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/aaron/32/9861_2.png) [@Aaron](https://forum.core-electronics.com.au/u/Aaron)\
**Post date:** [20 June 2024 04:01 UTC](https://forum.core-electronics.com.au/t/programmable-button/20229/6 "2024-06-20T04:01:09Z")

</div>

Hi @Murali273296,

I had a bit of a look around and[there’s this library](https://github.com/T-vK/ESP32-BLE-Keyboard) 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.

---

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [20 June 2024 04:58 UTC](https://forum.core-electronics.com.au/t/programmable-button/20229/7 "2024-06-20T04:58:55Z")

</div>

> [@Aaron](#):
>
> I had a bit of a look around and[there’s this library](https://github.com/T-vK/ESP32-BLE-Keyboard) I found for ESP32 that allows you to program it to be a Bluetooth keyboard.

This will work great 🙂  
@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?

---

<div class="post-metadata">

**Author:** ![Liam](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/liam/32/3562_2.png) [@Liam](https://forum.core-electronics.com.au/u/Liam)\
**Post date:** [21 June 2024 06:58 UTC](https://forum.core-electronics.com.au/t/programmable-button/20229/8 "2024-06-21T06:58:05Z")

</div>

Hi Murali,

Sounds like a really interesting project!!

> [@Murali273296](#):
>
> 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.

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:

> **[Zero To Maker Workshop | Fab Academy (Our Experience) - Tutorial Australia](https://core-electronics.com.au/courses/zero-to-maker-workshop/)**
>
> Welcome to 'Zero to Maker,' a workshop that will walk through and introduce a ton of tools and skills to help Makers of all skill levels! In this series, Jaryd and Liam will be completing projects as a part of the 2024 Fab Academy and will be...

> **[Raspberry Pi Pico Workshop for Beginners - Tutorial Australia](https://core-electronics.com.au/courses/raspberry-pi-pico-workshop/)**
>
> Welcome to the Raspberry Pi Pico Workshop, where you will learn everything you need to know to hit the ground running and start making your own projects with the Raspberry Pi Pico and MicroPython. This workshop is designed for complete beginners and...

Liam

---

<div class="post-metadata">

**Author:** ![Dan](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/dan/32/10815_2.png) [@Dan](https://forum.core-electronics.com.au/u/Dan)\
**Post date:** [1 July 2024 06:45 UTC](https://forum.core-electronics.com.au/t/programmable-button/20229/9 "2024-07-01T06:45:12Z")

</div>

Hi Murali,

Not sure if your project was still ongoing, if its not here’s a link to my [GitHub repo](https://github.com/Drath1995/Pi-Pico-Makerverse-MacroPad/blob/main/main.ino) 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.
