# Ambient Sound Machine

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/123/450/medium800/hand_tools_ambient-4303.jpg?1691879071)

https://youtu.be/FRsrnrH9DR0

Flip switches to fill your home with beautiful ambient sounds using this fun new project. Based on [the beautiful work of Yuri Suzuki](https://www.yurisuzuki.com/projects/the-ambient-machine), this DIY version of The Ambient Machine can be built from a couple of inexpensive IKEA storage drawers.

Ambient Sound Machine uses CircuitPython to play up to ten audio samples simultaneously at the flip of a toggle switch. Mix and match to your liking. Each sound can be toggled between two volume levels as well.

## Parts
Featured
### Adafruit Metro M7 with AirLift - Featuring NXP iMX RT1011

[Adafruit Metro M7 with AirLift - Featuring NXP iMX RT1011](https://www.adafruit.com/product/4950)
Get ready for our fastest Metro ever - the NXP iMX RT1011 microcontroller powers this board with a 500 MHz ARM Cortex M7 processor. There's 8 MB of execute-in-place QSPI for firmware + disk storage and 128KB of SRAM in-chip, plus a WiFi co-processor using an on-board&nbsp;ESP32...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4950)
[Related Guides to the Product](https://learn.adafruit.com/products/4950/guides)
![Adafruit Metro M7 with AirLift - Featuring NXP iMX RT1011.](https://cdn-shop.adafruit.com/640x480/4950-08.jpg)

### 2 x
Featured
### Adafruit MCP23017 I2C GPIO Expander Breakout

[Adafruit MCP23017 I2C GPIO Expander Breakout](https://www.adafruit.com/product/5346)
We’ve gotten a lot of requests for a MCP23017 breakout and we’ve always sorta been like “[ehh why not just use the DIP chip?](https://www.adafruit.com/product/732)” but with STEMMA QT we could see the use case for a plug and play version that comes with all...

In Stock
[Buy Now](https://www.adafruit.com/product/5346)
[Related Guides to the Product](https://learn.adafruit.com/products/5346/guides)
![Angled shot Adafruit MCP23017 I2C GPIO Expander Breakout](https://cdn-shop.adafruit.com/640x480/5346-05.jpg)

### 20 x
Featured
### Mini Panel Mount SPDT Toggle Switch

[Mini Panel Mount SPDT Toggle Switch](https://www.adafruit.com/product/3221)
This or that, one or the other, perhaps or perhaps not! So hard to make decisions these days without feeling like you're just going back and forth constantly. Deciding whether or not to use this mini toggle switch? That's the easiest decision you'll make all day!

This...

In Stock
[Buy Now](https://www.adafruit.com/product/3221)
[Related Guides to the Product](https://learn.adafruit.com/products/3221/guides)
![Angled shot of blue, mini, SPDT toggle switch.](https://cdn-shop.adafruit.com/640x480/3221-01.jpg)

Featured
### Adafruit Swirly Aluminum Mounting Grid for 0.1" Spaced PCBs

[Adafruit Swirly Aluminum Mounting Grid for 0.1" Spaced PCBs](https://www.adafruit.com/product/5774)
With most of our dev boards, sensors and feathers now sporting [plug-and-play stemma QT ports](https://learn.adafruit.com/search?q=stemma%2520qt)&nbsp;it can be very fast to put together projects with half a dozen boards snapped together. But that ease of use has one...

In Stock
[Buy Now](https://www.adafruit.com/product/5774)
[Related Guides to the Product](https://learn.adafruit.com/products/5774/guides)
![Top shot of a feather, a humidity sensor, a potentiometer and an I2C quad board mounted on to the grid. ](https://cdn-shop.adafruit.com/640x480/5774-05.jpg)

Featured
### Adafruit I2S 3W Class D Amplifier Breakout - MAX98357A

[Adafruit I2S 3W Class D Amplifier Breakout - MAX98357A](https://www.adafruit.com/product/3006)
Listen to this good news - we now have an all in one digital audio amp breakout board that works incredibly well with the&nbsp;[Raspberry Pi](https://www.adafruit.com/category/105)! If you're looking for an easy and low cost way to get your digital sound files...

In Stock
[Buy Now](https://www.adafruit.com/product/3006)
[Related Guides to the Product](https://learn.adafruit.com/products/3006/guides)
![Angled shot of blue, square-shaped, amplifier breakout with a pre-soldered terminal block.](https://cdn-shop.adafruit.com/640x480/3006-04.jpg)

### STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long

quantity: 2
[STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long](https://www.adafruit.com/product/4210)
This 4-wire cable is a little over 100mm / 4" long and fitted with JST-SH female 4-pin connectors on both ends. Compared with the chunkier JST-PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert and remove.

<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/4210)
[Related Guides to the Product](https://learn.adafruit.com/products/4210/guides)
![Angled shot of STEMMA QT / Qwiic JST SH 4-pin Cable.](https://cdn-shop.adafruit.com/640x480/4210-00.jpg)

### Speaker - 3" Diameter - 4 Ohm 3 Watt

[Speaker - 3" Diameter - 4 Ohm 3 Watt](https://www.adafruit.com/product/1314)
Listen up! This 3" diameter speaker cone is the perfect addition to any audio project where you need an 4 ohm impedance and 3W or less of power. We particularly like this cone as it has 4 handy mounting tabs 60mm apart.  
  
Works great with our <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/1314)
[Related Guides to the Product](https://learn.adafruit.com/products/1314/guides)
![Angled Shot of the Speaker - 3" Diameter - 4 Ohm 3 Watt](https://cdn-shop.adafruit.com/640x480/1314-07.jpg)

### Arcade Button Quick-Connect Wire Pairs - 0.11" (10 pack)

[Arcade Button Quick-Connect Wire Pairs - 0.11" (10 pack)](https://www.adafruit.com/product/1152)
Quick connector wire sets will make wiring up our arcade-style or metal buttons quicky-quick. Each wire comes as a 'pair' with two 0.11" quick-connects pre-crimped onto 20cm long wires. The wires are then terminated together in a JST 2.5mm/0.1" spaced 2-pin connector (we...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1152)
[Related Guides to the Product](https://learn.adafruit.com/products/1152/guides)
![Angled shot of ten 20 cm long quick-connect wire pairs. ](https://cdn-shop.adafruit.com/640x480/1152-06.jpg)

### USB C Jack to USB C Jack Round Panel Mount Adapter

[USB C Jack to USB C Jack Round Panel Mount Adapter](https://www.adafruit.com/product/4261)
If you need to add a panel-mount connection for USB C, but don't have the time or tools to cut a custom oval or square hole, this **USB C Jack to USB C Jack**** &nbsp;Round Panel Mount Plug** is the easiest and fastest way to panel-ify your project. It's about...

In Stock
[Buy Now](https://www.adafruit.com/product/4261)
[Related Guides to the Product](https://learn.adafruit.com/products/4261/guides)
![Angled shot of a black, round, panel mount adapter with a USB-C socket.](https://cdn-shop.adafruit.com/640x480/4261-01.jpg)

### DIY USB Cable Parts - Straight Type C Plug

quantity: 2
[DIY USB Cable Parts - Straight Type C Plug](https://www.adafruit.com/product/4108)
If you love DIY cable-rigging, then these USB adapters are right up your alley! Making custom USB cables has never been easier. Just grab one of our [ribbon cables](https://www.adafruit.com/?q=diy%20usb%20ribbon), then swap and switch any of our USB adapters on each end using the...

In Stock
[Buy Now](https://www.adafruit.com/product/4108)
[Related Guides to the Product](https://learn.adafruit.com/products/4108/guides)
![Angled Shot of the DIY USB Cable Parts - Straight Type C Plug (Ribbon End)](https://cdn-shop.adafruit.com/640x480/4108-06.jpg)

### DIY USB or HDMI Cable Parts - 20 cm Ribbon Cable

[DIY USB or HDMI Cable Parts - 20 cm Ribbon Cable](https://www.adafruit.com/product/3561)
If you're looking to make a custom cable with any two of our USB or HDMI adapters, then you'll need to have these flex cables handy!&nbsp;Making custom cables has never been easier. Just grab one of these cables, then swap and switch any of the plug or socket adapters on each end using...

In Stock
[Buy Now](https://www.adafruit.com/product/3561)
[Related Guides to the Product](https://learn.adafruit.com/products/3561/guides)
![20 centimeter long black, skinny ribbon cable crossed like a bowtie.](https://cdn-shop.adafruit.com/640x480/3561-00.jpg)

### Woven USB Cable with USB Type A to Right Angle USB Type C

[Woven USB Cable with USB Type A to Right Angle USB Type C](https://www.adafruit.com/product/5031)
Some days we're feeling extra fancy here at the 'fruit warehouse, and we have a big soft spot for woven fabric cables. Like, peep [this fully reversible pink/purple Blinka-inspired cable](https://www.adafruit.com/product/4111)&nbsp;or <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/5031)
[Related Guides to the Product](https://learn.adafruit.com/products/5031/guides)
![Top shot of  right angle USB C to A woven 1m length black](https://cdn-shop.adafruit.com/640x480/5031-07.jpg)

### Silicone Cover Stranded-Core Wire - 2m 26AWG Black

[Silicone Cover Stranded-Core Wire - 2m 26AWG Black](https://www.adafruit.com/product/1881)
Silicone-sheathing wire is super-flexible and soft, and its also strong! Able to handle up to 200°C and up to 600V, it will do when PVC covered wire wimps out. We like this wire for being extremely supple and flexible, so it is great for wearables or projects where the wire-harness has to...

In Stock
[Buy Now](https://www.adafruit.com/product/1881)
[Related Guides to the Product](https://learn.adafruit.com/products/1881/guides)
![Black Silicone Cover Stranded-Core Wie](https://cdn-shop.adafruit.com/640x480/1881-01.jpg)

### Black Nylon Machine Screw and Stand-off Set – M2.5 Thread

[Black Nylon Machine Screw and Stand-off Set – M2.5 Thread](https://www.adafruit.com/product/3299)
Totaling 380 pieces, this **M2.5 Screw Set** &nbsp;is a must-have for your workstation.&nbsp;You'll have enough screws, nuts, and hex standoffs to fuel your maker tendencies&nbsp;for days on end! M2.5 size screws fit almost all of the Adafruit breakout/dev board mounting holes...

In Stock
[Buy Now](https://www.adafruit.com/product/3299)
[Related Guides to the Product](https://learn.adafruit.com/products/3299/guides)
![Black Nylon Screw and Stand-off Set with M2.5 Threads, kit box](https://cdn-shop.adafruit.com/640x480/3299-00.jpg)

## Materials
### IKEA Moppe Mini storage chest

[Birch plywood storage chest](https://www.ikea.com/us/en/p/moppe-mini-storage-chest-birch-plywood-40216357/) with drawers. You can pick these up at most IKEA locations.

We'll use one medium drawer and one small drawer.

![hand_tools_moppe.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/453/medium640/hand_tools_moppe.jpg?1691879674)

Any suitable box you find can also be used.

# Ambient Sound Machine

## The Ambient Machine Circuit

Below you'll find a circuit diagram and schematic for the Ambient Machine. The Metro M7 is the central controller. The two MCP23017 GPIO expanders are used for reading the twenty switches, sending their data to the Metro M7 over I2C. The MAX98357A amplifier receives digital audio from the M7 via I2S and converts that to an analog output for the speaker.

The switches each have their own unique pin on the expander boards, and share a common ground.

![](https://cdn-learn.adafruit.com/assets/assets/000/123/435/medium800/hand_tools_ambient_fritz.jpg?1691776732)

![](https://cdn-learn.adafruit.com/assets/assets/000/123/434/medium800/hand_tools_ambient_schematic.jpg?1691776725)

# Ambient Sound Machine

## Install CircuitPython

[CircuitPython](https://github.com/adafruit/circuitpython) is a derivative of [MicroPython](https://micropython.org) designed to simplify experimentation and education on low-cost microcontrollers. It makes it easier than ever to get prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the **CIRCUITPY** drive to iterate.

## CircuitPython Quickstart

Follow this step-by-step to quickly get CircuitPython running on your board.

[Download the latest version of CircuitPython for this board via circuitpython.org](https://circuitpython.org/board/metro_m7_1011/)
 **Click the link above to download the latest CircuitPython UF2 file.**

Save it wherever is convenient for you.

![install_circuitpython_on_most_boards_CircuitPython_downloaded.jpg](https://cdn-learn.adafruit.com/assets/assets/000/102/129/medium640/install_circuitpython_on_most_boards_CircuitPython_downloaded.jpg?1620922559)

![](https://cdn-learn.adafruit.com/assets/assets/000/119/384/medium800/adafruit_products_resetWithNeo.jpg?1678478725)

Plug your board into your computer, using a known-good data-sync cable, directly, or via an adapter if needed.

Click the **reset** button once (highlighted in red above), and then click it again when you see the **RGB status LED(s)** (highlighted in green above) turn purple (approximately half a second later). Sometimes it helps to think of it as a "slow double-click" of the reset button.

If you do not see the LED turning purple, you will need to reinstall the UF2 bootloader. See the&nbsp; **Factory Reset** &nbsp;page in this guide for details.

On some very old versions of the UF2 bootloader, the status LED turns red instead of purple.

Once successful, you will see the **RGB status LED(s)** turn green (highlighted in green above), and a disk drive ending in " **...BOOT**" should appear on your host computer. If you see red, try another port, or if you're using an adapter or hub, try without the hub, or different adapter or hub.

If double-clicking doesn't work the first time, try again. Sometimes it can take a few tries to get the rhythm right!

A lot of people end up using charge-only USB cables and it is very frustrating! **Make sure you have a USB cable you know is good for data sync.**

You will see a new disk drive appear called **METROM7BOOT**.

&nbsp;

Drag the&nbsp; **adafruit\_circuitpython\_etc.uf2** &nbsp;file to **METROM7BOOT**.

![adafruit_products_metroboot.jpg](https://cdn-learn.adafruit.com/assets/assets/000/119/388/medium640/adafruit_products_metroboot.jpg?1678479294)

![adafruit_products_copyinguf2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/119/389/medium640/adafruit_products_copyinguf2.jpg?1678479527)

Copy or drag the UF2 file you downloaded to the **BOOT** drive.

The **BOOT** drive will disappear and a new disk drive called **CIRCUITPY** will appear.

That's it!

![install_circuitpython_on_most_boards_CIRCUITPY.jpg](https://cdn-learn.adafruit.com/assets/assets/000/102/130/medium640/install_circuitpython_on_most_boards_CIRCUITPY.jpg?1620923145)

# Ambient Sound Machine

## Code the Ambient Machine

## Text Editor

Adafruit recommends using the&nbsp; **Mu** &nbsp;editor for editing your CircuitPython code. You can get more info in&nbsp;[this guide](https://learn.adafruit.com/welcome-to-circuitpython/installing-mu-editor).

Alternatively, you can use any text editor that saves simple text files.

## Download the Project Bundle

Your project will use a specific set of CircuitPython libraries, and the&nbsp; **code.py** &nbsp;file. To get everything you need, click on the&nbsp; **Download Project Bundle** &nbsp;link below, and uncompress the .zip file.

Connect your computer to the M7 board via a known good USB power+data cable. A new flash drive should show up as **CIRCUITPY**.

Drag the contents of the uncompressed bundle directory onto your board's&nbsp; **CIRCUITPY** &nbsp;drive, replacing any existing files or directories with the same names, and adding any new ones that are necessary.

![directory](https://adafruit.github.io/Adafruit_Learning_System_Guides/Ambient_Machine.png )

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Ambient_Machine/code.py

## How It Works

The code has two key functions:

- Play ten wav file audio samples and use the audio mixer to mute/unmute them and adjust their volume levels.
- Watch for the toggle switches to be flipped in order to adjust the audio mixer levels.

### Import Libraries

First, you'll import libraries:

- `os`: Operating system functions for file and directory operations
- `gc`: garbage collection module for managing memory
- `board`: Provide pin mappings for the board
- `busio`: Handle communication on I2C bus
- `audiocore`, `audiobusio`: handle audio playback
- `audiomixer`: for mixing audio channels
- `digitalio`: handle digital GPIO pins
- `adafruit_debouncer`: handle switch debouncing/switch events
- `adafruit_mcp230xx.mcp23017`: interact with the MCP23017 GPIO expander

```auto
import os
import gc
import board
import busio
import audiocore
import audiobusio
import audiomixer
from digitalio import Pull
from adafruit_debouncer import Debouncer
from adafruit_mcp230xx.mcp23017 import MCP23017
```

### GPIO and I2C Setup

Next, you'll set up the I2C object and two instances of the MCP23017 GPIO expanders. You'll set up the two lists of pins used per board.&nbsp;&nbsp;

```auto
i2c = busio.I2C(board.SCL, board.SDA)
mcp_a = MCP23017(i2c, address=0x20)  # default address
mcp_b = MCP23017(i2c, address=0x21)  # MCP23017 w/ address 0 jumper set

switches = []  # set up all the switch pins on two MCP23017 boards as debouncer switches
for p in (8,9,10,11,12,4,3,2,1,0):
    pin = mcp_a.get_pin(p)
    pin.switch_to_input(pull=Pull.UP)
    switches.append(Debouncer(pin))
for p in (8,9,10,11,12,4,3,2,1,0):
    pin = mcp_b.get_pin(p)
    pin.switch_to_input(pull=Pull.UP)
    switches.append(Debouncer(pin))
```

### Audio File Handling

Here you'll create a list of wav files by getting a filtered list of files from on-board flash in the `/samples` directory. These are filtered to remove any possible operating system hidden `.` dot files and to only include files ending in `.wav`

The `wav_files[]` list is then re-sorted alphabetically.

```auto
wav_files = []

for filename in os.listdir('/samples/'):  # on board flash
    if filename.lower().endswith('.wav') and not filename.startswith('.'):
        wav_files.append("/samples/"+filename)
        print(filename)

wav_files.sort()  # put in alphabetical/numerical order
```

### I2S Audio Playback Setup

The D9, D10, and D12 pins on the Metro M7 are assigned to `lck_pin`, `bck_pin`, and `dat_pin`, respectively, for the I2S digital audio amplifier board.

```auto
lck_pin, bck_pin, dat_pin = board.D9, board.D10, board.D12

audio = audiobusio.I2SOut(bit_clock=bck_pin, word_select=lck_pin, data=dat_pin)
```

### Audio Mixer

You'll create an instance of `audiomixer.Mixer` with the correct number of voices (10), sample rate, channel count, bits per sample, and buffer size of 2048.

Then, all ten samples are started playing and looping, with their mixer levels initially set to 0 so no sound will play until you toggle sample switches.

Two volume constants are created to set the mixer levels low and high when the volume toggles are flipped, per sample.

```auto
mixer = audiomixer.Mixer(voice_count=len(wav_files), sample_rate=22050, channel_count=1,
                         bits_per_sample=16, samples_signed=True, buffer_size=2048)
audio.play(mixer)

for i in range(10):  # start playing all wavs on loop w levels down
    wave = audiocore.WaveFile(wav_files[i], bytearray(1024))
    mixer.voice[i].play(wave, loop=True)
    mixer.voice[i].level = 0.0

LOW_VOL = 0.2
HIGH_VOL = 0.5
```

### Main Loop

In the main loop, the switches are checked for events. If a switch is flipped the code checks to see which row it is in.&nbsp;

The first row plays samples 0-4. The second row sets the volume low or high for the sample switch directly above it. The third row plays samples 5-9, and the fourth row sets the volume of the samples above them.

```auto
while True:
    for i in range(len(switches)):
        switches[i].update()
        switch_row = i // 5
        if switch_row == 0:  # first row plays five samples
            if switches[i].fell:
                if switches[i+5].value is False:  # check vol switch (pull-down, so 'False' is 'on')
                    mixer.voice[i].level = HIGH_VOL  # if up
                else:
                    mixer.voice[i].level = LOW_VOL  # if down
            if switches[i].rose:
                mixer.voice[i].level = 0.0

        if switch_row == 1:  # second row adjusts volume of first row
            if switches[i].fell:
                if switches[i-5].value is False: # raise volume if it is on
                    mixer.voice[i-5].level = HIGH_VOL
            if switches[i].rose:
                if switches[i-5].value is False:  # lower volume if it is on
                    mixer.voice[i-5].level = LOW_VOL

        if switch_row == 2:  # third row plays five different samples
            if switches[i].fell:
                if switches[i+5].value is False:
                    mixer.voice[i-5].level = HIGH_VOL
                else:
                    mixer.voice[i-5].level = LOW_VOL
            if switches[i].rose:
                mixer.voice[i-5].level = 0.0

        if switch_row == 3:  # fourth row adjust volumes of third row
            if switches[i].fell:
                if switches[i-5].value is False:
                    mixer.voice[i-10].level = HIGH_VOL
            if switches[i].rose:
                if switches[i-5].value is False:
                    mixer.voice[i-10].level = LOW_VOL
```

# Ambient Sound Machine

## Fabrication and Assembly

## Switch Holes

The bottom of the medium sized drawer will become the front panel of the Ambient Sound Machine.

Use the drilling template linked below to print out a guide for drilling the switches. Then, use a center punch and a 6mm drill bit (15/64" if using Imperial) to create all 20 holes for the toggle switches.

If you have access to a laser cutter this can be a very quick way to create the holes, as shown here.

![hand_tools_ambient-3927.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/454/medium640/hand_tools_ambient-3927.jpg?1691962210)

![hand_tools_ambient-3979.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/455/medium640/hand_tools_ambient-3979.jpg?1691962519)

![hand_tools_ambient-3980.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/456/medium640/hand_tools_ambient-3980.jpg?1691962528)

[ambient_box_v1.svg](https://cdn-learn.adafruit.com/assets/assets/000/123/579/original/ambient_box_v1.svg?1692247717)
Info: 

![](https://cdn-learn.adafruit.com/assets/assets/000/123/537/medium800/hand_tools_ambient-4187.jpg?1692221667)

## Switch Ground

You can use the medium box as a jig for the switches while soldering the center position tabs to a common ground line.

Just put the switches into the panel backwards (from the outside-in), then use short lengths of black wire to solder the center lugs.

You can do a couple of rows at a time, then flip them and screw them in from the inside. This keeps things a bit more manageable than trying to do all 20 at once.

![hand_tools_ambient-4107.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/457/medium640/hand_tools_ambient-4107.jpg?1691962573)

![hand_tools_ambient-4108.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/458/medium640/hand_tools_ambient-4108.jpg?1691962986)

## Switch Pins

You'll use the arcade quick connect cables to connect the GPIO expanders to the switches.&nbsp;

Clip the JST connector off and then strip and solder the wires as shown.

Then, plug the spade connector of each wire into its associated switch lower lug as shown.

Then, add the second two sets of switches with their common grounds soldered.

Do this for the first ten switches using the first expander board.

![hand_tools_ambient-4111.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/459/medium640/hand_tools_ambient-4111.jpg?1691963239)

![hand_tools_ambient-4163.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/460/medium640/hand_tools_ambient-4163.jpg?1691963252)

## Second Set

In order to use both expander boards on the I2C bus, you'll give the second one a unique address. Heat a blob of solder across the pads for the **Addr +1&nbsp;** jumper as shown.

Then, solder the wires and connect the lower lugs as before.

![hand_tools_ambient-4165.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/461/medium640/hand_tools_ambient-4165.jpg?1691963309)

![hand_tools_ambient-4293.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/462/medium640/hand_tools_ambient-4293.jpg?1691963479)

## Grid Layout

Use M2.5 nylon screws and standoffs to fasten the boards to the mounting grid.

This is a suggested layout you can use, as well as a photo with the wiring connected as per the circuit diagram.

You can use zip ties to neaten the wiring before assembling into the case.

![hand_tools_swirlyLayout.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/499/medium640/hand_tools_swirlyLayout.jpg?1692216418)

![hand_tools_ambient-4287.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/500/medium640/hand_tools_ambient-4287.jpg?1692216524)

![hand_tools_ambient-4289.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/501/medium640/hand_tools_ambient-4289.jpg?1692216619)

![hand_tools_ambient-4291.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/502/medium640/hand_tools_ambient-4291.jpg?1692216674)

## Speaker Enclosure

Drill or laser cut holes into the back of the small MOPPE drawer to act as a speaker grill and mounting surface for the speaker. You can use the .svg file provided below to get the hole spacing correct for the speaker's four mounting points.

You'll also use a Forstner bit or hole saw to make a hole for the panel-mount USB-C connector.

Push the USB-C panel connector into the hole from the outside and screw the retaining nut in from the inside.

![hand_tools_ambient-3981.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/503/medium640/hand_tools_ambient-3981.jpg?1692216760)

![hand_tools_ambient-3984.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/504/medium640/hand_tools_ambient-3984.jpg?1692216850)

![hand_tools_ambient-4178.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/521/medium640/hand_tools_ambient-4178.jpg?1692218179)

![hand_tools_ambient-4179.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/522/medium640/hand_tools_ambient-4179.jpg?1692218191)

![hand_tools_ambient-4180.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/523/medium640/hand_tools_ambient-4180.jpg?1692218198)

![hand_tools_ambient-4181.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/524/medium640/hand_tools_ambient-4181.jpg?1692218218)

Connect the inside of the USB-C panel mount to the USB-C of the Metro M7 via a suitable USB cable.

![](https://cdn-learn.adafruit.com/assets/assets/000/123/525/medium800/hand_tools_ambient-4182.jpg?1692218234)

![](https://cdn-learn.adafruit.com/assets/assets/000/123/520/medium800/hand_tools_speaker.jpg?1692218142)

## Optional Switch Locks

Rather than drill/cut 20 tiny holes to register the anti-twist tab of the switches, I decided to cut small plywood switch body locks, as shown here. They are glued in place to the inside of the front panel.

![hand_tools_ambient-4199.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/527/medium640/hand_tools_ambient-4199.jpg?1692221216)

## Feet

Cut four feet from 1/2" x 1-1/2" poplar or similar hardwood.

Glue and clamp them to the larger MOPPE drawer/front enclosure as shown.

![hand_tools_ambient-4137.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/534/medium640/hand_tools_ambient-4137.jpg?1692221499)

![hand_tools_ambient-4200.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/535/medium640/hand_tools_ambient-4200.jpg?1692221616)

![hand_tools_ambient-4185.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/536/medium640/hand_tools_ambient-4185.jpg?1692221625)

![](https://cdn-learn.adafruit.com/assets/assets/000/123/529/medium800/hand_tools_ambient-4293.jpg?1692221240)

Warning: 

## USB Cable

Assemble the DIY USB-C cable for the inside of the box by pulling the gray retention clip out a tiny amount, then inserting the ribbon cable end with the metal conductors visible from the top side of the board as shown. When fully inserted, press the retaining clip back in to secure the cable.

Repeat for both ends.

![hand_tools_cable3294.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/582/medium640/hand_tools_cable3294.jpg?1692283902)

![hand_tools_cable3295.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/584/medium640/hand_tools_cable3295.jpg?1692284126)

## Close it Up

Place the grid/circuit into the enclosure as shown. The back enclosure will hold it in place.

Plug in the USB cable to connect the Metro M7 to the USB panel mount.

Then, place the back on. It will fit snugly over the switch lockers.

Fill the gaps above and below the small drawer with additional strips of hardwood.

![hand_tools_ambient-4294.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/530/medium640/hand_tools_ambient-4294.jpg?1692221283)

![hand_tools_ambient-4295.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/531/medium640/hand_tools_ambient-4295.jpg?1692221422)

![hand_tools_ambient-4297.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/532/medium640/hand_tools_ambient-4297.jpg?1692221437)

![hand_tools_ambient-4298.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/533/medium640/hand_tools_ambient-4298.jpg?1692221447)

![hand_tools_ambient-4299.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/538/medium640/hand_tools_ambient-4299.jpg?1692221749)

![](https://cdn-learn.adafruit.com/assets/assets/000/123/542/medium800/hand_tools_ambient-4301.jpg?1692221770)

![](https://cdn-learn.adafruit.com/assets/assets/000/123/549/medium800/hand_tools_ambient-4310.jpg?1692230996)

## Fill the Room With Sound

You can now plug the USB plug into power, and start flipping switches to enjoy lovely ambient sound!

![](https://cdn-learn.adafruit.com/assets/assets/000/123/568/medium800/hand_tools_ambient-4315.jpg?1692231087)

![](https://cdn-learn.adafruit.com/assets/assets/000/123/574/medium800/hand_tools_ambient-4312.jpg?1692231127)


## Guide Products

### Adafruit Metro M7 with AirLift - Featuring NXP iMX RT1011

[Adafruit Metro M7 with AirLift - Featuring NXP iMX RT1011](https://www.adafruit.com/product/4950)
Get ready for our fastest Metro ever - the NXP iMX RT1011 microcontroller powers this board with a 500 MHz ARM Cortex M7 processor. There's 8 MB of execute-in-place QSPI for firmware + disk storage and 128KB of SRAM in-chip, plus a WiFi co-processor using an on-board&nbsp;ESP32...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4950)
[Related Guides to the Product](https://learn.adafruit.com/products/4950/guides)
### Adafruit MCP23017 I2C GPIO Expander Breakout

[Adafruit MCP23017 I2C GPIO Expander Breakout](https://www.adafruit.com/product/5346)
We’ve gotten a lot of requests for a MCP23017 breakout and we’ve always sorta been like “[ehh why not just use the DIP chip?](https://www.adafruit.com/product/732)” but with STEMMA QT we could see the use case for a plug and play version that comes with all...

In Stock
[Buy Now](https://www.adafruit.com/product/5346)
[Related Guides to the Product](https://learn.adafruit.com/products/5346/guides)
### Mini Panel Mount SPDT Toggle Switch

[Mini Panel Mount SPDT Toggle Switch](https://www.adafruit.com/product/3221)
This or that, one or the other, perhaps or perhaps not! So hard to make decisions these days without feeling like you're just going back and forth constantly. Deciding whether or not to use this mini toggle switch? That's the easiest decision you'll make all day!

This...

In Stock
[Buy Now](https://www.adafruit.com/product/3221)
[Related Guides to the Product](https://learn.adafruit.com/products/3221/guides)
### Adafruit Swirly Aluminum Mounting Grid for 0.1" Spaced PCBs

[Adafruit Swirly Aluminum Mounting Grid for 0.1" Spaced PCBs](https://www.adafruit.com/product/5774)
With most of our dev boards, sensors and feathers now sporting [plug-and-play stemma QT ports](https://learn.adafruit.com/search?q=stemma%2520qt)&nbsp;it can be very fast to put together projects with half a dozen boards snapped together. But that ease of use has one...

In Stock
[Buy Now](https://www.adafruit.com/product/5774)
[Related Guides to the Product](https://learn.adafruit.com/products/5774/guides)
### Adafruit I2S 3W Class D Amplifier Breakout - MAX98357A

[Adafruit I2S 3W Class D Amplifier Breakout - MAX98357A](https://www.adafruit.com/product/3006)
Listen to this good news - we now have an all in one digital audio amp breakout board that works incredibly well with the&nbsp;[Raspberry Pi](https://www.adafruit.com/category/105)! If you're looking for an easy and low cost way to get your digital sound files...

In Stock
[Buy Now](https://www.adafruit.com/product/3006)
[Related Guides to the Product](https://learn.adafruit.com/products/3006/guides)
### STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long

[STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long](https://www.adafruit.com/product/4210)
This 4-wire cable is a little over 100mm / 4" long and fitted with JST-SH female 4-pin connectors on both ends. Compared with the chunkier JST-PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert and remove.

<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/4210)
[Related Guides to the Product](https://learn.adafruit.com/products/4210/guides)
### Speaker - 3" Diameter - 4 Ohm 3 Watt

[Speaker - 3" Diameter - 4 Ohm 3 Watt](https://www.adafruit.com/product/1314)
Listen up! This 3" diameter speaker cone is the perfect addition to any audio project where you need an 4 ohm impedance and 3W or less of power. We particularly like this cone as it has 4 handy mounting tabs 60mm apart.  
  
Works great with our <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/1314)
[Related Guides to the Product](https://learn.adafruit.com/products/1314/guides)
### Arcade Button Quick-Connect Wire Pairs - 0.11" (10 pack)

[Arcade Button Quick-Connect Wire Pairs - 0.11" (10 pack)](https://www.adafruit.com/product/1152)
Quick connector wire sets will make wiring up our arcade-style or metal buttons quicky-quick. Each wire comes as a 'pair' with two 0.11" quick-connects pre-crimped onto 20cm long wires. The wires are then terminated together in a JST 2.5mm/0.1" spaced 2-pin connector (we...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1152)
[Related Guides to the Product](https://learn.adafruit.com/products/1152/guides)

## Related Guides

- [Adafruit MAX98357 I2S Class-D Mono Amp](https://learn.adafruit.com/adafruit-max98357-i2s-class-d-mono-amp.md)
- [Adafruit MCP23017 I2C GPIO Expander](https://learn.adafruit.com/adafruit-mcp23017-i2c-gpio-expander.md)
- [Adafruit Metro M7 1011 with AirLift](https://learn.adafruit.com/adafruit-metro-m7-with-airlift.md)
- [Adafruit Swirly Aluminum Mounting Grid for 0.1" Spaced PCBs](https://learn.adafruit.com/swirly-grid.md)
- [Feather RP2350 Audio Reactive Video Synth](https://learn.adafruit.com/feather-rp2350-audio-reactive-video-synth.md)
- [Feather Scorpio Snap Fit Case](https://learn.adafruit.com/feather-scorpio-snap-fit-case.md)
- [Numpad 4000 Mechanical Keyswitch Data Entry Device](https://learn.adafruit.com/numpad-4000-mechanical-keyswitch-data-entry-device.md)
- [Clockwork Goggles](https://learn.adafruit.com/gemma-m0-clockwork-goggles.md)
- [Arcade Bonnet Controller](https://learn.adafruit.com/arcade-bonnet-controller.md)
- [Big Key Switches Macro Pad](https://learn.adafruit.com/big-key-switch.md)
- [CircuitPython Libraries on any Computer with FT232H](https://learn.adafruit.com/circuitpython-on-any-computer-with-ft232h.md)
- [Temperature and Humidity Sensing in Home Assistant with CircuitPython](https://learn.adafruit.com/temperature-and-humidity-sensing-in-home-assistant-with-circuitpython.md)
- [Adabot Toy Robot Friend](https://learn.adafruit.com/adabot-rp2040.md)
- [Forecast the Weather at Home with a No-Code Barometer ](https://learn.adafruit.com/dps310-analog-barometer.md)
- [reef-pi Guide 2: Power Controller](https://learn.adafruit.com/reef-pi-power-controller.md)
- [Wonder Woman Cosplay Bracers](https://learn.adafruit.com/wonder-woman-cosplay-bracers.md)
- [PyPortal Roku Remote](https://learn.adafruit.com/pyportal-roku-remote.md)
- [Introducing Feather RP2040 SCORPIO](https://learn.adafruit.com/introducing-feather-rp2040-scorpio.md)
- [Adafruit Metro RP2040](https://learn.adafruit.com/adafruit-metro-rp2040.md)
