Posted on Leave a comment

Arduinos and Piezo Triggers

It isn’t hard to make a DIY e-drum system that ‘sorta’ works, but there is a much longer road to making one that is good to play. The Alesis DM Pro that I have using is the latest of a series of Alesis products that I have used for processing my home-made drum pads. I’ve also owned a DM10, DM5 and a DM4. My very first E-drum unit was an ancient Roland PM16. All of them gave a far superior ‘feel’ to just sticking peizos straight into the Arduino analogue inputs. This direct approach has problems detecting some triggers, strange velocity response and crosstalk (one input setting off other adjacent drums) even when only one drum is plugged in.

We are using roughly the same hardware components, my old Tama Techstar pads were just piezos glued to plywood, so what is going on and how do these commercial products make it work so well? To get a more predictable, stable drum we need to improve our handling of the sensors. Look at the oscilloscope captures below, particularly at the Vmax(1) at the bottom of the images.

  • Piezos can damage your Arduino. A piezo, struck hard, can send (depending on the model) 10, 20 or even 30v down a line that would really rather be seeing about 5v. We need to limit the voltage to safe levels.
  • Piezos are the wrong impedance for easy sensing. The Arduino wants to measure from a low output impedance (~10KΩ) but it is currently seeing about 1MΩ from the input resistor. We can fix this by adding an active buffer (or putting a lower value resistor across the input, but this will reduce sensitivity).
  • Commercial products have gain controls (usually electronic, but the PM16 had tiny potentiometers), velocity curve selection and crosstalk detection. These are software solutions and shall be addressed later.

For the sake of simplicity and getting a system up and running quickly, we can use a unity buffer to protect the Arduino and condition the signal.

A quick 3D printed test bed containing an Arduino Mega, 8 channel multiplexer (not used yet), breadboard and eight Cliff jacks.

Opamp Buffering

A unity amplifier is one of simplest ways to use an opamp – you just connect the output of the chip to the negative input, as shown below. Any voltage coming in will be mirrored to the output.

The LM324 is a quad opamp that can operate at low voltages. Output cannot go higher than Vcc – 1.5V (1.5v lower than the voltage you are using to power the opamp), but that should still be enough for testing. If we run it from the Arduino’s 5v out line we will still have 3.5v of room to play. If everything works out an independent power supply can be arranged at a higher voltage to allow a full 5v output.

The oscilloscope screen pictured on the right shows the voltage from the drum hitting 3.6v and flattening out for the duration of the hit. This behaviour can be used to our advantage.

The 8-inch drum input buffered by am opamp powered by the Arduino’s 5v line. The spike tops out at 3.6v from ~13v input.
A simple unity buffer. Just hook the output into the negative input.

Is this good enough already?

Experimentation with an 8″ drum showed that a lot of expressive playing happens below 3.5v with the hard voltage limit acting like an audio compressor – hard hits are effectively flattened out to similar velocity values, smoothing out runs and fast rudiments. The Arduino Mega also has the ability to use a range of reference voltages for measuring input on the analogue lines. We can set the Mega to measure against 4.3v (the closest preset available) instead of 5v or supply 3.5v to the input reference pin to get a full velocity range from our sensor. We could also just use a 3.5v Arduino like the ESP32 that expects a maximum of 3.5v input, but in that case we would have to find a 5v source from outside the Arduino to run the opamp. We could also just adjust the velocity range in software but we are still losing precision and my work on the sampling violin showed that after you account for a reasonable noise floor that loss of precision really does matter. The biggest problem I found was sitting down at a drumkit is a very different experience from hitting a drum in front of an oscilloscope; what I thought was a reasonable velocity range in lab testing was nowhere near the velocity achieved in real playing. All of my hits were flattening out on the 3.5v rail, giving a very artificial drum-machine like feel to performance. This is not good enough, it feels lazy to leave it half-baked like this, and I’m going to need a lot more drum inputs than even the Mega can give me so we might as well do the inputs properly while working out the multiplexers than can give me 8 inputs per analogue channel.

Next – full range input and signal multiplexing

Posted on

3D Printed E-Drum and sensor system

This is a build document for a large array of E-Drums I am making to support a VR hyper-instrument project. All of the 3D printed objects, Arduino source code and instrument files will be made available through this website with appropriate copyleft licencing, mostly dependent on the most permissive possible licence of the source materials I am using. The hyper-instrument itself will be covered later in a separate series of posts after the construction of the physical instruments has been completed.

One piece shell and one piece rim printed in ESUN ABS+. The skin is a Remo Silentstroke 6″. Tension Bolts are 75 or 80mm M6. The shell is modified from a set published by RyoKosaka on Thingiverse under the Creative Commons Attribution-ShareAlike licence. In accordance with that licence my modifications and my sensor mount design are licenced similarly.

