DIY Switches for Assistive Tech – Big Button Audio Sound Box

In this guide you'll learn how to build an Audio Sound Box using Circuit Playground Express and CircuitPython. This device can play back short audio clips and features a really big arcade button that lights up when you press it. It’s a pretty simple project but it’s very useful for the assistive tech community. Similar products are actually quite pricey so a DIY solution can be cost effective, and of course this is customizable!

Prerequisite Guides

If your new to electronics and the Adafruit Circuit Playground Express, I suggest you walk through the following guides to get the basics. The CircuitPython guide will walk you through setting it up.

Electronic Components

The Circuit Playground Express, massive arcade button, PAM8302 amplifier and speaker are the main electronic components used in this project.

1 x Adafruit Circuit Playground Express
NeoPixels, Sensors, buttons and more!
1 x Panel Mount Right Angle 10K Linear Potentiometer
w/On-Off Switch - 10K Linear w/ Switch
1 x USB DIY Connector Shell
Type Micro-B Plug
1 x USB Micro-B Breakout Board
USB Micro-B connector
1 x 3 x AA Battery Holder
with On/Off Switch, JST, and Belt Clip

Hardware and Supplies

Just a few screws, stickers and wires. 

1 x JST Extension
Male to Female JST-PH Battery Extension Cable 500mm
4 x M2.5 x .45 x 5mm
Flat Head Phillips Machine Screws
2 x M3 x .45 x 5mm
Flat Head Phillips Machine Screws
1 x 30AWG Wire
Silicone Covered Stranded
1 x Solder Wire
Solder Spool - 1/4 lb SAC305 RoHS lead-free / 0.031" rosin-core - 0.25 lb / 100 g
1 x Heat Shrink Tubing
Multi-Colored Heat Shrink Pack - 3/32" + 1/8" + 3/16" Diameters
1 x Mounting Putty Tack
Loctite Fun-Tak Mounting Putty 2-Ounce

Cool Tools!

These help make the project a smooth building experience. You don't need them all of them, but I recommend them.

1 x Spudger
Double Sided Prying Tool
1 x Ultimaker 3
3D Printer
1 x Wire Strippers
Hakko Professsional Quality 20-30 AWG Wire Strippers - CSP-30-1
1 x Wire Cutters
Flush diagonal cutters - CHP170
1 x Soldering Iron
Adjustable 30W 110V soldering iron - XY-258 110V
1 x Panavise
Panavise Jr. - PV-201
1 x Helping Third Hands
Helping Third Hand Magnifier W/Magnifying Glass Tool - MZ101

Circuit Diagram

This provides a visual reference for wiring of the components. They aren't true to scale, just meant to be used as reference.

  • VOUT from CPX to VIN on PAM8302
  • GND from CPX to GND on PAM8302
  • A0 from CPX to Pot
  • Pot to GND on CPX
  • Pot to A+ on PAM8302
  • A- from PAM8302 to GND on PAM8302
  • Button to GND on CPX
  • Button to A4 on CPX
  • Speaker to -+audio output on PAM8302 
  • TRS to GND and A4 on CPX
  • Battery to Pot / JST Extension

Fritzing Diagram

The circuit diagram was assembled in the Fritzing software. All of the components are contained in the source so they can be reused to make new projects. Download and modify the circuit diagram.

Setup Adafruit Circuit Playground Express for CircuitPython

We'll need to get our board setup so we can run CircuitPython code. First thing we'll need to do is connect the board to your computer with a microUSB cable. Then double-click on the reset button to put it in "UF2" boot-loader mode. The NeoPixels will turn green. The board will then show up as a USB storage device on your computer named "CPLAYBOOT". 

Follow the guide below to setup the firmware, once complete, come back here and proceed.

Download Adafruit CircuitPython Library Bundle

In order to run the code, we'll need to download some libraries. The download linked below will contain all the libraries available for Circuit Python. To run the code for this project, we only need a few. Unzip the downloaded file and look for the following libraries.

Required Libraries 

  • Adafruit Neopixel – neopixel.mpy

Install Circuit Python Libraries 

Now that we have all of the libraries and know which ones this project needs, we'll need to copy them onto the CircuitPlayground Express USB drive (which will be named CIRCUITPY after flashing the firmware). In the CIRCUITPY drive, create a new folder and name it lib. Then, copy the libraries to that "lib" folder. The lib folder should contain neopixel.mpyadafruit_hid and adafruit_circuitplayground .

Upload Code

