The MIDI Beat Clock flasher is a box that receives MIDI clock and drives 2 MOSFET driven outputs (good for a couple of amps) at 12 volts, with internal power supply.
There are 2 outputs, in 4/4 time they flash in sequence of 1 (2-3-4) where the brackets are the second output.
The chips can be ATTiny2313 or 4313. The latter is the same chip just has more memory. We don’t need it because the code is optimised for the 2313. The reason for this chip is because it contains a UART (Serial port)
This project is fully open source, all files are available for download here.
In order: KiCAD project file, PCB Fabrication (Gerber) files, Source code to load via Arduino.
MIDI beat clock is 24 pulses per quarter note, so to count the beats we count up to 24 then increment the beat by 1.
To control the LEDs however we want a 50% duty cycle (on for half the time, off for the other half), so we turn it on at the start of the clock cycle (0) then turn it off when we get to 12.
The outputs are driven by direct port manipulation using an array. So it could be modified to run 4 LEDs by changing this array to 1,2,4,8 as commented in the code.
Keeping in sync
The Midi Beat Clock Flasher relies on the start and stop command of the MIDI. We ignore the ‘Continue’ command as this just gets too complicated and from testing my synths tend to ignore this too.
There is a counter that runs on the chip and if no MIDI is received but the start command has been sent. It assumes a problem and stops, flashing the stop LED as an error.
Secondly if we detect a clock but haven’t got the start command. We therefore assume the cable has just been plugged in and go to error state, as we’re out of sync.
So the software relies on the START and STOP commands aswell as the CLOCK pulse.