Introduction: Electronic Drum MIDI Controller
I am glad to present you an electronic drum controller project.
This project was done by me.
An electronic drum controller is used to simplify drummers’ life who wants to play and write some drum parts themselves.
The steps described below will help you to create a simple and dependable device for your home studio.
The project took much time about three months. I was working in the evenings after my job and at my weekends. The full cost according to the bill of material for the drum controller about 55 - 60 $.
Step 1: How It Works and What Does It For?
The project has different sides approach. From the one side the idea is not new, but the realization of some parts of the device is unique. May be somebody wants to take some ideas, which I improved here. From another side the project was created as low cost solution for the amateurs. In my country it is so up-to-date, because there are many amateur musicians who wants both to practice the drums and spend little money on it. I made it for my friend. He is a musician. I am electronic engineer and embedded software developer. It wasn’t a difficult task for me, but it took much time.
The drum controller was made of the most popular electronic components, which were bought in the market. Some mechanical components made by myself.
The controller has 16 analog inputs for the piezoelectric sensors and 14 inputs for the discrete triggers on the front panel. I must say that on the scheme and PCB there are 16 inputs for discrete triggers! It is done for functional reserving for the future. The configuration of the discrete and analog channels are fixed by software manner and cannot be changed. In this case, it has no sense about changing of the channels which were determined for the concrete kind and type of the instrument.
On the rear panel are set such electric components as MIDI output connector (see the picture below), 220 Volts connector and power switcher. The device is powering from 220 Volts and can't work without connection to PC. The connection is made via MIDI to USB cable. The cable uses only MIDI input jack for the data transfer between device and PC.
The controller uses standard General MIDI communication protocol with known baud rate as 31250 bits per second.
Step 2: Stuff Needed
There aren’t many hand tools. I don’t want to count instruments there because everybody who’s working with electronics can apply necessary instrument.
I will note the most important moments.
The schematics and PCB’s graphics were created in the Altium Designer software.
The PCBs were made by method as described here https://www.instructables.com/id/developing-PCB/ ,
but you may do it all possible methods as you wish.
Step 3: Making the Drum Controller
The electronic module of the controller consists of two PCBs.
The first board is main and has MCU, power, logic and analog elements.
The second board has only soldered RCA connectors. The RCA connectors are set on the front panel.
Connections between the first and second boards were made by flat cable.
Step 4: Making the Drum Trigger
As it was said above, the channels are separated for the piezoelectric sensors and micro switchers. The piezoelectric sensors are used for the transformation vibration energy into the electric energy. The micro switchers are used for the pedal High Hat and dumping the instruments such as Ride, Splash Cymbal, Crash Cymbal 1, Crash Cymbal 2 and other.
The piezoelectric sensors are fixed on the drum pad and the switchers are fixed on the pedal and on the concrete part of the drum pad.
The piezoelectric sensors were fixed with glue on the steel corner (see picture below). Every steel corner was fixed with two screws to the drum pad. We need to fix it so hard to minimized acoustic wave attenuation. During the long time I couldn’t find appropriate glue. Later, I found the “Lacrysil” rubber glue with the perfect adhesion and strength properties. It is very important moment, because the piezoelectric sensor feels powerful vibration and may break or tear off. The glue was chosen by you should be elastic, too! The piezoelectric sensor was connected via mono microphone cable and fixed with thermo glue and pressure washer (see photos). The cable length was chosen near 1.7 meters for the manual connection all pads which can be set on the different distances. RCA connectors were soldered from the opposite endings of cables.
The micro switchers were connected via mono microphone cable with RCA connectors on the opposite side. The discrete cables which don’t have the micro switchers were done with free endings of wires from the one side and RCA connectors from the another side.
The pads may be a sandwich of wood or something else. I used the piece of particle board for the experimental pads. You should use hard and dense material for to minimize acoustic wave attenuation. Many articles and topics were writing on this theme and so don’t want to go into details.
Step 5: Computer Software and Communications That We Need
I was testing the drum controller on the my notebook, where I installed a few helpful programs. They are FL Studio, Addictive Drums (as VST plugin).
If you want to write program code, you will need to use the list of MIDI messages as on the picture. At the startup you should send to the PC special Yamaha code as on the second picture. There is special SysEx MIDI code of Yamaha for the drum controller emulation. It begins from 0xF0 till 0xF7 and the next code begins from 0xCA till 0x5F. Additionally, according to the MIDI specifications you should send 0xFE message every 300 ms.
The concrete drum instrument matches to the concrete music note on the Yamaha synth keyboard.
I used only the MIDI to USB cable, which bought at the computer shop.
Step 6: Assembling
First of all, I began to assemble the PCBs. I was testing the boards and after put them into the box. I prepared front and rear panels and set electric components there. I soldered electric components to the boards and put all into the box. I choose the box Z15. How does it look like? You may see that at the picture below.
When I was testing main PCB board, the most difficult thing was an adjusting an amplifier to every channel. I might have to adjust the amplifier gain. As you know, the piezoelectric sensor gives a few volts at its contacts when you are applying a strong mechanical vibration. A spectrum of the vibration signal has a floating maximum, which depends on the mechanical construction and fixing the piezoelectric sensor. The piezoelectric sensor crystal has about 4 kHz resonance frequency.
The spectrum frequency and amplitude may change according to the properties of background material and manner of fixing. For these reasons, I set the adjustable resistor in the feedback circuit to every amplifier. The user who will set the triggers on your drum pads may adjust an appropriate gain by a screwdriver. It is so useful!
The next step was the preparing of the piezoelectric sensor. I stuck sensors on the steel corner and was waiting about 36 hours for it to dry. The glue became a little hard after the drying but it remained elastic. The micro switchers were soldered too. After this, I soldered all 30 RCA connectors.
The last step of the assembling was making the experimental drum pads. There are not real drum pads but for the testing, they match very well! I took the particle board, piece of rubber (3 mm thickness) and wood screws. The result of assembling you may see at the photos.
Step 7: Testing
The programming code for this device is difficult. This approach is the main problem because we have many analog channels, which can communicate with some discrete channels and that communication process must be absolutely parallel.
It puts some restrictions on the MCU’s periphery. I used two ADC channels which are sampling with maximum frequency up to 1 MHz. The ADC channels are interrupted every 15 microseconds. The processor’s time is hardly enough for the main cycle executing and sending the MIDI messages. I realized that the STM32F103RET6 microcontroller works with maximum load and doesn’t have a free processor’s time for more complex tasks. It is maximum level of work for this microcontroller. You should use more performance microcontroller if you want to handle more complex tasks with a higher speed.
In the STM32F103 we have 4 channels per one exclusive hardware timer. Since the drummer has two arms and two feet the 4 program events must execute at the same time.
Step 8: Troubleshooting
When I switched on the device and connected piezoelectric sensors via the RCA connectors, I saw that analog channel becomes active if my finger touches to the contacts. It couldn’t be true! I understood that an input impedance of some analog channel was very high and so I added the parallel resistor Rx to the every channel. The problem was solved.
The next problem was a providing of a sound dynamic when you are playing the drums. A more strong kick must have a higher sound level in the MIDI general specification. This level is called as “velocity” and it has fixed number up to 128. I began to calculate the velocity as maximum amplitude of the kick. It didn’t work because the amplitude had a small correlation with the kick force.
After that, I tried another way. I found RMS value of the kick signal and calculated energy of this signal. The energy is the sum of all discrete amplitudes received from ADC.
The energy has strong correlation with the kick force. It is very important state and this helps you to provide a good dynamic response for your drums.
The values of the energy I converted into MIDI velocity levels. You need to calculate the energy from free digital value to normalize form of the MIDI velocity range (to the 128 maximum value). Thus, you will need to receive a graduation of the dynamic range.
The schematic included four 8-channel multiplexers which are switched with 15 us time interval. You need to have some recommendations about the multiplexer commutation. When a channel was switched on, you must wait a little time before enable the ADC converter for the analog channel sampling.
Step 9: Additional
The helpfull documentation that were used by me about MIDI in the archive here.
If you want to ask me about some details of the design you may write here or on my email.
The project's PCBs, schematics and software for the microcontroller I can send to you via email.
Good luck and enjoy!