This blog post is intended to help anyone out there who wants to create an electric drum set.
If you are a drummer that lives in an apartment and wants to be nice to your neighbors, doesn’t want to spend $5,000 on a good premade set, or if you are just bored and want a cool project to work on, this post is for you!
Before this project, I had almost no understanding of electronics whatsoever, so I’ll attempt to keep things a non-technical as possible, in hopes of helping out those who are beginning their first electronic projects as well.
The overall cost of my drum set ended up being about $300, including an optional $150 stand I bought for convenience, but not including the cost of an old laptop that I already had lying around. By comparison, you can get a cheap pre-made electric drum set for $200 (no laptop needed), but they are pretty terrible, as they still still make a pretty loud tapping noise and have an unrealistic bounce to them. Solid electric drum sets usually cost about $5000 unfortunately.
Very generally speaking, these are the parts of an electric drum set:
- A microphone that can convert vibrations into an electrical signal
- Firmware to pick up the electrical signal from the microphone and turn it into a digital signal (MIDI) that a computer can understand
- Software to pick up the MIDI signal and to convert it into a drum sound
- Something to hit with your drumsticks
The bulk of these instructions will be around building out those core pieces. Afterwards, I’ll provide a few bonus sections:
- Adding in foot pedals
- Optimizing your drumset
- What not to do
Be patient, and take lots of breaks–this will take at very least several hours! Good luck!
How to make “A microphone to convert the drumstick strike into an electrical signal”
You’ll be building an electrical circuit in this section. I’ll start by explaining what the basic electrical components are–I recommend reading at least the first bullet point or two for each component–then will show you how to create a prototype triggered-light circuit.
- Basically, this component converts force (e.g. sound or vibration) to an electrical signal. This component is the basic building block of any electric drum set.
- These are usually made of a flat disk of crystal, because crystals are by nature electrically and physically symmetrical, and they like to remain so.
- Piezo sensitivity is largely determined by how high of a resistance resistor you put in parallel to the piezo. If you use high resistance (say, 1 million Ohm resistor), you should be able to pick up sounds from across the room pretty easily without even touching the piezo. At lower parallel resistances, the piezo will pick up fewer sounds at a distance, but will still pick up vibrations caused by touching it, or by tapping whatever surface it is attached to.
- When attaching piezos to things, I’ve had a lot of luck with gorilla glue, because it dries into an extremely hard material. The harder the material, the less shock-wave-muffling it will be, which is what we want in our drumset materials in general, except for the mute pads. Gorilla glue takes a while to dry, though, and once it is dry it is never coming off of whatever you put it on, so make sure you glue things in a safe spot where they can dry without your cat stepping on them, and wash your hands extremely thoroughly after using it.
- As I understand it: Applying force to one side of the the crystal brings the protons and electrons in the atoms closer together, forcing the electrons (which are both relatively mobile and hate being near each other) to the other side of the material (or even completely off of the crystal). A voltage is created across the crystal because you have a larger number of electrons on one side of the disk than on the other, and electrons want to move from the electron-heavy side to the proton-heavy side, but they can’t while the crystal is compressed. After the pressure is released, there is a bit of a bounce of negative to positive and back again as the piezo attempts to reach physical and atomic-force equilibrium, assuming the electrons from one side have the ability to get back to where they started from after they are forced off of the crystal by the other electrons anyways. The bounce can be considered AC (alternating current, where electrons are trying to escape one pole at first, but then are trying to get back to that same pole a little bit later). If you don’t give the electrons any way to get back to where they started, then all the electrons that are forced off of the piezo will just burst down the wire the piezo is connected to and won’t come back, which is known as DC or direct current.
- A resistor basically reduces the number of electrons that can pass through part of a circuit at a given point in time.
- Our main resistor will actually be dual purpose. First, we want to give electrons that leave one pole of our piezo a way to travel to the other end of the piezo. This allows the current from the piezo to be AC instead of DC, and from what I’ve read this also makes the piezo’s output current more predictable / less dependent on environmental factors such as heat. The second purpose of our main resistor is to control just how many electrons decide to go back to the piezo instead of travelling further down the circuit. The higher the Ohm rating (aka resistance) of our main resistor, the fewer electrons will run back to the piezo, and stronger the signal from the piezo will be.
- If your resistors are all mixed up and you can’t figure out what the Ohm ratings are, you can use the colored stripes and this handy calculator to find out: https://www.allaboutcircuits.com/tools/resistor-color-code-calculator/
- As I understand it: certain materials just don’t like electrons passing through them. You can think of electrons travelling down a circuit like a thousand bowling balls trying to roll down the same lane. In order to make progress, the guys in the back have to push everyone ahead of them forward. In high resistance materials, all of the atoms are happy and stable as they are and don’t want outside electrons displacing their local electrons, and so some percentage of the pushy outside electrons are instead knocked completely off of the circuit, in the form of light and/or heat. The higher the resistance of a material, the more electrons are pushed out of the circuit instead of travelling further down it.
- A bread board is what you plug your electrical components into. Learning to use these is a right of passage for any aspiring electrical engineer or hobbyist.
- There is a pattern to how the different holes are connected. You can find a great overview here: http://www.instructables.com/id/Breadboards-for-Beginners/ or check out this video:
- As the story goes, before mass production of cheap plastic bread boards, electrical engineers would prototype their circuits by soldering everything to pieces of wood, such as the wooden boards people usually cut bread on.
- A potentiometer is a type of resistor, that will change its resistance as you twist or slide a knob.
- The path from the light blue pin to the green pin has a variable level of resistance, because electrons have a variable amount of gray resistant material to go through before reaching the green pin. You can increase the amount of gray material the electrons have to go through by sliding the knob to the left, or decrease it by sliding the knob to the right.
- The path from the dark blue to the green pin always goes through the maximum amount of resistant material, and will therefore always carry the maximum Ohm rating of the potentiometer no matter where the knob is positioned.
- A capacitor is basically two close-proximity metal plates that are capable of holding electrons. The end result is usually two oppositely charged plates. You can think of them like two magnets that are attracted to each other but that can’t actually touch due to physical constraints.
- As I understand it: a capacitor in parallel with a piezo smooths out the transition from a dead circuit to a circuit with a bunch of electrons travelling through it. With a parallel capacitor, instead of going from 0 to 1,000,000 electrons very quickly on our sensor readings, we will see a more gradual 0, 500k, 700k, 900k, 1MM over a slightly longer time period and in more of a curve shape than a straight line.
- There is probably a “perfect” curve that you can try to reach by swapping out various capacitors and resistance values, and then by looking at the sensor readings on your firmware (I think you want something that looks like the top 1/2 of a perfect sine wave), but if you use the same values as me you will be close enough.
Prototyping Your Electronics
By the time you get all of your components, you are probably going to be pretty eager to create something physical that you can mess with. Let’s create a basic circuit, that will generate a pulse from a piezo (which is what will happen when we hit whatever the piezo is attached to with a drum stick), and will use that pulse to light up a simple LED (which is a small light used in circuitry and in a lot of real world applications also).
We’re going to try to create this:
When you’re done it will light up the LED when you do this:
You will need all of these for this portion of the project:
“What are all of those?” you ask? I put everything you will need to buy in the summary section down below. In terms of a workstation, you are also going to need:
- A safe place to put your hot soldering iron when you’re not using it
- A place to do your soldering, for instance an extra piece of cardboard that you can throw out. Traditionally electrical engineers would use wooden breadboards for this.
If you have never stripped and soldered wires before, you are going to need to learn to do that now.
Be sure to work in a well ventilated area, do not breathe the smoke produced, and plan out where you are going to set your soldering iron when you are done using it ahead of time. It is going to be incredibly hot, so don’t just unplug it and assume it’s not going to burn your house down (it will totally do that–be careful!), and keep it away from children and pets, etc.
How to build the prototype circuit
- Plug in your soldering iron and place it somewhere safe. It is going to get hot so be careful!
- Add easy components to breadboard:
- Insert your LED at pins J19 and J24.
- Insert your first 1kOhm resistor at D19 and I19.
- Insert your second resistor at D24 and I24.
- Insert your 1MOhm resistor at C19 and C24. This resistor will be referred to as your “parallel resistor” from here on out.
- Insert your 1nF capacitor at B19 and B24
- Does your piezo wires plug directly into the breadboard? If so, skip the next few steps and continue on with the step about plugging the piezo into the breadboard. If like most piezos, the wires are too small to plug in firmly, then you are going to want to continue with the next step, to attach a better wire to the end of the piezo.
- Strip the piezo wires. This is going to be really annoying unless you happened to buy a wire stripper that fits the thinness of the wires attached to the piezo. If you (like me) did not, then you will want to use the wire cutting part of your wire strippers as if they were scissors, and cut in just a little tiny bit into the plastic casing on the wire, all the way around the wire. When you’ve cut a circle around the metal wiring inside the casing, you should be able to slide the casing off of the wire entirely to expose the metal underneath.
- Cut two lengths of loose wire and strip about 1/2 an inch off of each end
- Solder the stripped end of the piezo wire to one of the ends of the loose wire. Then do the same with the other piezo wire and the other loose wire. When you are done with this step, you will basically just have extended the wires that were already attached to the piezo with thicker wire.
- Plug one of your extended piezo wires into the breadboard at A19, and the other wire into A24.
- Unplug your soldering iron. 😉
- Hold the piezo disk in your hand like a quarter, and kind of flick the end of it with your index finger (see video above). If you look closely (ideally down from above) you should see your LED lighting up when you flick the piezo disk. You may need to create a shadow over the LED with your free hand to make it easier to see what is happening.
Get it working?? We just created a circuit that takes physical motion, and translates it into an electrical signal! Pretty cool huh? This is actually a much stronger electrical signal than we need, but we can lower the intensity later.
If you are interested in what is going on with this circuit, please continue on below. Or, skip right to the next section where we’ll be converting our piezo pulses into MIDI signals. Onward we go!
What is going on in this circuit?
For clarity, I drew the components in the diagram of the circuit a bit more spread out that the circuit I just had you build. I’m going to refer to the diagram when explaining what is going on here.
The big black circle is the piezo disk. When you apply pressure to it, it will create an electrical current. Alternatively, when you apply an electric current to it, it will create audible noise. However, let’s just use it in the first way, to create electrical current from pressure.
The green wires coming out of the piezo disk are just regular conductive wires. You will use them to connect different parts of your circuit, so that you can spread things out and make it all easier to work with. If you end up buying cheaper piezo disks like I did, then you will need to strip the end of the wire using a wire stripper, then you will cut a small length of wire from your loose-wire spindle (don’t use jumper wires for this, solder will not stick to them), strip both ends of it, solder one end of the spindle wire to the exposed section of the piezo wire, then you will stick the other end of the spindle wire directly into the breadboard. Next, repeat for the other wire that is sticking out of the piezo.
If you bought a different type of piezo than I did, and the wires fit firmly into the breadboard, then you can just plug it in without worrying about soldering any connective wires as I just described.
The other green wires on the diagram (the ones that are not connected directly to the wires coming out of the piezo) are just “jumper wires”. They are made specifically to fit into breadboards, to save you the time and energy of cutting and stripping various lengths of wire on your own every time you need to connect two points on the breadboard. They usually come with the added advantage of being color coded, which will help you keep track of what is connected to what as you are tracing the path of the electrons through your circuitry.
The component directly below the piezo is a resistor. Its purpose is to allow electrons to move between the two points it is connected to, but only at a certain rate or current. In this circuit, it is providing a path between the positive and negative poles of the piezo. Since it is placed in this way, with one end connected to the same breadboard line as the one end of the piezo, and the other end connected to the same breadboard line as the other end of the piezo, we say that the resistor is placed “in parallel” with the piezo. Note that some of the electrons can simply bypass this resistor if they want to, because there is a lower resistance path ahead of them if they just ignore the resistor altogether. However, the way piezos work–and because LEDs only allow electron traffic to go in one direction–some electrons will actually end up travelling across that resistor anyways.
The other two resistors are there simply intended to help to protect the LED (see next paragraph) from exploding. See how the electrons can’t reach the bottom of the breadboard without going through one of those resistors? That means these resistors are applied “in series” with the piezo. There purpose here, is simply to protect the LED from the large spike of electron traffic that will be charging down the wire once the piezo disk is struck.
The red component at the bottom of the circuit board is an LED. LED stands for light emitting diode, which means “a thing that will produce light when electrons run through it, but only if the electrons are travelling up one of the connectors and down the other connector.” That last part is an attribute of diodes: they only allow electrons to travel in one direction but not the other. For our purposes, it doesn’t really matter which way the electrons are allowed to travel, because as a piezo vibrates, it alternates whether each wire is pushing out electrons or whether it is pulling them in. In other words, electrons are going to attempt to flow through the diode in the correct direction at some point after we strike the piezo.
The remaining component, the little blue guy at the top, is a capacitor. We don’t actually need him at all for this circuit, however he does smooth out the waves of electrons produced by the piezo, which will be useful when we go to actually read the electrons with our firmware, so for now let’s just get used to him being around.
Summary of recommended drumstick-to-electrical-signal purchases
- Buy some piezos e.g. https://smile.amazon.com/gp/product/B00Z7ZLUAW
- Buy some gorilla glue to help you attach your piezos to things e.g. https://smile.amazon.com/Gorilla-Super-Glue-Gel-Clear/dp/B00OAAUAX8
- Buy mixed resistors e.g. https://smile.amazon.com/gp/product/B06Y5Y76XX
- Buy 10nF capacitors e.g. https://smile.amazon.com/gp/product/B0087YK25Y
- Buy two+ smaller breadboards and jumper cables e.g. https://smile.amazon.com/dp/B06ZZ5W2K1
- Buy some loose wire that you can use to connect your components together e.g. https://smile.amazon.com/gp/product/B00FGDV9WY
- Buy some wire strippers so you can actually reach the conductive part of your wiring, for soldering/connective purposes e.g. https://smile.amazon.com/Wire-Stripper-Cutter-Crimper-Multi-Function/dp/B00ZYQEPEC
- Buy some solder, which works as glue when connecting electrical components e.g. https://smile.amazon.com/uxcell-0-5mm-Soldering-Solder-Rosin/dp/B00N3X72BQ
- Buy a soldering iron, to heat up the solder so it adheres to metal e.g. https://smile.amazon.com/Soldering-Adjustable-Temperature-Precision-Indicator/dp/B071S5Z1R2
How to make “Something to pick up the electrical signal and turn it into a digital signal (MIDI) that a computer can understand”
This is an area where you will probably be the most happy you’ve read this post, because I will save you several months of time with this information and programming code. In the interest of helping others to avoid my mistakes, I’m going to complain (er I mean explain) a bunch of things I did wrong later in this article. But for now let’s walk about what you should do!
What to do with hardware
Once you find and buy a Teensy (see the summary of recommendations later in this section), you are going to want to plug it into a breadboard so that it is straddling the empty space down the center. Next, if you haven’t already, follow the steps (probably on a second breadboard) above to prototype a piezo that triggers an LED. You are going to use the same LED setup to start, but then you are going to replace the LED and run 2 wires to 1) the analog ground pin of the Teensy and 2) into the analog pin input of the Teensy. We want to connect wire number 1 to the Teensy’s AGND pin, and wire number 2 to the Teensy’s A0 pin.
This is what it looks like when you have a single piezo set up correctly on a teensy 3.2:
- We are really just adding two wires to the prototype circuit from before
- The jumper wires go into the breadboard, they don’t actually touch the Teensy.
- The little gray solder dots on top of the Teensy are spaced the same way the little metal pins on the bottom are spaced, so you can use them to count pin positions and figure out what row your jumper cables need to connect to.
- The Teensy should be seated firmly into the breadboard with very little of the metal pins showing.
Next, plug your micro-USB cable into your Teensy on one end, and into your computer on the other end. You may see a little blinking light come on when the Teensy receives power. That is just the default program activating and telling you your Teensy is ready to receive some instructions!
What to do with software
You are going to need the Arduino IDE in order to program your Teensy, as well as this Teensyduino driver. Once you have the two programs above installed, and are therefore ready to communicate with your firmware, download this code. The code is a program I wrote for the Teensy, that will translate signals received on the various analog pins into MIDI signals, that are then sent to your computer via the USB cable. (You are welcome to use and edit the code but please don’t pass it around or use it commercially!) Here is how you can get the code running on your Teensy firmware:
- Open up the zip file and extract the contents somewhere, perhaps to a folder on your desktop
- Open up the Arduino IDE
- Go to File->Open, navigate to the folder where you extracted the code, and open up the analog_drumset_main.ino file. It should load up about 4 files that are part of that project.
- Go to Tools->Board and select the version of your Teensy
- Go to Tools->USB Type and select serial+MIDI. This will tell your Teensy that it can send both text and MIDI signals. (We will need the text part to debug our Teensy.)
- Press the Teensy hardware’s physical “reset” button (it should be a small white button near one end, and is usually the only button on the teensy). This will tell it to prepare to receive some code.
- Back in the Arduino IDE, press the compile/verify button, wait for it to do its thing, then click the upload button. A small Teensyduino window should pop up and say “reboot ok” then “press button on Teensy to manually enter program mode.” This means the program was successfully moved over to the Teensy firmware and is now running
Testing out the pulse to MIDI signal conversion
I left a bunch of flags in the analog_drumset_main.ino file of the program, which will allow you to turn certain aspects of the program off and on. A “flag” is simply the code version of a light switch, that can be either off or on. Let’s test out our first piezo drum trigger by turning on the DEBUG_PIEZO flag. You turn a flag on by setting it equal to 1, and off by setting it to 0. To avoid interference from other flags, turn off all the other DEBUG_X flags when you turn on the DEBUG_PIEZO flag. You should end up with something like this:
const int DEBUG_MAIN_SETUP = 0;
const int DEBUG_MAIN_LOOP = 0;
const int DEBUG_PIEZO = 1;
const int DEBUG_PIEZO_MAX = 0;
Now click the run button again, which will compile (translate to computer language) and move the code over to the Teensy with these new flags set. If you watch the Teensyduino window, you should see it flash “Reboot OK” like it did the first time you hit the upload button.
Once the code is uploaded to the Teensy, click Tools->Serial Plotter Mode in the IDE. This will open up a graphing mode, which will plot the number of electrons running through each of the Teensy’s first eight or so analog pins. Change the baud rate to 38400 baud (there should be a drop-down somewhere on the plotter window where you can change the baud rate.) When your piezo is just sitting there at equilibrium, your graph will look something like this:
Even at rest, background noise, circuit noise, or other pressure on your piezo will probably keep the signal bouncing around at the 40-100 mark. If the at-rest value you are seeing in your graph is above, say, 500, then you will probably want to reduce the Ohm rating of the in-parallel resistor in your circuit, make sure all of your connections are secure, and maybe even set the NOISE_BUFFER value in the code to about 100 above the at-rest value you are seeing in the serial plotter. The higher the at-rest value, the more likely you are going to get double-triggers (one drumstick strike makes two sounds) or cross-talk (if you strike just the snare, and the snare and the crash both make sounds at the same time), so if you can minimize the noise at the hardware level instead, of adjusting the NOISE_BUFFER in the code, then you should do so.
Now, try tapping your piezo. You should see a spike in the graph where an electrical pulse was picked up by the analog pin. Make sure you are watching the plotter as you tap the piezo, the pulse will pass in less than a second!
If that didn’t work, try tracing your circuit: Make sure all connections are secure, and that your Teensy is seated firmly in the breadboard. Also double check that the USB cable is still in both the Teensy and the USB port of your computer. You may also need to close all serial plotter/monitor windows in the IDE, then hit the upload button again to get the Teensy to reboot before opening them up again. Finally, if you started with a prototype and you still have your LED hooked in, try unplugging the jumper cables that lead to the Teensy, and check to see that the LED is still lighting up when you flick the piezo disk. If it’s not, then you have a broken connection somewhere between the piezo disk and the LED. Once you get your LED lighting up again, hook your Teensy back up, re-upload, and have another go at it.
Once you get it purring along, it’s time to make a hardware adjustment. If you, like me, were using an extremely high-Ohm-value parallel resistor in your prototype circuit (e.g. 1MOhm), then it’s time to replace it with a lower value of resistor. Close the serial plotter, then pull out the 1MOhm resistor and puta 20kOhm or so resistor in its place. Then open up the serial plotter again and give the piezo a flick. If a hard flick gets the reading in the serial monitor up to about 2500 or 3000, then you’ve picked a perfect resistance value. If the value is below 2500, you might want to try a higher value resistor, say 30kOhm or 50kOhm. The higher the resistance of the parallel resistor, the more sensitive the piezo disk will be, and the stronger the signal we will get. There are dangers in having a disk that is either too sensitive (always hits 4000) or not sensitive enough (doesn’t reach 2500), so we’ll aim for just the right level of sensitivity for a hard flick, which will be right around value 3000 on our serial plotter.
Testing out the MIDI signals
Once you’re sure your Teensy is picking up and graphing the piezo’s electrons, let’s make sure the Teensy knows how to turn those electron readings into actual MIDI signals.
Close the serial plotter window, turn off the DEBUG_PIEZO flag in the code, and turn on the DEBUG_MAIN_SETUP and DEBUG_MAIN_LOOP flags, like this:
const int DEBUG_MAIN_SETUP = 1;
const int DEBUG_MAIN_LOOP = 1;
const int DEBUG_PIEZO = 0;
const int DEBUG_PIEZO_MAX = 0;
These flags tell the Teensy to output text to the serial monitor window when it does something interesting. Hit the run button to send the code to the Teensy and to start it running. When the Teensyduino windows says it’s done, click Tools->Serial Monitor to open up the serial monitor window, and select 38400 baud. If you see text in the serial monitor, just wait about five seconds for it to finish its setup. Now, try tapping your piezo. If everything is set up correctly, you should see output like this:
If you see output like that, congratulations! Any MIDI processing software on your computer should now be able to pick up your MIDI signals and translate them into instrument sounds (including drums!)
Hooking up MIDI processing software
Assuming you are on Windows, we are now going to want to download some software that can pick up MIDI signals and can turn it into drum sounds. First, download and install Reaper, which is a “DAW” that can hold audio-processing plugins such as virtual drum kits. Make note of where you install it, because you will need to put virtual drumset files in one of its subdirectories. Download this virtual instrument: MT Power Drumkit 2, then open it up, and copy the MT-PowerDrumKit.dll and MT-PowerDrumKit-Content.pdk files to the /Plugins/FX subdirectory of your Reaper installation directory. For me, the full path to the PowerDrumKit files ended up being:
- C:\Program Files\REAPER (x64)\Plugins\FX\MT-PowerDrumKit.dll
- C:\Program Files\REAPER (x64)\Plugins\FX\MT-PowerDrumKit-Content.pdk
Next, open Reaper up. Click Options->Preferences, then under Audio->MIDI devices, double click the Teensy and check the “enable input from this device” checkbox . Reaper should now know how to read MIDI signals from the Teensy. Close out the preferences window so we can add an instrument.
On the main Reaper screen, click Insert->Virtual Instrument On A New Track. Under All Plugins->Instruments, select VSTi: MT-PowerDrumKit (MANDA AUDIO and hit OK, then click Yes to add a bunch of tracks (I’m honestly not sure what that does, I think No works too). A new window should popup that says FX: Track 1: MT-PowerDrumKit. In my version of this software, I am able to hit a skip button to skip over entering a registration code. Assuming you have one as well, go ahead and click it, and you will be brought to a screen with a picture of drums on it.
Click on a few of the different drums, and you should hear a drum sound. If not, make sure your speakers are on, your computer isn’t on mute, etc. Maybe try playing something on youtube to see if your speakers work at all, or going to Options->Preferences in the main Reaper window and then messing with the settings under Audio->Device.
At the time of this writing, every time you start Reaper you are going to have to go to the plugin startup page and to “skip” again. You can access the startup page pretty easily by clicking the little green FX button near the top track settings.
If clicking the drumset did result in drum sounds, try tapping your piezo. Did you get a drum sound??? WAS IT THE MOST AMAZING THING EVER YES I BELIEVE IT WAS!!!
However, if you didn’t get a drum sound, try turning Reaper off and back on then doing it again. If that didn’t work either, double check your Reaper settings, or try going back to the serial monitor in the Arduino IDE to see if the Teensy is actually sending the MIDI signals or not. You have four main things that could be going wrong at this point: the piezo signal might not be reaching the Teensy, the Teensy might not be sending MIDI signals, the MIDI signals might not be picked up by the Reaper software or plugin, and the Reaper software might not be outputting sound successfully. Be sure to use the debugging flags available in the software to help you find out if the problem is the piezo not sending electrons or if the Teensy isn’t sending MIDI signals. If it’s neither of those problems, the bug must be somewhere on the computer side of things. Please comment on this post with your individual debugging stories if you have one that might help someone else figure out what is going wrong!
Back to hardware
Multiple drum triggers
At this point you should have at least one piezo trigger that can generate a MIDI signal, and ideally a drum sound, fully set up. The next step is to attach as many piezos as you want drums in your drum set.
- Wire up a new piezo so that you can connect it to the breadboard
- Plug one end of the piezo into the next analog pin e.g. A1
- Plug the other end of the piezo into the same AGND as the previous piezo. Using the long blue strip of the breadboard to plug all of your AGND connections to will make this part a lot easier.
It will look something like this:
As you continue to add piezos, you are going to start encountering jumbles of wires, and will have trouble keeping your components from touching and creating a short-circuit / unintended electron path. Here are a few tips that helped me keep everything in order:
- Space out your components. Leave 1 row in between connectors.
- When you strip wires for the breadboard, try to leave just a little more exposed wire than you need.
- Use one small breadboard for your Teensy, and another one for all of your piezo circuitry, then connect the two with jumper cables. You will probably need to plan your layout ahead of time, but once you connect two or three piezos you will start to get the feel for how much space you will need.
When you have two or more piezos hooked up, take them for a spin!
How to make “Something to hit with your drumsticks”
This section is going to be very short, because you can literally use any physical object for this. The key is to choose something extremely durable, but also somewhat hard and light, because you want it to transfer shock waves very quickly (like hard materials tend to do) but you don’t want it to shatter (like light materials tend to do).
I decided to make my drums out of laser disks and mute pads, which works pretty well, though I don’t get quite as much bounce as I would like. Using different materials will require you to use different piezo sensitivities, so you will need to adjust the Ohm value on your “parallel resistor” to work well with whatever you end up choosing. If anyone wants to be brave and try out practice pads or other materials, I’d really appreciate it if you would tell us about your experience!
Note: I would not use vinyl records with mute pads; in my testing they were too soft to transfer the shock waves effectively, and are also too easy to break.
Here’s how you can attach your piezos to your laser disks:
- Plan out where you are going to put your laser disks in the final drum kit. This is a good time to consider buying a drum tree, which is a bunch of pads attached to a tree-like structure that you can use for practicing. I ordered the one listed in the recommendations below, and I just set my laser disks on it, which works really well. If you have some old cymbal hardware lying around you might be able to use one of your stands to hold a laser disk as well.
- Clear some space where you can leave your laser disks for about 24 hours
- Extend the wires between the piezos and the breadboard, by cutting 2-3 foot lengths of wire and soldering them to piezo’s wires
- Put a small dab of gorilla glue on the smooth size of the piezo.
- Press the piezo against the laserdisc. I put my piezos about halfway between the middle and outside edge of the laserdisc, which works pretty well. If anyone puts the piezo closer to the outer edge of the laserdisc, let everyone know how it went!
- Cut small strips of duct tape, and tape the two long wires attached to each piezo together at 5-inch intervals. This will help reduce the amount of wire-spaghetti you are dealing with later.
Summary of what-to-hit recommendations:
- Buy laser disks from a thrift store or similar junk shop
- Buy 12+ inch mute pads (or be brave and try actual practice pads, then let us know how they worked… )
- After you get everything working, consider buying a drum tree such as this one: https://smile.amazon.com/gp/product/B000UJEGT2
- Do not try to use vinyl records
Adding foot pedals
A little theory
The electron pulses created by the foot pedals are going to look a little different than those created by the piezo triggers. The piezo triggers create analog signals, like a sine wave oscillating between positive and negative values:
The foot pedals, on the other hand, are going to generate an on-or-off square-wave type of signal like this:
The foot pedals generate digital signals by acting like a drawbridge to a castle, in which there are a bunch of electrons that don’t really like being around each other, but who can’t escape because they can’t get across the moat. Pressing the foot pedal will lower the draw bridge so that the electrons can cross the moat and travel down the circuitry. If there are a lot of electrons in the castle, we know the drawbridge is closed. If there are only a few, then we know the drawbridge is open.
In reality, we’ll be putting electrons on one of the Teensy digital pins, instead of in a castle, by “writing” a value of 1 to the pin. We will then read the value on the pin, and if it is 0, we know the foot pedal has been pressed, allowing the electrons to escape from the pin. This type of drawbridge/foot pedal setup is called a pull-down switch, because when you press the foot pedal you drop the 1 value down to a 0.
How to set up your foot pedals
Setting up the foot pedals is going to be a bit more difficult than the piezo, mostly because foot pedals don’t come with an easy to use positive and negative pin, they come with an audio cable. What most people don’t know about audio cables, is that they actually have multiple separate channels on the cylindrical metal plug, separated by black rings. If you have one black ring, that means you have a mono audio cable, with the audio signal coming through the tip, and exiting out the base of the plug. Stereo cables will have two black rings because they have two channels and a base. Almost all foot pedals will have mono audio cables attached, because they just act as a simple drawbridge that electrons can pass over.
You’ll notice that there is a third component in this diagram that we haven’t talked about yet: the audio jack. This component is here to make it easier to run wires from your Teensy to your audio cable. You could just solder one wire to the tip of your audio cable, and another wire to the base, then plug those wires directly into the breadboard. However, the 1/4 inch audio cables that normally come with foot pedals are actually quite heavy, and will quickly become a hassle if you go this route. What I’d do instead, is to solder two wires to the pins on the back of a 1/4 mono audio jack, and then connect those wires to the breadboard. Audio jacks are constructed in a way so that when you plug the audio cable into it, one pin will only touch the tip of the audio plug, and the other pin will only touch the base. This design allows us to push electrons out of our Teensy at digital pin 1, over to pin 1 of our audio jack, into the tip of the audio cable, down into the foot pedal where they will press up against the draw bridge. This path is drawn in green. When the foot pedal is pressed, the draw bridge closes and the electrons are allowed to cross to the red path, where they flow back up into the audio plug’s base, onto pin 2 of the audio jack, and then over to the digital ground pin of the Teensy.
Here is a step by step guide to setting up a foot pedal:
- Cut two loose wires, about four inches long, and strip each end
- Solder one side of each wire to each of the pins on the audio jack
- Take one of your audio jacks, and plug one wire into the breadboard so that it connects to digital pin 4 of the Teensy, and the other so that it connects to the the GND pin. This will carry the signal for your kick drum.
- Take one of your audio jacks, and plug one wire into the breadboard so that it connects to digital pin 5 of the Teensy, and the other so that it connects to the the GND pin. This will carry the signal for opening/closing your high hat.
- Plug the audio cable from the foot pedal into one of your audio jacks.
- Open up Reaper, add in your virtual instrument if you don’t have it yet, hit the skip registration button if needed, then try pressing your foot pedal
Here is another copy of the Teensy pinout, for convenience:
If you hear an annoying repeating sound when you get your instrument set up, that means that your foot-pedal-drawbridge has its polarity reversed. In other words, the drawbridge starts down, allowing electrons to pass across it, and when you press the foot pedal it will open and block them, instead of the other way around. Most foot pedals will have a little polarity switch that you can use to change the default position of the drawbridge–try flipping that switch and seeing if the sound stops.
If you don’t hear anything at all, try closing Reaper, opening up the Arduino IDE, setting the DEBUG_SETUP and DEBUG_MAIN_LOOP flags in the code to 1 (and all other DEBUG_X flags to 0), then open up the serial monitor and see if it outputs anything when you press the foot pedal. If everything is set up correctly it should say “Overriding whatever note with kick drum note” or “Overriding high hat note with note.”
Summary of foot pedal recommendations
- Buy two foot pedals e.g. https://smile.amazon.com/gp/product/B06XR91F2T
- Buy some audio jacks to plug your foot pedals into e.g. https://smile.amazon.com/GLS-Audio-Jacks-Female-Panel/dp/B00CMXRLXM/
Optimizing your new drumset
I’m putting this first because it is the most important. Say you finish up your drumset, everything seems to be working fine, but then go to lay down a sick beat and you notice that there is a 1/2 second delay between when your stick touches the drum head, and when the drum sound comes out of your speakers. How can you play as fast as Dave Grohl with this level of latency? Here are some tips on how you can reduce the lag:
- Use ASIO drivers in Reaper
- Download and install ASIO4All
- Get everything set up so that you can use your drumset
- Next, go to Options->Preferences, Audio->Device and set the Audio System to ASIO
- Exit Reaper’s settings, and try to play a drum sound by smacking one of your drum heads. Did it work? If so, continue on. If not, you’ll need to be able to make a drum sound before continuing–I’d do some debugging.
- Once you get drum sounds working with ASIO, click the little green button in the taskbar to open ASIO settings
- Reduce the ASIO Buffer Size slider to 64, then try hitting a drum again. If it sounded garbled, then raise the slider up, say to 72, then try a drum sound again. Keep raising the slider bar until the drums sound right. Ideally you will be able to use a small enough buffer size to keep the delay between strike and sound very low.
Move it left, move it right, untangle then tangle then untangle the cords. You are going to eventually get annoyed by how all-over your drumset is. Here are some recommendations that might help you with the physical setup:
- Take the two long wires you soldered to each piezo, and wrap duct tape around them at 5 inch intervals. That will essentially reduce the number of loose wires you have by half.
- Gorilla glue your mute pads to the top of your laserdiscs so they don’t slide around. Make sure only to do this after you have everything working for a few days. If you are keeping your laserdics piezo-face-up, then make sure not to restrict your access to the piezo. The wires come loose and need to be re-soldered every once in a while.
- Try different drumstick weights. Since you aren’t going to get a lot of bounce out of your mute pads, I’d probably go with lighter sticks. (Actually, if you tend to hit the drum heads pretty hard, you will also probably want lighter sticks. Laserdiscs can take a pretty serious beating but they’re not invincible!)
- If you are having trouble making space for all of your pads, try buying a drum tree
Here are some tips for optimizing how your electronics are set up:
- Use one breadboard for your teensy, and one breadboard for your piezo triggers, then connect the two with jumper cables
- Make sure to use the right level of resistance in your parallel resistors. Remember, the higher the Ohm rating, the easier it will be to trigger your drum sounds, so be sure to set the Ohm rating at the right level.
- Keeping your components spaced out by a row/column or two will help you avoid some of the cross-talk issues inherent in breadboards. I’ve never actually had any problems with it, but it should reduce noise and doesn’t take any more time if you plan ahead.
- If you want to really drop the noise on your circuit down to an extremely low level (say, 0), solder your components together instead of plugging them into a breadboard.
- Use the audio-jack + audio-plug method to split the long wires coming from your piezos into two long wires that go from your piezo to your audio plug, and two short wires that go from an audio jack to your breadboard. This will allow you to detach and move around the different parts of your drumset much more easily. These little guys will let you easily turn two loose wires into a single audio plug. Make sure to buy 1/8″ (3.5mm) audio ports if you use those (as opposed to the 1/4″ audio ports you used for the foot pedals.)
- If you use the audio-jack + audio-plug method above, create a housing for your circuitry. Drill some holes in a wooden box, then put your circuitry in there with the audio jacks poking out the holes. Now the only wires you have to deal with are the ones coming from your piezos!
What not to do
Hopefully someone can learn from my many, many mistakes. Please comment on this post with any debugging / “I can’t believe I did that” stories of your own, to help others out!
Mistakes I made with the hardware part 1
The main thing that took forever when I got to this part of the drumset, is the way I approached converting electrical pulses to signals that a computer can use. I decided I wanted to make my drumset for like $20 total, so I was using a 555 timer to generate square waves, some clever NPN transistor-as-gate pieces that I was opening when a piezo pulse was hit, pumping the pulse into my standard mic port, and then connecting roughly every audio application Linux has to offer to each other to process the square wave(s). The problem with that approach, is actually nothing, if you are ok with only have 1 drum in your drumset. However, once you get to 2+ drums, you have to start considering, what happens if you are reading a 10hz square wave, a 20hz square wave, and a 40hz square wave, all transmitted to the receiver over the same wire at the same time (this is usually called polyphony). The software will have to figure out, is the 20hz square wave really a single wave, or is it two 40hz square waves played right after each other? And no matter how much you vary your waves (you could do longer 1s and shorter 0s, different amplitudes, etc), you are going to have a very hard time on the processor side discerning which combination of waves you are looking at, especially without a lot of analysis time and a lot of wave samples, which in the end is going to translate into a delay between the drum stick strike and the time you hear the actual drum sound. That is, unless you spend some number of months/years figuring out a way to process waves like that in real time. If you could figure it out, you could simplify the amount of hardware needed to make an electric drumset, and probably get a good job in signal processing somewhere, since I don’t think anyone is doing anything at that level right now. However, for this project, don’t bother, and just pay $20 for a bit of firmware which will give you multiple “mic” lines to send pulses across.
Firmware is essentially a very small and very basic computer, that can operate on both the hardware (e.g. electrical pulse processing) and software (e.g. figuring out what to do about the pulses, translate them into a digital format that can be transmitted over a USB wire, etc) levels. After 6 months of messing with the above approach (granted I was also learning, “what is a resistor,” etc) I gave up on my $20 drumset and purchased a Teensy, which is a piece of firmware in the Arduino family that will do nicely for our purposes. I recommend getting the one with the pins already attached, as that will make it a lot easier to attach to a breadboard etc.
Mistakes I made with the hardware part 2
Don’t weakly press the firmware into the breadboard. It will go pretty far in, with about 3/4 of the pins disappearing into the breadboard. If you embed it firmly, you will end up with electrons getting confused about where they can and can’t go, and they might cross breadboard lines or otherwise cause weird signal interference.
Mistakes I made with the hardware part 3
Don’t use an absurdly high resistance in parallel with your piezo, unless you are building a drumset that will play drum sounds every time the dog across the street barks. All over the internet you will find people telling you to use a 1 million Ohm resistor, because in general they just need a trigger of any sort, that will fire off at most once every second, etc. As drummers, we can often get up to quite a few drum strikes per second, and so we need to limit our piezo sensitivity so that we don’t end up triggering every drum in our drumset whenever we hit a single drum head. Once you get the software set up, you will be able to map out the pulse created by a drum stick strike, and you can adjust your resistance so that the top of the pulse just barely (or doesn’t quite) reaches the maximum value allowed by the firmware.
Mistakes I made with the software parts 1-6
It took quite a while to write good software to process my signals as well. First, even as a programmer, the language (sketch) is actually not simple to use. Second, you really need to force yourself to be object oriented about these things even though the language does not lend itself to it. Third, you need to guard against duplicate sounds by limiting the number of sounds each piezo is allowed to produce per so-many milliseconds. Fourth, you need to limit cross talk (drum 1 causing a drum 1 and a drum 2 sound simultaneously) by setting a minimum piezo-signal value that is allowed to trigger a sound. Fifth, you need to allow each piezo to have a different sensitivity, by tracking what the loudest signal each piezo sent was, and to limit the loudness of each drum sound by comparing each piezo’s current signal to its previous maximum signal (e.g. if you strike and it is a signal value of 100, then if the previous maximum was 200, you should play a drum sound at 50% volume). Sixth, you absolutely must have a way to debug the pulse being send by a piezo. You will never figure out what is going on with cross-talk etc without a way to do this.