Midi to Trigger Interface

Low cost, low part count Midi to Trigger interface with 10 Outputs.

This Midi to Trigger interface generates a TTL (5V) trigger signal per note over a range of ten notes. It can be used for example as a midi interface for vintage drum-expanders or as a multiple-trigger generator for a modular synthesizer. I developed this module in order to modify my Tama TS305.

I took the deliberate choice not to add more trigger outputs since I wanted to keep the part count low and I really did not have the requirement for more outs. A module with more outputs would of course be possible as well f.ex. by using shift registers and of course another firmware.


The circuit is based around a PIC16F628A microcontroller running at 20MHz and only requires a crystal, an optocoupler and a couple of resistors to make it working. The circuit is running on a 5V supply, but here I added a 5V regulator in order to hook it up to the +15V supply of my Tama TS305. The trigger outputs are not buffered, so they provide as much current as the PIC allows, check the PIC16F628A datasheet for more details on this. If you require more current, you could possibly add some low current relays or a transistor driver circuit to each output. The trigger remains in it’s on state during the total time of the note keypress and the 10 outputs can of course be switched on simultaneously, which means the module is polyphonic.

I’ve built the prototype on breadboard, if you route a PCB from the schematics please let me know, I’d be glad to add it here!

Tama TS305 Midi to Trigger Interface


At power up, the activity LED flashes a couple of times in order to show that the code is running. When the learn button is pressed, the LED lights up continuously and the module waits for a first valid midi note message to arrive. Once a note has been sent from the controlling device (a keyboard key has been pressed) the midi trigger interface’s activity led will start flashing in order to show that a midi channel and the root note has been learned and stored to eeprom. After this procedure, the module is ready to receive midi key note data and the LED will flash each time a note is received. Note that the module will only respond to Midi note data up to ten notes from the learned root note, all other messages (under root note or above root note +10) will be ignored.

At each power up, the module will reload it’s last midi channel and root note value.

A new channel can be learned as often as required.

TS 305 Midi Input/ Channel Learn Button/ Midi Activity Led


The code for the midi-trigger interface is written in MPASM assembler for PIC microcontrollers.

Code description:

Besides the in/out ports configuration, the code is divided in two main loops, one for midi note processing and another loop for the midi note and root note learn function.

Note processing loop:

The USART input register is constantly polled until a sequence of 3 valid midi bytes have been received. Valid means that the midi channel from the incoming midi message corresponds to the midi channel loaded from eeprom memory in a previous step. Once the complete message has been received, the root note offset is applied to the midi note value byte and then translated into it’s corresponding output register format, after which the port outputs are set or reset.

In depth information on midi message specifications: http://www.midi.org

Output Example: Midi Note Value: 0x07 results in following pattern(10 Outs): 00 10000000  and is mapped to the ports as following (with root note offset set to 0) :
PortA: 0b00000000
PortB: 0b00100000

Of course, values out of the 10 bit out register range are ignored. Take a look at the code for further details, the comments should give you enough info on how it works.

Here a table with all the mappings: (root note set to C0)

Midi channel and root note learn loop:

The midi channel and root note learn loop works in a similar way as above, only that here, after receival of a valid midi message, the channel and root note get stored into eeprom memory, after which the pointer jumps back into normal operation, ie. polling for midi messages.

Firmware & Schematics download: here

You are allowed to use this code for your own NON-COMMERCIAL and DIY applications. If you re-use the code or modify it, please be so respectful to mention the original source when you publish it!

Some more pictures on the prototype build:

This slideshow requires JavaScript.

%d bloggers like this: