Introduction: Wearable Tech: Air Drums
Our goal for this project was to make a wearable drum kit out of some accelerometers and piezo discs. The idea was that given a hit of a hand, a snare noise would play; or, given a press of a foot, a hi-hat or bass drum sound would play. To control the kit, we used a Hexwear micro-controller, Arduino coding software, and Cycling '74 MAX for sound output and selection. This project was part of a larger partnership between Pomona College and the Fremont Academy of Engineering.
Step 1: Parts and Tools
Below is a list of the parts our project consists of and a list of all the materials used.
- Flannel Shirt (x1)
- Fuzzy Socks (x2)
- Piezo Discs (x2) (https://www.sparkfun.com/products/10293)
- Accelerometers MMA8451 (x2) (https://www.adafruit.com/product/2019)
- ATmega32U4 Microcontroller HexWear (x1) (http://hexwear.com)
- RN42 Microchip Bluetooth (x1) (https://www.sparkfun.com/products/12576)
- 18 Gauge Wire
- #2 Screws (x14)
- #2 Washers (x14)
- Crimp Connectors; 22-16 Gauge (x14) (http://www.elecdirect.com/crimp-wire-terminals/ring-crimp-terminals/pvc-ring-terminals/ring-terminal-pvc-red-22-18-6-100pk)
- Self-Adhesive Pin (x1)
Vinyl-Insulated Butted Seam Butt Connectors(x15) (https://www.delcity.net/catalogdetails?item=421005)
- Soldering Kit
- Wire Strippers
- Wire Cutters
- Electrical Tape
- Crimping Tool
- Screw Driver
- Hot-glue Gun
- 3D Printer (optional)
- Hot Air Gun
- Max Cycling '74 (https://cycling74.com)
- Arduino coding software (https://www.arduino.cc/en/Main/Software)
Downloading the Drivers:
1) (Windows only, Mac users can skip this step) Install the driver by visiting https://www.redgerbera.com/pages/hexwear-driver-i... Download and install the driver (the .exe file listed on Step 2 at the top of the linked RedGerbera page).
2) Install required library for Hexware. Open the Arduino IDE. Under “File” select “Preferences.” In the space provided for Additional Boards Manager URLs, paste https://github.com/RedGerbera/Gerbera-Boards/raw/... Then click “OK.” Go to Tools -> Board: -> Board Manager. From the upper lefthand corner menu, select “Contributed.” Search for, and then click on Gerbera Boards and click Install. Quit and reopen Arduino IDE. To ensure that the library is installed properly, go to Tools -> Board, and scroll to the bottom of the menu. You should see a section entitled “Gerbera Boards,” under which there should at least appear HexWear (if not more boards like mini-HexWear).
3) To download the accelerometer library use the following link: https://learn.adafruit.com/adafruit-mma8451-accelerometer-breakout/wiring-and-test. Then click, "Download the MMA8451 library"
Step 2: Prepare the Wires
Cut 9 pieces of wire long enough to span your arm (about 1m). These pieces will connect to the two accelerometers. Cut 4 longer pieces, long enough to reach your feet from the flannel shirt pocket (about 2m). These will connect to the piezos. Cut another 3 shorter pieces (about 15cm) for the bluetooth microchip. Strip both ends of all the wire pieces, leaving 2cm of bare wire.
Step 3: Connect the Wires to the Sensors
Use a soldering iron to solder 4 of the 1m wires to one of the accelerometer and 5 of the 1m wires to the other accelerometer. The accelerometers have labelled pins and we have provided a circuit diagram to illustrate where each wire should go. Along with the circuit diagram, we have attached markups up the accelerometers' layouts: attach the wires to the pins circled in black.
Each piezo sensor has two wires. Strip the ends of the piezo wires and solder them to the 2m wires. Use the vinyl insulated connectors and the hot air gun to secure the connections.
Finally, solder the 3 15cm wires to the Bluetooth microchip (refer to the circuit diagram and the markup for the specific pins).
Note: The Bluetooth microchip and the accelerometers have very narrow pins. We chose 18 Gauge wire for robustness and because it matches the crimp connectors that we were using, but if need be, you can solder thinner wires to the sensors, then solder the 18 gauge wires to the thin ones.
You should now have one end of all the wires connected! The other ends connect to the Hex.
** Markups for the accelerometers, bluetooth, and piezo are courtesy of sparkfun (https://www.sparkfun.com) and adafruit (https://www.adafruit.com)
Step 4: Connecting to the Hex and Circuit Diagram
Above is a diagram detailing the assembly. To connect the wires to the Hexware we used nuts, screws, and crimp connectors (pictured above as the red connections). Once the wire has been attached to the crimp connector, it can be connected to the hex using a washer and a screw as pictured above. For a diagram of the hex ware, see the pin markup above.
Following the diagram, specifically the black lines, connect the ground of both the piezos to a ground pin on the hex. Next, for the two accelerometers, attach both of their grounds to a ground pin on the hex. Since there are only a few ground pins, we'd recommend soldering together all the wires that are going to ground from the accelerometer, or all the wires going to ground from the piezos; though, be careful to keep track of everything! The pin labeled A (or Address) on of the accelerometers should also attach to ground. This is to differentiate the two accelerometers from each other, giving one of them another identification. Finally, attach the ground of the bluetooth to ground on the hex.
Finishing connecting the ground, then begin the connections to the VCC, outlined in red above. Vin from both the accelerometers should connected to VCC on the hex, same with the VCC pin on the bluetooth. Again, because of lack of pins, we'd recommend soldering wires before the final connection to the hex.
On both the accelerometers there are pins labeled SCL and SDL. Connect these to the same pins on the hexwear (SCL is cerulean and SDA is magenta in the diagram above). Next, on the bluetooth module, connect the RX-1 to RX on the hex (navy above), and TX-1 to TX on the hex (light green above). This enables bluetooth connections. Finally, connect the second leg of one of the piezos to pin D12 (dark green) and the second leg of the second piezo to D9 (purple above). This is in order to take an analog output from the piezo sensors to the hexwear.
** the hexwear pin markup is courtesy of Red Gerbera (https://www.redgerbera.com), accelerometer images courtesy of adafruit, and piezo/bluetooth mate courtesy of sparkfun
Step 5: Uploading the Code
To begin to use the drums, first open up MAX code (called Max_Drum.maxpat). To be able to edit the code or save it you'll need to have an account with Cycling '74, but everything works without an account. You want to attach the hex bluetooth module to your own computer. To do this, plug the hex into power. Once the hexwear is plugged in, a red light should turn on on the bluetooth module. Next open up bluetooth preferences. on your computer. A name along the lines of 9CBO should pop up. When prompted for a passcode, type 1234. Your bluetooth should then be connected to the computer.
Next, upload the Arduino code to the hex (called final_electronics.ino). Now all that's left to do is connect the bluetooth to the MAX. In the max code, you should see something called 'print.' If you click this and open the serial monitor, you should see all the available ports, and the available bluetooth ports. In the box called serial o 9600. Here, serial means the serial monitor, o is the port, and 9600 is the connection bandwidth. To connect the bluetooth, replace the o with the names of other bluetooth ports. You often have to try all of them, but the bluetooth module will turn to green once it's connected to the right port via MAX.
Once the code is uploaded, make sure to give the right path to the audio files in MAX. The best way to do this is by dragging the sound files into MAX.
Participated in the
Arduino Contest 2019