Someone has recently asked me whether it is possible to deal with MMC messages in Arduino. In particular, an output pin should be high after the Arduino has received a PLAY message, and low after a STOP message. There should also be an inverted pin that does the opposite logic (low upon PLAY, high upon STOP).
MMC Play and Stop Commands
Let's have a look at the MMC commands for play and stop. Each MMC message takes the form of:
F0 7F deviceID 06 command F7
where deviceID is a number between 0 and 127 (with 127 being a blanket call ID) and command relating to a byte from the following list. This fifth byte determines which command it is that is being received.
03 Deferred Play
04 Fast Forward
06 Record Strobe (Punch In)
07 Record Exit (Punch out)
08 Record Ready
0F MMC Reset
44 Locate/Go to
So, in other words, if the Arduino receives the byte sequence: F0 7F 00 06 02 F7, then this indicates an MMC play command. If the 02 is 01, the command is stop.
You will need:
• 1 x 220Ω resistor
• 1 x 110kΩ resistor
• 1 x 3.3kΩ resistor
• 1 x 1n4148 diode
• 1 x 4n25 optocoupler
• 1 x Arduino board or Freeduino (et al) equivalent
• 1 x 5 pin din MIDI connector
Connect pin 4 of the MIDI connector to one end of the 220Ω resistor. Connector the other end of the 220Ω resistor to pin 1 of the 4n25. Connect pin 5 of the MIDI connector to pin 2 of the 4n25. Connect the 1n4148 diode between pins 1 and 2 of the 4n25, with the marking going towards pin 1. Connect pin 6 of the 4n25 to ground via the 110kΩ resistor. Connect pin 5 of the 4n25 to 5V via the 3.3kΩ resistor. Connect pin 4 of the 4n25 to ground. Connect Arduino RX (pin 0) to 4n25 pin 5.
A few notes:
• MIDI pin 4 might be MIDI pin 5 and vice versa, I can't remember.
• You might like to add a 10uF and a 0.1uF capacitor between ground and 5V
• You might not need the 220Ω resistor.
• Arduino Pin 2 is the normal output pin
• Arduino Pin 3 is the inverted logic output pin
The Arduino code has not been tested, but should work (maybe?). I am not currently in a position to be able to test this code, but I will do so once I get a chance.
Download it here: http://milkcrate.com.au/_other/downloads/projects/MMC/MIDI_MMC.txt