After days spent trying to find reliable ways to get Midi data from the pedal board to the computer, and more days trying to get data from the computer to the pedal board, the proverbial shovel finally hit me square in the face. This is what happened:
The PU-1 is using an Arduino to process signals from its pedals and switches. Since I wanted to send data to the computer for more interaction, I hacked a USB-Midi dongle to receive Midi data from the Arduino’s TX (transmit) pin. It worked quite well, but would be susceptible to the intermittent bug, where the communication would seem to be out of phase and it would only send invalid Midi data.
Then, it was time to receive Midi data from the computer. The goal here is to allow the computer to control, live, the equipment linked to the pedal board. The general idea was to get Midi commands from the USB-Midi dongle. The problem I had (many days), was to design a system that would receive the Midi signal and use an opto-isolator to follow the midi.org recommendations. Right from the get-go, I erred by forgetting to use the opto-isolator. I then decided to use the Midi breakout board that I have, with an unhacked USB-Midi dongle. It worked perfectly! So I figured my hacked dongle was broken.
The whole idea is to send digital data from the Arduino to the USB port of the computer in such a way that the computer receives Midi data. The other way around, I want to send midi data to a USB port and let the Arduino read it. Using the dongle, I have to add a pile of electronics to the (apparently) simple data path. So, I took a look at the USB-Midi dongle again: Apart from the opto-isolator and a bunch of capacitor, resistors and one or two transistors/logic inverters, the only important piece of hardware there is a chip (IC). The IC is an MFM0860. According to one manufacturer, this chip will (their words, not mine…):
Key Specifications/Special Features:
- 1, full-speed USB device interface, compatible with USB20. Norms. External components, only crystals and capacitors.
- 2, providing 16 Midi input channels and 16 output channels Midi.
- 3, in line with the relevant specifications, the computer terminal without having to install drivers windows2000/XP below can be used directly.
- 4, input / output in line with TTL level, can be directly connected to Microcontroller, support plus optical coupling for transmission.
- 5, using lead-free SSOP-20 package, ROHS.
- 6, supports all types of organ market
So, this is when the shovel hit. Beside the fact that it “supports all types of organ”(?!), the inputs and outputs are TTL. Mmmmhh. What if I could connect to the “TTL”before the signal had to go through the “midi” part of the dongle?
At risk here was a perfectly good Arduino and a USB-Midi dongle. The Arduino is extremely resistant to electrical abuse. It’s made that way. I wasn’t so certain about the dongle. But I paid $6 for it and I figured… what the hell, let’s do it for science! Besides, let’s think about the connections: the dongle is connected to the computer using USB. It is safe to assume that it uses 5 volts, and the IC is 5 volts too, since I could not find anything that looked like a voltage divider. Because it’s TTL compatible, it is doubly safe to assume it works on 5 volts internally. The dongle is also connected to the Arduino. In fact, I use the dongle to power the Arduino, which gets its 5 volts from the USB power bypass I incorporated in the dongle.
I started with a simple Arduino sketch that sends a midi command through its TX pin (pin 2) when I press a button. I then started to touch the dongle at different points with a wire linked to the TX pin. I started from the “IN” connector inward. At some point, the dongle started transmitting data to the computer. Midi data. Yeah!
I then used a small program on the computer to send Midi data to that USB port. I started touching different points on the “OUT” side of the dongle with a cable connected to the RX pin of the Arduino. I found several points sending nicely formatted Midi commands. Yeah!
All I needed was to solder short jumpers to the pins of the Arduino. As an added benefit, the Midi INPUT and OUTPUT of the dongle are still operational and can (will) be used to connect to standard midi equipment.
Here’s a closeup of the finished modification:
By the way, here’s the schematic for this dongle (or a very similar one)(Thanks Gerry!):
and the whole datasheet (in Chinese): MFM0860 USB MIDI