OK, now it's time to upload the code for this project onto the CIRCUITPY drive. Create a new text document using a text app. Then, copy the code below and paste it into that newly created text document. Save that text document to the CIRCUITPY drive and name it "". Once saved, the code will automatically run and will start working.

Editing Code

You'll want to use the Mu python editor to modify the code. Mu is a simple code editor that works with the Adafruit CircuitPython boards. It's written in Python and works on Windows, MacOS, Linux and Raspberry Pi. The serial console is built right in so you get immediate feedback from your board's serial output! See the guide below to for download and setup instructions.

# SPDX-FileCopyrightText: 2019 Noe Ruiz for Adafruit Industries
# SPDX-License-Identifier: MIT

import time
import board
from digitalio import DigitalInOut, Direction, Pull
import audioio
import audiocore
import neopixel

filename = "electrons.wav"

# The pad our button is connected to:
button = DigitalInOut(board.A4)
button.direction = Direction.INPUT
button.pull = Pull.UP

pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=1)

# NeoPixel Animation
def simpleCircle(wait):
    PURPLE = (255, 0, 255)
    BLACK = (0, 0, 0)
    CYAN = (0, 255, 255)
    ORANGE = (255, 255, 0)

    for i in range(len(pixels)):
        pixels[i] = PURPLE
    for i in range(len(pixels)):
        pixels[i] = CYAN
    for i in range(len(pixels)):
        pixels[i] = ORANGE
    for i in range(len(pixels)):
        pixels[i] = BLACK

# Audio Play File
def play_file(playname):
    print("Playing File " + playname)
    wave_file = open(playname, "rb")
    with audiocore.WaveFile(wave_file) as wave:
        with audioio.AudioOut(board.A0) as audio:
            while audio.playing:

while True:
    if not button.value:

Audio Files

If you'd like to create your own sounds, they will need to be a certain file format. You can use this Adafruit Guide or online converters to encode your audio files. You can download our audio sample for reference and to quickly test and get started. The format of the sound file should be:

  • .Wav File format – 16-bit integer (Little Endian)
  • Mono, 22.050 kHz

What If I Don't Have A 3D Printer?

Not to worry! You can use a 3D printing service such as 3DHubs or MakeXYZ to have a local 3D printer operator 3D print and ship you parts to you. This is a great way to get your parts 3D printed by local makers. You could also try checking out your local Library or search for a Maker Space.

3D Printed Parts

All of the parts are 3D printed with FDM type 3D printers using various colored filaments. All of the parts are separated into pieces to make 3D printing easier. Assembly is pretty easy and straight forward. Use the links below to download the STLs files.

Slice Settings

These parts have been tested and 3D printed on an Ultimaker 2+ and 3 using PLA filament. The parts were sliced using CURA 3.x with the following slice settings.

  • 220C extruder temp
  • 65c bed temp
  • 0.2 layer height
  • 0.38 line width
  • 2 Wall Line Count – 0.4 nozzle
  • 20% infill
  • 50mm/s print speed

Enclosure Design

To house all of the electronics I designed a parametric box using Autodesk Fusion 360. Most of the components will be paneled mounted or secured to built in standoffs with machine screws.

Design Source Files

The camera body assembly was designed in Fusion 360. This can be downloaded in different formats like STEP, SAT and more. Electronic components like the PAM8302, Circuit Playground Express, potentiometer and speaker can be extracted from the Fusion 360 Archive.

Disassembling Arcade Button

We'll need to take apart the arcade button in order to embed the CPX. The button is designed to be disassembled so it should be fairly straight forward. We'll start by removing the micro switch from the button assembly.

Remove Micro Switch

Grasp onto the outer button housing and micro switch. Firmly twist the micro switch counter clockwise – It should make a click. Then, pull out the body of the micro switch away from the stem. The micro switch should have the LED housing intact.

Remove Threaded Ring

Unscrew the threaded ring from the stem of the button housing. The outer button housing should loosely pull out from the stem. 

Separate Button Housing

Pinch the two white colored tips on the end of the button stem while pushing them into the stem – The white housing should lift up out of the black housing. Separate the two and set side the compression spring.

Spudger Action

Pry open the dome from the button housing using a spudger or tool with a slim shim edge to get in between the two. Firmly gasp onto the dome while conducting the prying action. 

Micro Switch Teardown

Pull back the taller black colored clip from the red side of the micro switch.  Rotate the micro switch until it comes loose from the black colored housing. Pull out the LED housing and two metal terminals from the black housing.

Pre-drill Planning

We need to pass wires through the white colored housing so we'll need to drill some holes. We can use the holes from the outer housing as reference for marking where the holes need to be.

Marking Holes

