Introduction: Arudino Harpsi-Gourd
Build your own Harpsi-Gourd to play just like Lurch of the Addams Family, trading the over-rated touch sensitive banana for the season appropriate Pumpkins, that generate musical notes.
This Harpsi-Gourd was built to be exhibited at our local "How-to Halloween" expo. The size of the actual panel was designed to fit onto a piano's keyboard with the lid closed. The Music Shield used has a built in audio amplifier which eliminates the need for external amplifier.
The provided Arduino sketch plays assigned MIDI notes for each Pumpkin. When left idle for greater than 60 seconds the sketch will begin to pluck off random notes at random intervals. When the keyboard is left idle for only 5 seconds the MIDI processor is changed between the 127 different instruments. This allows a Maestro to play continuously on the same instrument, uninterrupted. but still allows for the diversity of the music shield to be experienced. Additionally, if a key is continuously depressed it will randomly change the color of that LED.
While only 15 keys are physically implemented 24 keys are logically implemented, allowing the immediate use of additional keys. The same design and code can accommodate a total of 48 keys if desired. Almost a whole piano. Which would be a lot of pumpkins.
The project has a modest difficulty level as it was created with readily purchased components that require only a little soldering and crafting. (shout out to Hot Glue). I personally would rate it 2.5 out of 5 as it does have some soldering.
Step 1: Materials and Tools
- 1 pc Arduino Uno R3 (Atmega328 - assembled)
- 1 pc "Music Maker" MP3 Shield for Arduino w/3W Stereo Amp
- 2 pc 12 x Capacitive Touch Shield for Arduino - MPR121
- 3 pc Shield stacking headers for Arduino (R3 Compatible)
Lights and Sound Parts:
- 2 pc Speaker - 3" Diameter - 4 Ohm 3 Watt
- 1 pc NeoPixel Digital RGB LED Strip - 30 LED
- 1 pc Extra-long break-away 0.1" 16-pin strip male header (5 pieces)
- 1 pc Heat Shrink Pack
3/32" Heat Shrink (color of your choice)
3/16" Heat Shrink (color of your choice)
- 1 pc 30 ohm headphones (optional)
Wooden Panel to Hold everything and connect to the Pumpkins:
- 1 pc 50" of left over Ribbon Cable 25 conductor 0.1" spacing( or what every you have on hand)
- 1 pc 53" x 9" 1/2" plywood (or equivalent)
- 1 pc 1-1/4" diameter by 20" long wooden dowel (or equivalent)
- 8 pc Rubber feet (or equivalent)
Don't Forget the Power Supply :
- 1pc 5V 2A Switching Power Supply w/ USB-A Connector
- 1pc USB Cable - Standard A-B - 3 ft/1m (or longer if you so desire)
And the Pumpkins:
- 15 pc 4" small pumpkins. Assorted colors is better.
- 1 pc Piano (just for looks - optional)
- Soldering Iron
- Wire Cutters
- Wire Strippers
- Hot Glue Gun (with enough Hot Glue pellets)
- Wood Saw (power is your option)
- Wood Router with 1/4" Round Over Bit (optional)
- Hot Air Gun or Small Lighter.
- small Philips screwdriver
- Electric Hand Drill motor
- 2 inch circle Saw drill bit
- 1/2 inch drill bit
- 1/4 inch drill bit or dremel
Step 2: Soldering the Arduino Shields, Assiging IRQ, I2C Address and Amps Gain
The first thing to do to each shield is to solder in the stacking headers. It is worth noting at this point that the Touch Shield uses the extended R3 pin out for I2C, just above D13. And does not use the A4 and A5 connections to the I2C. What does that mean? It means you need to use an UNO R3, otherwise you will need to jump A4 to SCL and A5 to SDA on the Touch Shields.
Touch Shield Interrupts
Each Touch Shield requires the Interrupt Request signal. This is shown in the pictures with the very thin Red wire soldered between the D2 pad and the pad labeled IRQ.
FYI - I use red magnet wire for jumps. While it is very easy to use it is very hard to photograph. So I have added yellow graphics indicating the connections.
Touch Shield Addressing
As the Touch Shields' MPR121 both use the same I2C bus they individually need to be jumper selected to change the addresses to unique values. This can be easily done to each Touch Shield as there is a jumper pad labeld ADDR that can be wire jumped to:
- GND for ADDR = 0x5A
- VCC for ADDR = 0x5B
The data schematic for the Touch Shield indicates that the ADDR pin has a pull-down to GND, eliminating the need for a wire jumper. However, I found that it was still needed to work. So on one Touch Shield the ADDR was wire jumper-ed to the closest spare GND pad.
Similarly the other Touch Shield the ADDR pad was wired jumped to the closest 5V pad. I found a SMT pad of a near by resistor was 5V, rather than pulling the wire jump all the way to the spare pad on the other side of the board. Either way equally works.
Music Shield Audio Amplifier
The Audio Amplifier's Gain is set by solder jumpers. The default has comfortable volume for quiet areas, however you will likely want maximum power (all 3 Watts). That is achieved by bridging both SJ1 (+6dB) and JS12 (+12dB) solder jumps.
While it is rated only for 3 watts, I found a significant and adequately loud experience using larger 20 and/or 50 watt speakers versus little 3 watt rated speakers.
Step 3: Solder the Ribbon Cable to Each of the MPR121
Each of the pumpkins needs to have wire that connects it to a corresponding MPR121 electrode. I chose to use a left-over 25 pin Ribbon cable that was sufficiently long enough to run the whole length of the keyboard. 53 inches in this case plus some extra. This has the added benefit of holding all the wires together, evenly spaced. It is desirable to not have all the wires floating around and free to move, as this will alter the touch sensitivity.
As each of the shields conveniently stack, I have separated every 3 conductors, feathering them off and soldering 3 to the top MPR121 shield and the next 3 to the next MPR121 shield. The picture should help this make sense. This keeps the cabling rather clean.
The firmware has a file named "harpsi-gourd.h" that can be customized to your builds keyboard and NeoPixel ordering.
Step 4: Make Addressable RGB LED Strand
The WS2812 strips are easy to implement and have the nice feature of being able to be separated. If you would like to learn more about Neopixel's visit Introduction to Neopixels.
For our simple purposes we just need to do the following two task.
- Connect the NeoPixels to the Arduino
- Extend the distance between NeoPixel
both steps are simply done with minor soldering.
- Solder a sufficient length of 3 conductor ribbon cable from the GND, Digital 5 (Output aka D5) and 5V of the Arduino cto the corresponding GND, DI(aka Din) and 5V of the first NeoPixel.
- Note that I chose to make these connection to the MP3 shield. But they could connected to either of the MPR121 shields or the UNO.
If you have not played with NeoPixels previously I recommend connecting the initial unaltered string of NeoPixels the Arduino and loading the example "strandtest.ino" test from Adafruit_NeoPixel library. Remember to set the NUMPIXELS to 15 or the length you want to test.
- After validating that if it works, separate 15 NeoPixels by cutting down the center of each set of pads between each pixel.
- Then restore each connection by soldering a sufficient length of 3 conductor ribbon cable between them. I recommend approximately 8 inches. Ensure that GND, DO, 5V correspondingly connects to GND, DI, 5V.
- Then validate that the lengthened strip of NeoPixels still work.
Step 5: Make Base Platform
With the two ribbon cables now created the next step is to create the platform that everything will be attached to.
For my exhibit the goal was to fit on the keyboard of an existing piano. Your project may differ. A scrap piece of 1/2 plywood was cut to 53 Inches by 9 inches. This fit perfectly with only a 1/4 Inch gap.
Before continuing, this is a good opportunity to round over all the edges. As the fresh cut edges of plywood can be sharp and/or full of splinters. This can be easily done using a file, sanding paper or, my preference, a small wood router with a 1/4" round over bit.
To finish the wood-working make 15 pedestals for each NeoPixel to stand on. Raising the elevation about a 1/2 inch up into the small Pumpkin helps clear its light from being buried below the wall of the pumpkin. Additionally these pedestals hold the pumpkins in place and falling of the keyboard. The pedestals can be made by chopping 1 inch dowel rod into pieces.
Then decide the layout of your Pumpkin Keyboard and Arduino Stack. I choose to use the typical layout of the Piano and the Arduino to one side. Then hot glue the UNO and each pedestal to the 1/2 in panel. Provide enough space between each pedestals so that no two pumpkins can touch each other, as this will confuse the MPR121 touch chips.
Attach the lengthened strand of NeoPixel to the panel. I choose a zig-zag pattern to reduce cable length. Note that most Strands of NeoPixels have a layer of stick tape on the bottom that just needs its protection peeled off. This will provide an initial adhesion for each pixel to each pedestal. Reinforce this by applying a small amount of Hot Glue to the ribbon cable on each side of the NeoPixel.
This is always a good point to redo the "strandtest.ino"
Step 6: Make the Capacitive Touch Probes
With the pedestals attached flip the panel over and then hot glue the 25 pin ribbon in place along the bottom. Then wrapping the 25 conductor ribbon cable over the back, providing enough slack for service, tack it down with small amount of hot-glue. Fold it over to make a nice flat right (or left turn) and then tack it down along the long edge.
Now is a good time to apply rubber feet. This serves several purposes. First, to raise the panel up off the ribbon cable. Second, to lift the panel above the hosting piano's keyboard hinge. and last, to provide a nice mounting surface to the table.
With the ribbon cable running under the panel along the long edge each wire can be peeled back to each pedestals position and then wrapped back over to the top. Then fix the location of wire near the corresponding pedestal and cut the unneeded portion of each conductor, leaving approximately 3 to 4 inches.
To create a durable method of connecting the individual Ribbon Cables conductors to each of the pumpkins, the wires are soldered to a in individual piece of the Extra-long break-away 0.1" header. This beats trying to stab each pumpkin with a flimsy ribbon cable.
After the first use it became apparent that strain relief was needed as the pumpkins moved around a bit and eventually the thin ribbon cables conductor failed. Using a two layers of Heat Shrink, a thinner inner layer and a slightly thicker outer layer that wraps around the plastic piece of the header provides significant strain and flex relief that will withstand reasonable movements.
If you don't have a hot are gun, a hair dryer will work. Also using the tip of a soldering iron or briefly waving the flame of a lighter over the heat shrink will work.
Step 7: Stack It and Power It
With all the fixed wires soldered in place, the Arduino shields can be assembled by stacking them. This leaves the Audio and Power Connections to be made.
The Music Shield's built in Amplifier provides a convenient connection using small philips screws on the two block connections. Note that the sketch provided is mono so there is no real need to keep track of left or right. Both speakers must be used to to get maximum output power.
With the all the NeoPixels lit and the Music Shield's Amplifier in use, the Arduino UNO's onboard 12V(raw) to 5V linear regulator is under powered as it is only specified for a 120 mA. A convenient solution is to use a modestly ample USB 5V supply, commonly found to charge any cell phone. This will directly feed the 5V, by-passing the linear regulator.
Step 8: Carving the Pumpkins
To create 15 little pumpkins. I used power tools to speed up the process.
First, I used a 2 inch hole saw drill bit to open the bottom of each pumpkin and then remove the "innards/guts". After cleaning out each Pumpkin a 1/2 inch drill was used to drill out a pair of eyes on each pumpkin. Then using a 1/4 inch drill a nose was drilled into each. Finishing up each face the 1/4" drill was used to drill a series of holes that resembled a grin and then the drill motor was forced sideways to connect the holes, finishing the grin. A spiral bit typically found on a Dremel would have be easier to use, but this method was quick and only took about 2 minutes per pumpkin.
Step 9: Git Repository and Code
The Arduino Sketch can be downloaded from https://github.com/lansing-makers-network/Arduino-harpsi-gourd then copied into a directory by the same name. The project requires the following four files:
- "harpsi-gourd.ino" the actual application code
- "harpsi-gourd.h" the instances of the Touch Sensors defining the position of touch probes to the corresponding NeoPixels and MIDI notes.
- "PitchToNote.h" a reference for notes to MIDI codes.
The default "harpsi-gourd.h" simply has the location of the Notes and NeoPixels in simple order. Where you will likely need to tailor this file to your build as you will likely have the positions different. I have included a file "harpsi-gourd.mpf.h" that is specifically custom to my build. It and the README.md file are not needed.
The sketch requires the following additional libraries:
- Adafruit NeoPixel Library
- Bare Touch's MPR121 Library
The NeoPixel can be downloaded using the Arduino IDE's Library manager