The DIY MIDI Metronome


The metronome: the guiding force of the universe. Well, maybe not, although keeping time with a sequencer is essential for recording good sequences. In many sequencers, and audible click, flashing LED, or  is provided to serve as the metronome. In reality, the click may be noise, or sound like a cannon, or the LED may be non-existent. This is where the DIY MIDI Metronome comes to the rescue.

Look Ma, No Batteries!

The DIY MIDI Metronome is a simple, inexpensive, easy-to-build, and guilt-free project. The metronome requires no batteries; it "steals" its power directly from the MIDI device that it is plugged into. The schematic in Figure 1 shows just how simple the metronome is. Pin 4 of the MIDI In connector supplies 5 volts to the circuit. This is pulled up to 5 volts (through a resistor) in the MIDI device connected to the metronome. The metronome only draws about 1 milliamp of current, a tiny amount compared to the MIDI input of a normal MIDI device.

[Metronome Schematic]

The brains of the project is a tiny microprocessor, made by Microchip Technologies, called the PIC16C54. A short machine-language program gives instructions to read and process MIDI data and to flash the LED. This program is "blown" into the chip. Many EPROM programmers can program the PIC16C54. If you have access to such a programmer, you can download the hex file and program the chip yourself. Otherwise, a fully programmed chip can be ordered here.

A crystal provides the necessary timing signal to operate the microprocessor. A bi-color LED is connected between two output pins. This kind of LED glows red (or some color) when current flows one direction, and green (or some other color) when current flows in the opposite direction. The MIDI Metronome flashes the LED red by pulling one output low and the other output high. Green light is produced when the outputs are reversed.

Here are the parts you'll need to build the project. Most of these parts are available from electronics distributors such as Digi-Key, Marshall Electronics, Jameco, B.G. Micro, and others.

Table 1. Parts List

Qty Part Number Description Reference Des.
1 PIC16C54-XT/P Microprocessor, Microchip U1
1 2N2222A Transistor, NPN Q1
1 Crystal, 4 MHz X1
1 Bi-color LED D1
2 Resistor, 4.7K, 1/8W R1, R3
1 Resistor, 750 ohm, 1/8W R2
2 Cap, 27pF, Cer. C1, C2
1 Cap, 22uF, 16V, Elect. C3
1 Dip switch, 4 position SW1
1 Connector, DIN, 5 pin, 180 Deg., PCB mount P1
1 18 pin dip socket for U1

MIDI Clocks

MIDI Clocks (0xF8) are generated by any device that can be a master of tempo. Sequencers, drum machines, and tape sync readers are all examples of tempo masters. These devices merge MIDI Clocks into the outgoing MIDI stream, at 24 clocks for every quarter note. For example, at 100 beats per minute, 2400 MIDI clocks per minute (or 40 clocks per second) are sent.

The DIY MIDI Metronome works by reading the MIDI information that is being sent and ignoring everything except MIDI Clocks (0xF8), Start (0xFA), Stop (0xFC), and Continue (0xFB) commands. Start commands tell the metronome that "one" will be the first beat, starting at the next Clock. Reception of a MIDI Stop will make the metronome ignore clocks until the next Start or Continue command. Thus the task of the metronome is simple: read the incoming MIDI data and flash the LED every 24 clocks.

When connected to a source of MIDI Clocks, the MIDI Metronome will count off time by flashing an LED, red on the first beat (one) and green on all the other beats of the measure. Values from 1 to 16 beats per measure are selected using a four-position DIP switch.

Table 2. Metronome Meter settings
(0 = switch closed, 1 = switch open)

Beats/Measure SW1
4321
1 0000
2 0001
3 0010
4 0011
5 0100
6 0101
7 0110
8 0111
9 1000
10 1001
11 1010
12 1011
13 1100
14 1101
15 1110
16 1111

Construction

Construction of the DIY MIDI Metronome is simple. Use point-to-point wiring on a perf board. Don't omit the socket for the microprocessor, and be sure to keep all leads short and neat. A chassis mount or PCB mount MIDI connector can be used, or you can cut the end off a spare MIDI cable and wire the cable directly to the metronome. Make sure not to swap pins 4 and 5 when you connect the cable.

The DIY MIDI Metronome can be made as small or as large as you wish. A 35mm film can or small plastic project box is ideal to house your metronome.

Once you are sure that you've correctly wired the project (you did double-check your work, didn't you?) connect it to the MIDI output connector of a sequencer or drum machine. Note that many sequencers and drum machines do not send MIDI Clocks by default. Check the settings on the device and make sure that MIDI Clocks are enabled. Set the DIP switch on the metronome to 4 beats per measure. (See Table 2). Start the sequencer playing; the metronome should be flashing red, green, green, green, red, green, green, etc. If not, recheck your wiring. Measure the voltage between pin 5 (ground) and pin 14 (power) of the PIC16C54. It should read approximately 5 volts (positive). Double check to be sure that pins 4 and 5 are not swapped on the MIDI input connector.

For the more adventurous, there is a "Flash" output from the metronome that can be used to activate external devices such as flash strobes or buzzers. The transistor, Q1, provides a low pulse at the start of each beat and serves as isolation between the metronome and your external circuit.

Happy Counting!

The DIY MIDI Metronome is a perfect first project. It can provide a much-needed visual metronome function or serve as a basis for larger projects. And it's just good clean fun.

Article, source code, and PIC16C54 firmware are Copyright (c) Paul Messick, 1992, 1998.