Smart home shortcut button panel

In 2, 3, and 4 switch varieties
25
48
1
832
updated September 20, 2024

Description

PDF

I wanted to have two shortcut buttons underneath my desk, to turn on and off both a light and a fan. I then got a bit distracted…

This is a snap together enclosure for a couple of Cherry MX style switches and a D1 mini style microcontroller, to be used with ESPHome as a simple way to add pushbutton inputs to a smart home setup. 

Onshape files are available here. The file is capable of generating more than four buttons, I just didn't feel like exporting more than that. You could do 12 buttons on one D1 mini without any additional hardware or matrix, although that many wires could be quite difficult to manage.

Printing

First, decide how many buttons you have. The folders are sorted by how many switch holes each one has.

If you want to screw your buttons to something, choose one of the side mounts. “Side Mount” and “Other Side Mount” are pretty much identical aside from which side the holes are on. Only the bottom is changed for that.

If you want to use some other mounting method, like double sided tape, just print the plain version.

Use supports from the buildplate for the top side, so the bars that smush the microcontroller into place don't sag. You don't need them anywhere else though.

Print the side and middle keycaps as needed. You'll need one side keycap for each side and as many middle ones to fill out the middle. If using two buttons, no middle keycap is needed.

Wiring

The wiring is a bit awkward, due to the shape of the enclosure. But it is very simple. Start by attaching your wires to all the switches. Insert the switches into the top enclosure, then attach all the ground wires together, keeping the positive wires separate (the polarity of each individual switch doesn't matter at all, though, just make sure you don't short anything). Then just wire them all to the microcontroller; the exact pins don't really matter as long as ground goes to G and all your positive wires go to one of the data pins each.

A sample wiring diagram for three switches is as follows:

Programming

I designed this to be primarily used with ESPHome. You can simply follow their Getting Started tutorials to flash and setup the device.

Here is an example configuration for three buttons hooked up as shown in the included diagram:

binary_sensor:
  - platform: gpio
    pin:
      number: D4
      inverted: true
      mode:
        input: true
        pullup: true
    name: "button1"
    
  - platform: gpio
    pin:
      number: D3
      inverted: true
      mode:
        input: true
        pullup: true
    name: "button2"
    
  - platform: gpio
    pin:
      number: D2
      inverted: true
      mode:
        input: true
        pullup: true
    name: "button3"
    

Tags



Model origin

The author marked this model as their own original creation.

License