Trigger To Midi Interface
I designed this unit after looking at a few other designs on the web. I decided to use an Atmel AVR microcontroller because I had used them before and the free tools are very good. MUCH better than the PIC microcontrollers IMHO.
The cost of the trigger unit should be < $100, much less if you have a well stocked junk box. The most expensive parts are the ATMEGA8 microcontroller ( ~$8 from Digikey) and the 2 line by 24 char LCD module which you should be able to find for ~$10 surplus (try BG Micro), and the enclosure. I built mine using wirewrap on a 4" by 6" protoboard. It uses a 12V wall wart for power which is regulated to 5V on the board. Sorry, I don't have a PCB layout for it.
Schematic (large image - takes a while to load)
Software
As of December 2002 the software is almost complete - at least as far as I'm concerned. If somebody desperately wants a preprogrammed microcontroller I might be convinced to do this for $25 or so to cover my time and costs of sourcing and programming parts.
I'm releasing the C source as freeware. email me:
![]()
Software To do list:
- more velocity tables - find out some other ones that are used. Log seems the most useful so far.
- midi sysex dump/receive. Nice to be able to store patches and edit on PC. Have to come up with a compact patch format that hopefully won't change. Include a patch name so you can name a patch and send it to the unit for storage. Really hard to handle naming patches with 3 button input !
- more ROM patches
- save/recall patches from eeprom. Nice if this was more or less seamless with rom patches. Give them generic names "User patch 1" etc which can be replaced by using sysex up/download & store
- could add individual "per trigger" values eg trigger threshold. vs the global ones in use now. Not that hard to do and there is lots of free ram on the microcontroller for additional variables. Some of these eg trigger threshold could be stored in eeprom and loaded on power up since they are values that won't change much after you set your kit up.
- doesn't implement "false trigger filter" parameters yet. In the Alesis D4 for example they dynamically tweek trigger thresholds so a hard hit on one pad won't trigger others. I've thought of how to do it and its not that hard to add to the code but would require a lot of experimentation to get it right. I avoided the whole issue with my setup by mechnically isolating the pads - I'm not trying to re-engineer a D4 !
Trigger to Midi Unit Documentation
Overview
The module is designed to take analog piezo trigger inputs of approx 1-5 volts peak and convert these into midi note on/off messages. It is intended to be connected to a MIDI sound module of some kind. I use a PC with a sound card the Sound Blaster Live is a great choice because it has good fidelity and there are lots of soundfonts available for it. I also found a great freeware program called RRAMM DRRUMM that will work with any old sound card and uses WAV files for the drum sounds.
Inputs:
I use RCA jacks for the trigger inputs because they are cheap and compact. The trigger inputs will accept voltages of approx 0-10 volts peak, and have 100k pots for attenuating larger inputs. Be aware that a large input signal > 5v could damage the LM324 opamp inputs so its wise to measure the input level and use the attenuator if needed. The trigger filter circuit is a simple halfwave recifier and RC filter that I saw on the PAIA web site. The filter is buffered by an LM324 opamp configured as a voltage follower. The trigger buffers are multiplexed by two 4051 analog muxes into the microcontroller A/D (channel 5). The A/D converter range is 0-5V but the LM324 outputs only swing up to about 4v max. The converter reference is 5V so Im not using the full A/D range but for this application its not that critical.
The design currently has 12 piezo inputs and two digital/analog inputs. The D/A inputs use 1/8 stereo plugs. Tip goes to a 324 voltage follower and into a/d inputs ch 14 & 15. Tip has a 10k pullup to 5 volts which is intended for use with switches (ie hihat switch). The ring is connected to a 1K pullup. This is meant to be used with optical sensors to power the IR led. The D/A inputs are sampled by the microcontroller A/D so they can be used as binary (switch) inputs or analog inputs like an expression pedal. Note that an analog input device must not exceed 0-5V in order not to damage the opamps and you may need to remove the 10k pullup if it is being driven by a high impedance device like a pot.
Front Panel
The unit has a 2 line by 24 character LCD display as the main user interface. There is a power led and a data led which is driven directly from the MIDI data line, so its easy to see MIDI out traffic. Three pushbutton switches are used as input devices UP, DOWN and ENTER.
MIDI I/O
Has MIDI in and MIDI out, opto coupler on MIDI in.
Software
The brain of the device is an ATMEL 90S series microcontroller. I started with the AT90S4433 but it was clear the 4K of code and 128bytes of ram was not enough, at least for a C language implementation. I upgraded to the MEGA8 which has 8k code space and 1K ram. It looks like it will be more than adequate for the job since Im just over 4K and most features are implemented. This device is really nice 16mhz (Im only running 8mhz), six 10 bit A/Ds, several timers, UART etc. It was clear that 6 A/D inputs would not be enough so I used external CD4051 multiplexers to get 16 inputs. In hindsight I should have used a 40 pin device since they are available with up to 128K flash rom.
Code is written in C. I used GCCAVR (V 3.2 ?) which is available for free and developed it using AVR Studio 3.52 which is a free download from ATMEL. Terrific tools for the price ! I observed some strange behavior a couple of times which I attributed to bugs in the compiler. Rewriting the suspect code in a different way fixed the problems.
As of 12/1/2002 basic functions work. Scans 12 trigger inputs and outputs midi note on messages when trigger pulse is detected. Sends midi note off messages (actually a note on message with volume 0) when an input is retriggered or after 3 seconds, which is long enough for most percussion sounds to decay.
Assigning Notes to Trigger Inputs
The unit powers up with default settings for the note assignments, hihat channel etc, but these can be changed easily.
Simplistic method of selecting MIDI notes for each trigger channel is to hold the UP or DOWN button and trigger the channel (ie hit the pad with a drumstick). It will step the note value up or down and play the note.
The display will show the trigger input number and the note that is currently assigned.
Simple, but it works really well. You just hold the button and bang away on the pad til you hear the sound you want !
HiHat Switch Input
One of the two digital/analog inputs is used for the hihat switch. The switch should be wired between tip (10k pullup to 5V) and the ground ring of the 1/8 jack. The function of the switch is to change the MIDI note sent for one the trigger inputs. Eg you assign one of the inputs as the Hihat input using the menu system (described below). When that input is triggered, an "open hat" note will be played if the switch is open and a "closed hat" note will be played when the switch is closed.
Ive arbitrarily decided that the last trigger (11) is the power up default as the hihat pad input, but this is easily modified via the menu.
You assign the MIDI notes for the hihat as described above. To assign the "closed hat" sound, close the hat switch, press the UP or DOWN button and trigger the input and the unit will step the note value up or down and sound the note so you can hear the selection. The display will indicate that you are assigning the Open Hat or Closed Hat and the MIDI note number assigned.
MIDI Controller Input
The second digital/analog input is used as a midi controller input. The controller does not change any parameters in the trigger unit -it sends midi control change messages to your midi sound module. This input can be connected to any device e.g. a footpedal that generates approximately 0-5V output do not exceed this or you will damage the opamp input buffer. As the input voltage changes the device outputs controller messages in the range of 0 (0 volts) to 127 (approx 5 volts). The controller number defaults to 4 (pedal controller) but can be set via the menu to any value from 0 to 127. You can for example control the master volume of your sound module (assuming it responds to control change messages) by setting the controller number to 7.
Menu system
Pressing the ENTER button brings up a parameter selection menu. Select a parameter to edit by scrolling thru the parameters with the UP and DOWN buttons. When you have selected the parameter of interest pressing the ENTER key again shows the current value of the parameter on the display and allows you to scroll the values using the UP and DOWN buttons. When the desired value is on screen, pressing the ENTER button sets the parameter to that value and exits back to "Play" mode. Parameters that can be edited:
Midi channel all midi traffic is sent on this channel
Hihat trigger input select which of the 12 inputs (0-11) is the hihat trigger. The hihat switch will toggle this trigger between the open (switch open) and closed (switch closed) hat sounds. Note you can assign these sounds to whatever you want but its intended for hihat sounds. When the switch closes it will send out a midi note off message on this channel to mute any open hithat sound that might be playing. To disable this function, assign the hihat trigger input as input 12, which does not physically exist. Or you can just unplug the switch !
Velocity table (linear or log)
Note off time by default a MIDI "note off" message is sent three seconds after the "note on" message when an input is triggered. You must do this or another MIDI "note on" message for the same note will not sound. This parameter can be set from .1 second (could be useful to silence sounds for a choppy effect) to 25.5 seconds in .1 second increments. Longer delays can be useful when playing non percussive sounds to get a longer sustain time.
Note that if the note is retriggered in less than the note off time you have to send a "note off" message before you send another "note on" message to get a midi note to sound. There is a fairly large buffer for the MIDI out messages because if you quickly trigger/retrigger a lot of inputs the device has to spit out a LOT of note off/note on messages.
Load Patch loads one of the built in ROM patches (3 to date)
Controller # - allows you to change the midi controller number from 0 to 127.
The menu system is a little crude but OK for my purposes. While editing parameters the trigger inputs dont work its very tricky to handle a user interface and scan the inputs at the same time without some kind of realtime O/S and I dont want to get that complicated. If you dont enter anything on the buttons for 10 seconds it times out and goes back to play mode. I implemented an auto repeat on the buttons which is helpful if you are trying to change the note off timer for example (255 settings !)
Pictures:
Front Panel - 2 x 24 LCD, power and MIDI data leds, 3 small pushbuttons on right

Note the picture below shows 8 piezo inputs (6 implemented) but it has since been upgraded to 12

Insides below - not much to it