Place the white colored button housing into the main container. Flip the assembly over and use a sharpie marker to fill the holes.

Slotted Holes

Note the orientation of the legs on the white housing, this ought to be in the correct position to allow proper actuation. The two parts have some give so they can move slightly – you'll want to fill as much space available to create slotted holes.

Marked Holes

Remove the white housing from the container to the marked slotted holes. These don't have to by fully filled, just enough to get a good reference for drilling.

Drill Holes

Now it's time to make drill holes! Your choice of tool, a rotary tool like a Dremel or an impact drill will be suffice. To prevent drilling holes into our tabletop, we place a scrap piece of wood under the white housing. This will catch the drill bit when it pokes through the housing.

Drilled Holes

Drilling plastic for too long can cause the material to over heat and melt leaving behind welded chips. I used a pointed sanding bit to grind away material while smoothing out the edges.  

Test Fitting

Reinstall the housing to see if the holes line up – Be sure to orient the actuator legs in the correct positions.  These holes should allow enough space for wires to pass through.

Wire Lengths

We'll need access the USB port on the CPX once it is embedded inside the arcade button. So we'll need to DIY a USB cable so that we can still connect the CPX. We'll need five wires to create a micro USB cable.

Wire Tinning

I suggest using 30AWG silicone coated wires. Different colored wires allows you to tell the connections apart from each other. Using wire stripper, remove a bit of insulation from each wire. To prevent the strands of wires from fraying, you can add a bit of solder to tin them.

Soldering Connector

We'll need to solder these wires to the male micro USB connector. Due to the tiny pads, this can be quite difficult – A pointy tipped soldering iron is recommended. Follow the circuit diagram to get the proper connections.

DIY USB Connector

Once soldered, I suggest adding pieces of heat shrink tubing to keep all of the wires bundled together. You'll want to double check your solder joints to ensure they're making proper connections.

Wires for Audio Amplifier

The PAM8302 will need four wired connections. Three longer wires and one shorter wire. These wires will connect to the amplifier to the CPX. The potentiometer will be wired inline with the amp and CPX to allow volume adjustment.

Tinning Wires

Using wire strippers, remove a bit of insulation from the tips of each wire. Then, tin the strands of wire together using a bit of solder. Third helping hands can help keep the wires in place while applying solder. Heat shrink tubbing will help keep the wires together.  

Amplifier Wires Soldered

Solder the wires to the pins on the PAM8302. The shorter wire should be wired to the A– labeled pin.

Ground Audio Input

The wire connected to the A- pin will need to tie to the GND pin on the PAM8302. The GND pin should share two of the wired connections.

Connecting Speaker to Amp

The two wires from the speaker will need to be soldered to the audio output on the PAM8302 amplifier. I do not suggest using the included screw block terminal because it will block the mounting holes – Wires should be soldered directly to the pins.

Speaker Audio Cable

The wire on the speaker is fairly long and can be shorted to keep the connections nice and neat. Use wire cutters to trim the cable short. 

Shortened Speaker Wire

The wire can be about the length of the 3d printed box enclosure. 

Tinning Speaker Wires

Separate the speaker cable by pulling the two apart. Then, strip each wire using wire strippers. You can tin the exposed strands of wire by applying a bit of solder.

Solder Speaker Wires to Amp

The red colored wire is the (+)positive connection while the black is the (–)negative connection. Solder the two wires from the speaker to the output on the PAM8302.

Potentiometer and Switch Wires

The potentiometer will need two wires and the JST extension cable. This will need to be connected to both the battery and the PAM8302 audio amplifier.

Tin Wires

More wires means more wire stripping and tinning! Using wire stripper, remove a bit of insulation from the tips of each wire and apply a bit of solder to tin the strands of wires. Adding a few pieces of heat shrink tubing will keep the wires bundled together.

Solder Wires to Pot

The two wires can then be soldered to the two legs on the potentiometer. The blue wire is connected to the far left leg. The green wire is connected to the right left. Grab the PAM8302 audio amplifier and pick out the wire connected to the A+ pin. This wire needs to be soldered to the middle leg of the potentiometer. 

Remove nub

While we're working with the pot, remove the nub protruding from the top. This piece will prevent the pot from being panel mounted. I used flat pliers to grasp the nub and twisted it until it broke away.

Wired Potentiometer

Double check your wiring and ensure the wires are connected to the correct pins / terminals. Now is a good time to apply heat shrink tubing to keep the wires nice and tidy.

JST Extension Cable

We'll need to connect the JST extension cable to the on/off switch on the potentiometer. The cable features a male JST connector on one end and female on the other.

Shortened Wires

