piDrum
MAKE A DRUM MACHINE USING A PI, PIEZO ELEMENTS, AND CANS
If you're of a certain age, you probably remember making drums from discarded coffee cans with plastic lids: this project is the modern electronic version. The techniques presented can also be used to 'electrify' many other percussion instruments.
This project was my inspiration.
Project is in progress, stop back to see if I actually wrote something down. I won't post code yet, but it's working with one sensor.
PARTS REQUIRED
Nut can with metal bottom and cardboard sides. A Pringles can or frozen juice can will work, but they're a bit small for my tastes.
NPN power transistor, pretty much any kind. TO220 or similar cases are nice and rugged. I used a 13007 transistor.
Silicon rectifier diode, rated 1A or greater. I used a 1N4005.
Wire leads with connector to plug into the GPIO pins. I used a 2x4 female header connector with leads.
Piezo element. I salvaged one from a talking greeting card. They're also available from China: 10 for about three dollars.
Pi with sound output jack. This means the Zero will not work, unless you add the missing circuitry. Adafruit has a page on this. USB or HDMI sound output WILL NOT WORK.
Powered speakers for the Pi.
If you're building two drum sensors you'll need twice the above parts, with the exception of the connector, Pi and speakers.
TOOLS REQUIRED
Hot glue gun and glue.
Heat gun or hair dryer. Or maybe even a butane lighter.
Serrated knife to cut the side of the can.
Soldering stuff.
PARTS SOURCES
I salvaged the transistor and diode from a discarded compact fluorescent bulb. I gave them a good test since these parts are ones that commonly fail.
The wire lead was from an old PC and originally went from the motherboard to the front panel. Your friendly neighborhood PC repair shop should have some you could take off their hands.
The output of the piezo element is way too much for the Pi: it puts out around 30 volts if you give it a strong whack. You could rely on the Pi input clamp diodes to keep this within bounds, but I prefer something a little more robust. Below are a few circuits that I tried:
(insert pics here)
I decided to use the last circuit because the parts are available from a discarded CFL bulb. I happen to have a drawer full of them, and have been searching for a project to use them in. The 1.7K resistor isn't commonly found in the bulbs, but fortunately it's already included on the Pi, on GPIO 2 and 3.
ASSEMBLY
Cut the can down if you want, using the knife. Attach the piezo element to the center of the can bottom, inside the can. You only want a thin layer of glue, and it should cover the entire underside of the disk. You'll have to warm up the can and element, then press the element down to make this happen.
Double sided tape is usually used, but I decided to use hot glue instead. It works, and means one less item in the parts list. I MIGHT also have been watching too much Mr. Gear.