Skip to content

drpeppershaker/ESP32_keypad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32_keypad

This DIY macropad is built with only off-the-shelf parts. No custom PCBs for absolute ease of building! It uses an ESP32 with ESPHome in order to control devices or trigger automations in Home Assistant.

It has 8 keys, and supports different actions for single, double, and triple clicks, long clicks, and click and holds.


LED Version


NO_LED version

Versions

NO_LED

  • As the names suggest, the NO_LED version does not use any LEDs. This keeps the cost and soldering skills required lower.

LED

  • The LED version uses 16 addressable LEDs -- 8 LEDs for RGB backlighting with various effects and 1 LED for each individual key for reactive keypresses. This version is a few millimeters taller than the NO_LED version to accommodate the LED Pixels.

Requirements

Building the Macro Pad

LED VERSION

(Click to expand)

Tools

Tool Non Referral Link Referral Link Notes
Soldering Iron Kit https://www.amazon.com/dp/B08R3515SF https://amzn.to/3JADtWo This is not the soldering iron kit I used. I use a Pinecil by Pine64, which I can't recommend enough. But if you're just doing one project--just grab a full kit with all the do-dads you need.
Silicone Wire https://www.amazon.com/dp/B01LH1G2IE https://amzn.to/40wMlTD Silicone wire is helpful for wiring the switches to the board. It's extra flexible, which helps with the smash and cram at the end.
Solid Core Wire https://www.amazon.com/dp/B09BFFJRST https://amzn.to/3lhCEd2 Solid core wire is practically a requirement to wire up the LED Pixels. In my original prototype I used the legs from a few resistors, and some header pins instead of solid core wire. It was a PAIN to wire that way. Go with some solid core wire...
M3 Bolts https://www.amazon.com/dp/B0B31SC98Z https://amzn.to/3nlqikM M3 Socket Cap bolts for the 3D Printed Case
Tiny Screws https://www.amazon.com/dp/B09L4R6B1Q https://amzn.to/3JLnSDx I used some tiny screws to attach the ESP32 board to the bottom of the case.

If you choose to use the above affiliate links I may receive a very small commision from Amazon at no extra cost to you

Parts

Parts Referral Link Non-Referral Link Notes
8 Cherry MX Switches https://amzn.to/3YT6VgA https://www.amazon.com/dp/B07KMXJ4KG I like the Blue switches because they're very click-y
an ESP32 board https://amzn.to/41l7mCi https://www.amazon.com/dp/B08DR31G4G These are to the cheapest ESP32 boards I could find on Amazon. Use whatever boards you like
Relegendable Keycaps https://amzn.to/3SmIaqX https://www.amazon.com/dp/B01M023NFK Originally I went with the grey keycaps, but switched to the translucent keycaps when I put the LEDs in.
Addressable LEDs (LED VERSION) https://amzn.to/3yH5whK https://www.amazon.com/dp/B01DC0J0WS I used these pixels because all the LED strips I have are low density and the Pixels are too spread out. I really wanted to cram two LEDs behind each key switch, and this seems like the simplest way to achieve that. After building two keypads with LEDs, I think that someone who isn't me should attempt this with an LED strip with 144 pixel/m strips. You should be able to fit two leds behind each key with that kind of density.

If you choose to use the above affiliate links I may receive a very small commision from Amazon at no extra cost to you

Assembly

  • all switches are now connected to common GND and to their respective GPIOs (see ESPHome YAML files)
    • Note, your GPIO pins may be different based on the version of the board you use. I'm using the built-in PULLUP resistors on the ESP32 board for the switches. If you need to switch GPIO pins, make sure you use pins that have PULLUP resistors.



Leds Wired and test fit. All switches **connected to common GND** rather than VIN.

The LED pixels are sold in a 10x10 grid. The PCBs for each LED are attached to one another, but they are easy to break apart. You will want to keep them attached in two separate 'strips' of 8 connected leds each. Don't try to break them into individual pixels because they'll fall through the case.

NOTE: When wiring up the LED pixels, you can have a single solid wire for all the 5V and one for all the GND contacts. However, the data contacts must be separated and move from DIN to DOUT--they can't be connected on the same pixel or they will NOT work. Stick to the wiring diagram for the Data Line.

Case

