DIY Adaptive Switch Interface
by HelloMakerStudio in Circuits > Assistive Tech
152 Views, 0 Favorites, 0 Comments
DIY Adaptive Switch Interface
This Instructable demonstrates how to create a DIY adaptive switch interface for individuals with fine motor difficulties. By combining 3D-printed components, simple electronics, and minimal microcontroller code, the model functions as a Human Interface Device (HID), allowing two large-surface AT buttons to interface with computers, tablets, or other electronics.
This guide was inspired by a specific use case shared by a speech pathologist interested in exploring a lower-cost alternative to existing products. The design can also be expanded to support additional buttons with extra hardware and slight modifications to the code and CAD files provided below
Supplies
Main Components:
- Adafruit QT Py ESP32-S2 WiFi Dev Board with STEMMA QT - Quantity 1 - $12.50
- Adafruit TRRS Jack Breakout Board - Quantity 2 - $1.75/ea
- Adafruit Perma-Proto ½ Sized Board PCB - Quantity 1 - $4.50
- USBC to USB* Data Cable - Quantity 1 - $6.99/ea
- *Use whichever USB (A,B,C) is compatible with your computer and ensure it is a data cable, not just power.
Additional Supplies:
- Male-to-Male Wires - Quantity 5 - $6.59 for a kit (140 wires)
- Pre-sized wires were used, but you can also cut your own from a wire spool.
- Solder - Quantity 1 - $7.99
Equipment & Tools:
- 3D Printer
- Soldering Iron
- Flush Cutters
Note: Additional tools and materials, including access to a 3D printer, soldering iron, wires, and solder, are also required. In our university makerspace, these tools were already available, but I highly recommend checking for local public makerspaces, which often provide access to these supplies.
Hardware
* The soldering was completed as a group learning experience, so many solder joints use more solder than necessary. I highly recommend watching a soldering tutorial before starting!
- Solder Components
- Solder all pins onto the microcontroller (QT Py ESP32 S2) and breakout boards (TRRS Jacks) to help with stability.
- Solder Components to the Perma-Protoboard.
- To fit the 3D-printed case, you will need to ensure that the boards are set up in the correct orientation:
- TRRS Jack 1: Columns 9-14, Row I
- TRRS Jack 2: Columns 17-22, Row I
- QT-PyESP32-S2: Columns 24-30, Rows F-B
- After soldering components onto the perma-protoboard, use flush cutters to trim the excess pins on the back of the board (Picture not included, apologies).
- Wire Connections
- On the TRRS Jack, “Sleeve” serves as Ground and “Left” carries the button signal to the microcontroller.
- Connect the “Sleeve” pin of each TRRS Jack to the negative rail and the negative rail to GND (three blue wires).
- Connect the “Left” pin of TRRS Jack 1 to A1 on the QTPy (green wire) and the “Left” pin TRRS Jack 2 to A0 on the QTPy (orange wire).
Optional Alterations
Expanding Number of Keys:
Placement of additional TRRS Jacks is flexible. Just ensure that the jacks are oriented so that each pin has its own rail and the circuit remains complete.
Software
- Download the latest version of the Arduino IDE if you have not already.
- Go to “Boards Manager”, type in “esp”, and download esp32 by Espressif.
- Plug in the QT Py ESP32 S2.
- If the board doesn’t automatically pop up at the top, you will need to “Select Other Board and Port”. Search for “qt” in the BOARDS search bar and select Adafruit QT Py ESP32-S2.
- On the QT Py, hold down the [BOOT] button, then click the [RESET] button before releasing the [BOOT] button.
- The board will flash multiple colors to indicate it has reset
- Paste the provided code.
- Hit the [→] button in the Arduino IDE to upload code to the board.
Optional Alterations
Customizing Keys:
Currently, one of the TRRS Jacks is mapped to the spacebar key, and the other is mapped to the enter key. However, this mapping can be altered to use other keys (e.g., swap “enter” or “space” for A, S, D, W, etc.). To accomplish this, check the USBHIDKeyboard docs to ensure you have the correct name for your desired key, then replace it in Keyboard.press(). I also recommend updating the associated code variable names to match the new key assignments to avoid confusion (e.g., “BUTTON_SPACE → BUTTON_W”).
Expanding Number of Keys:
Only two of the analog pins (A0 and A1) on the QTPY ESP32 S2 are in use. By adding more TRRS Jacks, you can map up to four keys (A0, A1, A2, A3), one for each of the microcontroller’s four analog pins. To accomplish this, update the code above to include two additional variables and incorporate them into the setup() and main loops.
Example:
#define BUTTON_W A2
pinMode(BUTTON_W, INPUT_PULLUP);
if (!digitalRead(BUTTON_W)){
Keyboard.press('w');
delay(10);
Keyboard.release('w');
delay(250);
}
You will also need to alter the wiring diagram and CAD design found below to accommodate the additional jacks.
Chasis
- Download the Files
- Files for the 3D-printed case can be found on our Thingiverse page or attached below.
- Print the Files
- Printer Specifications:
- Filament: PLA
- Layer Height: 0.08 mm
- Infill: 15 %
- No supports
- Assembly
- The case is designed as a friction fit and is not intended to be opened frequently. However, you may want to add screw holes or other modifications to make it more robust.
- The lid may feel tight when pushing into place – this is purposeful. There are small tabs on the corners of the four outward projections of the lid that will slot into the bottom of the case. Ensure all corners are aligned and simply push.
Note: I am not an assistive technology professional, nor am I recommending this as a replacement for commercially available switch interfaces.
Written & Created by: Rhiannon Morris
Acknowledgements:
Thank you to Rahul Myana for guidance on electronic selection; Nassib Khan-Cruz and Evan Long for helping me learn basic Onshape functions; and Patrick Benfield and Tuan Le for soldering instruction and assistance.