You can shorten the wires using wire cutters. The end with the connectors are separated into two wires. The length of the wires are about the length of the wire cutters.

Tinned Wires

Using wire strippers, remove a bit of insulation from the tips of each wire. Then, add a bit of solder to tin the stranded of wire. Bits of heat shrink tubing will keep the wires bundled together when splitting them apart.

Tinning Switch Leads

On the bottom of the potentiometer are two extra legs – These are the terminals for the built in switch. Apply a bit of solder to them to make it easier to attach the wires from the JST wires.

Solder Wires to Switch

The red wires from the male and female JST wires need to be connected to the two terminals on the potentiometer switch. They should be wired in a "right angled" orientation – This will make it nice and tidy once panel mounted to the 3d printed box enclosure.

Tie Grounds

The black wires (ground conection) from the male and female JST wire needs to be connected together. Use a piece of heat shrink tubing to insulate the exposed wires.

Wired JST to Pot Switch

Double check all of the wired connections to ensure everything is properly soldered. Now is a good time to adjust wire lengths or add addition heat shrink tubing.

Disassemble Switch

I suggest taking the micro switch out of the housing. The assembly can be taken apart as shown in the photo. We won't be needing the LED, so you can discard it along with the electrode terminals. We will need the black housing bit, so keep that handy.

Wires for Micro Switch

We need two wires to connect the micro switch to the CPX. The polarity doesn't matter for switches but I used different colored wires for consistency. Don't forget the heat shrink!  

Wire Tinning

More tinning here, you know the drill! Using wire strippers, remove a bit of insulation from the tips of each wire – Then apply a bit of solder to the strands of wire. Remember, third helping hands can help!

Tinning Terminals

OK, now it's time to wire up the micro switch. The terminals are rather chunky so you'll want to apply a good amount of solder to them.

Solder Wires to Terminals

Attach the wires! Again, polarity doesn't matter all that much but its good to keep the colors of the wires consistent with the rest of the connections.

Wired Micro Switch

Note the orientation of the wires. They're setup in a right angle type position – This will accommodate for the space in the 3d printed box enclosure and keep a low-profile.

Reinstall Button Housing

Once wired, you can put the micro switch back into the black housing part.

Wires for the TRS jack

TRS audio jacks normally need three wired connections but we only need two for this project. Prep the wires by stripping a bit of insulation from the tips of each wire and apply a bit of solder to the strands to tin them. 


Jumper Jack

We'll need to tie the two smaller legs of the TRS jack together. So I used a piece of header pins to do so. Each leg has a small hole in it, so I slipped on a single header pin to the holes, essentially bridging the two.

Tinning Terminals

Then, I apply some solder to fuse the header pin to the two legs. Be careful not to melt the plastic housing from the button or the header pin. You'll want to work quickly or the plastic will melt – Avoid holding the tip of the iron too long when soldering. 

Soldered Wires

Now we can attach the two wires to the larger leg and one of the smaller ones. Polarity doesn't matter as long as one wire is attached to one of the smaller legs, and the other to the larger leg.

Check Solder

You'll want to remove the plastic bit from the header pin and double check to ensure the solder joints are fully fused and making a solid electrical connections.

Wired TRS Jack

The TRS jack is now wired and ready to connect! Don't forget to add heat shrink!

Wiring Check Point

Now is a great time to double check all of the component to ensure everything is wired up correctly. If any wire lengths need to adjusted or need additional pieces of heat shrink tubing, now is the time to get those setup.

Install Button Holder

Fit the 3d printed button holder over the black button housing by inserting the steam through the center hole. The side walls should match up with the nubs on the side of the holder. Rotate the holder until they line up and hold them together.

Install Button to Box

Now fit the stem of the button housing through the center hole on the 3d printed box enclosure. Hold them together and flip the box under. Insert the threaded ring by screwing it onto the threaded stem of the button housing.

Setup Box

Ensure the holes are lined up before fully tightening the threaded ring. 

Orient Holes 

Flip the box assembly back over and look to see if the holes are all lined up and matching. If the holes are slightly off center, you can reinstall the button housing by rotating it 180 degrees. 

Install and Secure Speaker

Place the speaker into the 3d printed box enclosure. Orient the speaker so the cone lines up with the little holes on the side of the box. The tabs of the speaker should slide into the clips inside of the box. You can insert and fasten two M3 x 5mm screws to secure the top tabs on the speaker to the standoffs on the side of the box enclosure.

Tap Mounting Holes

The mounting holes on the PAM8302 audio amplifier are a bit tight, so I suggest using an M2.5 tapping tool to thread the holes. This will make it easier to fasten M2.5 machine screws through the mounting holes. 