Get a good printer.

After several years of mostly solid performance, I decided to upgrade my 3D printer. My old refurbished Wanhao Duplicator (Sold as Cocoon through Aldi) had seen me through the construction of the Ambsonic dome, but was unable to reliably print ABS or run overnight. Temperature variations would always detach print jobs from the build plate no matter how much glue stick or hairspray I applied. It was also far too slow for the big, dense prints I needed to create drum shells. I needed a cheap, fast, fully enclosed printer.

The Creality K1 has mixed reviews and comes with many warnings from the cognoscenti of Reddit about poor build quality and recurring print issues. I considered myself experienced enough to fix whatever went wrong and bought one at a good discount. It has jammed only once in several months of hard use. It is fully enclosed and reaches temperatures of up to 50°C internally with heat from the build plate alone. This is not always desirable, so leaving the door open when printing PLA in hot weather is a must.

Printing the drums

I found several sets of designs for drum shells on Thingiverse (a site with a huge selection of free-to-use ready-made 3D print designs) and quickly settled on this collection of shells deconstructed for printing on 20cm print beds. The shells and rims are printed in sections and held together with M3 screws. The K1 is just big enough to print the 6″ shells in one piece, taking 6.5 hours in fine mode. The 6″ rim also prints in one piece, taking 2 hours. Shells printed using both ABS and PLA have held tension with skins installed for around a week with no signs of structural problems. Larger rims, such as the 8″ and 10″ sets have distorted (shown below) but are working well enough and are not losing tension.

Printing a one piece shell in rainbow silk PLA from ESUN.

Making the sensors

E-drums use a type of pressure sensor called a piezo. These are usually sold as flat discs that may have wires already attached. In the type of sensor I am using, force from the drum stick impacting the mesh head is transmitted to the piezo through a cone of soft material. The piezo is sandwiched between the cone and another disc of the same material that insulates the piezo from the frame of the drum. Multi-sensor drums that can detect playing on the rim often mount another peizo directly to the drum frame.

Completed cone sensor for the 6″ Drum. The cone is made from 3 layers of 12mm self-adhesive EVA foam sheet.

The mounting plates for the internal sensors included with the downloaded files made no sense to me, so I quickly designed a new friction-fit sensor sled that allowed for another jack to be installed underneath the drum, to be used for tight arrangements where the sides of the shell might not be accessible. The sensor is patterned after the Roland cone sensors used on their V-drum products. Although ready-made cones are available from aftermarket manufacturers, they are easy to make from materials available from Bunnings, for a fraction of the price

I experimented with several types of foam when developing the cones, including hybrid cones that used softer material for the top half. It didn’t really matter – every foam I tried gave good results, but a cone with a pointed tip such as the one shown above will need to be constructed from a firm material. Having a small point is especially desirable for drums with a centrally mounted sensor as it makes the foam cone harder to hit directly with the drum stick (which usually results in a very, very loud hit that stands out from regular playing). The sensor sled is a tight friction fit inside the drum but is secured with 20mm M3 bolts to keep it in place when plugging leads into the integrated Cliff jack.

Making the cones

I use a 3D printed cone shaping jig and a reciprocating scroll saw to shape the cones. Firmer foams, such as this EVA, can be shaped with a powered wheel sander. Soft foams have a tendency to grab blades and sanding discs/belts and can be dangerous to work with if you are using high-speed equipment, so I would recommend shaping those materials by hand with a scalpel. The jig is designed to replicate the 66° slope of the original Roland cones.

Assembling the sensor sled.

The sensor sled mounted to the 6″ shell. The Cliff jacks are simply wired with the red wire from the piezo to the tip of the inserted 6.5mm jack.
The tip of the cone should ~2-3mm proud of the height of the shell, allowing it to make good contact with the mesh drumhead. The cone described above comes out at exactly the same height. Take care when tightening the drum head as high tension may cause the sensor to stop working. If a satisfactory tension cannot be reached without stressing the cone, trim a very small amount from the top, taking care to leave a flat, smooth surface.

Bill of Materials

PartMaterialsCost
6″ Drum shellABS or PLA filament55m/165g$4.62
6″ Drum rimABS or PLA filament22.3m /67g$1.86
Sensor sledABS or PLA filament3m/9g$0.18
37mm Piezo In a pack of 25 from Ebay1$0.30
6.5mm Cliff jack Bulk order of 30 from Element142$3.70
37mm disc of EVA foamCut from 400 x 500 x 12mm Adhesive Rubber Mat4$0.80
Hookup wireAnything lying aroundTo taste??
Double sided tapeSomething thin – not foamTo taste??

Files (will be linked soon)