I want to generate music/sounds for a video game I am making with my son (using an Arduino Mega and a 240x320 LCD graphical display). I have a basic understanding of the MIDI protocol. I've been a computer programmer for over 30 years. I read the MIDI implementation in the DSP-G1 manual, but I don't understand how to go from this to sending the right signals from the dev board to the chip pins.

Everything I find is about connecting a physical MIDI device. Can anyone possibly provide or point me to information on how to control the DSP-G1 programmatically/electronically? I think I need some hardware or software to serialize MIDI protocol bytes into a sequence of voltage changes, but all my searching leads me to info about a physical device.

enter image description here

  • You've got the wrong side of the circuit, you want a midi out circuit. Apr 8 '18 at 3:09
  • @ChrisStratton No, he wants to know how to replace this circuit when not using the electrical MIDI protocol.
    – CL.
    Apr 8 '18 at 6:27
  • @CL. that would be off topic for an Arduino site and also wouldn't really make any sense, since an Arduino could readily be made to drive that with a transistor. Much better to plug into the gear by the existing connector than to modify it. Apr 8 '18 at 6:31

The purpose of the MIDI output circuit is to convert the TTL signal into a 5 mA current.
The purpose of the MIDI input circuit is to convert the current back into a TTL signal.

If the Arduino and the DSP-G1 are part of the same circuit (and share the ground), you can omit these conversions, and connect the Arduino's TX directly to the LPC810's RX, without any other components needed. (The LPC810 requires a 3.3 V power supply, but its RX pin is 5 V tolerant.)

MIDI was designed to work with most microcontrollers, so it uses standard UART signals at 31250 baud. The only configuration you need is:

  • Yes, you understand what I am trying to do. Sometimes a simple thing is harder to find than a more complex one. So to confirm my understanding, I need to use the Serial methods, in particular Serial.begin(31250), followed by a series of Serial.write() calls to send a stream of bytes the same as I would write to a file, per the MIDI file format, e.g., csie.ntu.edu.tw/~r92092/ref/midi
    – Gary G
    Apr 8 '18 at 15:18
  • And it seems this will automatically go to TX0 (pin 1) on an UNO. Any need to do anything with pinMode()? What if I wanted to use TX1 on a MEGA? Thanks for your help!
    – Gary G
    Apr 8 '18 at 15:21
  • And I would have no need of the optocoupler, correct?
    – Gary G
    Apr 8 '18 at 15:23
  • What is sent over a MIDI cable is not a MIDI file, but only the actual MIDI events/messages. There are no timestamps; bytes are sent in real time. See the actual MIDI specification.
    – CL.
    Apr 8 '18 at 20:11
  • Serial goes to the first UART; the others are Serial1, Serial2, etc.
    – CL.
    Apr 8 '18 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.