STL files here

  • I 3D printed my case. I've included two versions of the macropad case bottom. The images from V1 is using the 'short_bottom'. The short bottom version of the case makes things very tight, but everything should fit if you are careful with your wiring. Run the wires along the sides of the board, and keep them trimmed short. That said, If you don't want to put your soldering skills and smash and cram skills to the test, I also included a slightly taller version as well. The V2 version of the keypad w/ the LEDs that I made was testing my patience already, so I just put it in the taller version of the case. Certainly much easier, and not that much taller overall.

  • The V2 top case has cutouts for the LED pixels and for the common ground wire. This can be printed without supports, your printer must be at least kinda dialed in. You can see my pictures--my printer isn't all that calibrated, and I was still able to print this without supports. The real trick is to print it SLOWLY. The slower you print it, the better chance you'll have of not knocking off the the little center posts, plus your bridging will be better. I dialed my printer back to 35mm/s on both walls and infill and all the way down to 25mm/s for bridging.

  • You will probably want to set your slicer to print the external perimeters first. The case is designed for the key switches to be pressure fit. Printing the outer walls first will help keep the print from over expanding and making your switches not fit. You can also dial back your flow settings to help keep things fitting as they should. If you're still struggling, you can also increase the dimensions of the STLs by 1 or 2 percent to help things fit a bit easier. NOTE: I have not tested printing the case larger, so I don't know how well the LEDs will fit when you size it up.

  • Finally, I'm not a 3D designer or engineer. I adapted the original design from thingiverse for my needs using Tinkercad.

NO_LED VERSION

(Click to expand)

Tools

Tool Non Referral Link Referral Link Notes
Soldering Iron Kit https://www.amazon.com/dp/B08R3515SF https://amzn.to/3JADtWo This is not the soldering iron kit I used. I use a Pinecil by Pine64, which I can't recommend enough. But if you're just doing one project--just grab a full kit with all the do-dads you need.
Silicone Wire https://amzn.to/40wMlTD https://www.amazon.com/dp/B01LH1G2IE Silicone wire is helpful for wiring the switches to the board. It's extra flexible, which helps with the smash and cram at the end.
Solid Core Wire https://amzn.to/3lhCEd2 https://www.amazon.com/dp/B09BFFJRST Solid core wire is practically a requirement to wire up the LED Pixels. In my original prototype I used the legs from a few resistors, and some header pins instead of solid core wire. It was a PAIN to wire that way. Go with some solid core wire...
M3 Bolts https://www.amazon.com/dp/B0B31SC98Z https://amzn.to/3nlqikM M3 Socket Cap bolts for the 3D Printed Case
Tiny Screws https://www.amazon.com/dp/B09L4R6B1Q https://amzn.to/3JLnSDx I used some tiny screws to attach the ESP32 board to the bottom of the case.

If you choose to use the above affiliate links I may receive a very small commision from Amazon at no extra cost to you

Parts

Parts Referral Link Non-Referral Link Notes
8 Cherry MX Switches https://amzn.to/3YT6VgA https://www.amazon.com/dp/B07KMXJ4KG I like the Blue switches because they're very click-y
an ESP32 board https://amzn.to/41l7mCi https://www.amazon.com/dp/B08DR31G4G These are to the cheapest ESP32 boards I could find on Amazon. Use whatever boards you like
Relegendable Keycaps https://amzn.to/3SmIaqX https://www.amazon.com/dp/B01M023NFK

If you choose to use the above affiliate links I may receive a very small commision from Amazon at no extra cost to you

Assembly

  • all switches are now connected to common GND and to their respective GPIOs (see ESPHome YAML files)
    • Note, your GPIO pins may be different based on the version of the board you use. I'm using the built-in PULLUP resistors on the ESP32 board for the switches. If you need to switch GPIO pins, make sure you use pins that have PULLUP resistors.



Case

STL files here

  • I 3D printed my case. I've included two versions of the macropad case bottom. The images from the NO_LED version is using the 'short_bottom'. The short bottom version of the case makes things very tight, but everything should fit if you are careful with your wiring. Run the wires along the sides of the board, and keep them trimmed short. That said, If you don't want to put your soldering skills and smash and cram skills to the test, I also included a slightly taller version as well.

  • You can use the LED version of the case and it will still work well for the non-led version of the keypad. However, the LED version of the case requires your printer to be more dialed in, and you will likely need to print slower because it has more overhangs.

  • You will probably want to set your slicer to print the external perimeters first. The case is designed for the key switches to be pressure fit. Printing the outer walls first will help keep the print from over expanding and making your switches not fit. You can also dial back your flow settings to help keep things fitting as they should. If you're still struggling, you can also increase the dimensions of the STLs by 1 or 2 percent to help things fit a bit easier. NOTE: I have not tested printing the case larger, so I don't know how well the LEDs will fit when you size it up.

  • Finally, I'm not a 3D designer or engineer. I adapted the original design from thingiverse for my needs using Tinkercad.

Programming

  • Add your ESP device to Home Assistant once detected
  • Install esp32_keypad.yaml
  • Add your own automations (you can use the one here for inspiration).
    • Note: this uses events rather than binary sensors for recording multi-clicks.

Icons

icons here

  • I've included individual icons, a printable template, and a blank template for printing out your own icons for your relegendable keycaps.

Credits

inspired by:

STLs:

icons:

Special Thanks:

About

ESP32 Keypad for use with ESPHome and Home Assistant

Topics

Resources

License

Stars

Watchers

Forks