Secure Amplifier

Place the PAM8302 audio amplifier into the 3d printed box enclosure. Line up the mounting holes with the two standoffs inside the box. Hold the board down while fastening the machine screws to the standoffs. 

Install Potentiometer

Insert the shaft of the potentiometer through the inside of the 3d printed box enclosure. Press the shaft all the through the hole in the corner of the box. Hold it up against the top surface and insert the washer and hex nut. Fasten the nut until it's fully tightened and secured to the box.

Thread Amp Wiring

Grab the wiring from the amplifier and thread them through one of the holes in the box. On the top side of the button, pull the wiring all the way through.

Thread JST Power

Do the same wire thread for the JST male connector. I pushed the connector through a different hole.

Install TRS Jack

Insert the TRS jack through the side hole on the inside of the 3d printed box enclosure. While holding it in place, screw the included hex nut to panel mount the jack to the side of the box. Fasten the hex nut until it's fully tightened and secured to the box.

Thread TRS Wires

Insert and thread the wiring from the TRS jack to one of the holes. Here I shared the same hole as the button wiring, for consistency purposes. They're both going to connected to the same pins on the CPX.

Installed TRS / Button Wires

Here's what the inside of the 3d printed box enclosure looks like. Try to keep the wires nice and tidy, so lots of heat shrink tubing is ideal. 

Installed USB Cable

Now we can insert the wires from the USB cable through the TOP of the button housing (not the inside). The male USB connector should be on the outside of the 3d printed box enclosure.

Threaded Wiring

And now we have all of the wires threaded through the holes! Up next we'll connect all of these wires to the CPX. 

CPX Wiring Setup

OK now it's time to wire up the CPX. Before we get started, its good idea to note which pads will be used. If you did use different colored wires for all of the components, it should be fairly easy to tell the connections apart from each other. 

Tinning Pads on CPX

To keep the wiring concealed and hidden, I ended up connecting the wired to the bottom of the board. However, it's a little more difficult because there are no labels on the bottom of the board. Either way, I tinned the pads with solder before attaching the wires.

Wired Connections

I soldered all of wires oriented "inwards", again trying to keep the wiring nice and neat. The pads are quite large so it was possible to attach multiple wires to them – Like the TRS and micro switch connections, also one of the grounds.

Plug In Power and USB

With the wires now soldered to the pads on the CPX, we can plug in the male JST connector and the male micro USB.

Final Wire Check

Here's the under belly. Good idea to double check all of the wiring to ensure we soldered everything to the correct pads. If you connected to the bottom side, you may want to flip back and forth and cross reference the circuit diagram.

Connect USB Breakout

And the last thing to wire up is the cable from the male micro USB connector. We saved this for last because we would not be able to thread either the usb connector nor the breakout board through the holes in the top.

Mount USB Breakout

With the breakout now wired up we can mount it to the bottom cover of the 3d printed box enclosure. Place the board over the two standoffs with the usb port facing the edge. Use two M2.5 x 5mm machine screws to secure the board to the standoffs.

Connect Battery

Now we can plug in the battery to the female JST connector that resides inside the box. Here I'm using a hefty 2000mAh lipo cell but you can use a AA battery pack. Plenty of room inside the box the AA pack.

Attach Battery

You'll need to attach the battery to the side walls of the 3d printed box enclosure. I used mounting tack but double stick or hot glue will also work. Depends on if you want a more permanent solution or not. Either way its no fun of the battery can jostle around in the box.

Closing Bottom Cover

With everything secured we can now snap on the bottom cover to the 3d printed box enclosure. Line up the bottom cover so the micro USB breakout is lined up with the small cutout on the side of the box.

Closed Case

The little hole for the USB port should be large enough to allow even the chunkiest of microUSB cables because it's fairly close to the edge of the box.

Install Knob (Optional)

You can attach your own knob to the shaft of the potentiometer if you'd like. I opt'd in for that large machined knob to match the largeness of the arcade button. This knob has a set screw for securing to the shaft – You'll need an M2 sized allen key to tighten the set screw.

Test Cover

It's up to you weather or not you want to cover up the CPX board. I didn't at first but I found the included button cover diffuses the neopixel LEDs quite nicely.  

Install Dome

Either way, you'll want to reinstall the dome back onto the top of the button housing. Firmly press down on the dome to snap the outer edges to the housing. It may require a good amount of force so don't fret if you think you're applying too much pressure. 

This guide was first published on Feb 14, 2018. It was last updated on Feb 14, 2018.