USB to MIDI

Graham Armitage, Fri May 02 2014, 12:49AM

Hi,

I am still having major problems with the MIDI output from the laptop. The interference from the coil is clearly causing a problem with the USB port, as when the note hangs, the laptop often has to be rebooted to get the USB port to work again. Probably not good for the laptop frown When I have the laptop power cord plugged in the problem is magnified 100x and it won't even play the first note without hanging. I have tried several laptops and same problem. Moving further away definitely helps but even at 20ft it will hang with a ground strike.

From my observations it seems to be the ground on the USB that is picking up the signal and causing the problem. The USB to MIDI cable is shielded but the shield is grounded as is the MIDI controller's metal box. Not sure what else I can do other than a full faraday cage to sit in, but really don't want to have to go to that length. Anyone had any success in overcoming this kind of problem?
Re: USB to MIDI
Steve Conner, Fri May 02 2014, 07:46AM

USB is notoriously sensitive to interference. Try wrapping the USB cable through a large ferrite toroid as many times as it will fit.
Re: USB to MIDI
Graham Armitage, Fri May 02 2014, 12:33PM

Oh boy - can't believe I didn't think of trying that frown Well, I gave it a try this morning and actually had enough cable to wrap around two toroids and ran it at full power from about 10ft and never had a single note hang. Cannot thank you enough - it looks like that did the trick.
Re: USB to MIDI
HV Enthusiast, Fri May 02 2014, 07:58PM

Are you using a fiber optic link to the coil, or copper?
Re: USB to MIDI
Graham Armitage, Fri May 02 2014, 08:03PM

Using fiberoptic from MIDI controller to coil. After Steve's suggestion it's still behaving. Hoping it continues to work.
Re: USB to MIDI
Hydron, Sat May 03 2014, 12:10AM

You're not the only one to run into this - USB uses single ended signalling for a few things on the bus (e.g. bus reset), and is extremely susceptible to common mode noise.

I have seen the same thing on my USB-MIDI converter (these seem particularly bad, probably not helped by the dirt cheap construction and lack of shielding), my scope when running with USB, and also USB-serial converters when doing EMC testing.

I solved the MIDI thing by just moving further away, and the ferrite toroid choke worked somewhat for my scope, though the real answer was switching to ethernet connection. For EMC testing we ended up using real hardware serial ports, which are far superior to the USB imitations in other ways too.
Re: USB to MIDI
Intra, Mon May 05 2014, 05:30AM

I have had same problem. This can runs under grounded Faraday's cage and into it you should put the laptop, midi-usb adapter and interrupter. Between interrupter and coil you should use fiber optic cable.
Re: USB to MIDI
Graham Armitage, Mon May 05 2014, 10:20AM

Faraday cage is ideal but did not want to go to that extent. The two ferrite toroids and moving further away seems to be working really well. I have been doing more testing and still no problem with hanging notes. This is the most stable it's ever been.
Re: USB to MIDI
Goodchild, Mon May 05 2014, 03:39PM

I have had seen amazing improvements after eliminating the USB to MIDI converter. My current working theory is that the non-differential un-shielded MIDI cable between the converter and the DR controller is the largest culprit in picking up noise.

In my latest design I have built a custom USB to MIDI converter right onto the same PCB as the micro running the DR controller software. This way I only have a USB link between the computer and the controller. The ground referenced serial MIDI signal is reduced to only about a half inch of trace onto of a ground plane.

This made a huge improvement, I was able run my old controller right beside the new one and I was able to get the controller almost close enough to arc to the coil without it locking up. The old version of the controller however locked up per usual when it was brought to within about 10 feet of the coil.

USB if used as a standalone link is very noise immune being fully differential, particularly if you run with ferrite chokes. As soon as you add the unshielded ground referenced MIDI into the same cable USB becomes as useless as the MIDI serial, because your link is only as good as the weakest part of the chain.
Re: USB to MIDI
Graham Armitage, Mon May 05 2014, 05:58PM

Thanks Eric, I am using the Mini MIDI/DR controller from Paul Slawinski which does the job. Then between the computer and the controller I have the dreaded USB cable Trying to picture your setup and how it is different from what I am doing?
Re: USB to MIDI
Goodchild, Mon May 05 2014, 11:30PM

Bushman wrote ...

Thanks Eric, I am using the Mini MIDI/DR controller from Paul Slawinski which does the job. Then between the computer and the controller I have the dreaded USB cable Trying to picture your setup and how it is different from what I am doing?

I can not speculate on problems of hardware built by others, however my design has no need for USB to MIDI converters. I plug my controller into the computer via USB directly and it shows up as a HID MIDI device.

The MIDI serial is confined to the PCB inside the metal case making it very noise immune. Only the USB link is external, which being fully differential is not bothered by the coils EMI, I have yet to get this controller to hang.

14138015163 81b38dafa9 Z

As seen above I have two USB ports, one is for MIDI IO the other is for programming/data.


Partly assembled board, for some reason I can't find any photos of a fully assembled board.
14114840482 5075663470 Z

This board also has charge management built onto it for single cell LiPo batteries. Also because this is a fully USB compliant device it can be powered from the USB bus directly, as well as charge LiPos.

The PCB and concept behind this controller I plan to distribute under the share alike non-commercial licence in the future.
14114935492 E21ce1d167 T
Re: USB to MIDI
Graham Armitage, Tue May 06 2014, 12:50AM

Wow - very cool indeed. Thanks for sharing the photos. Does sound like a solid solution and makes a lot of sense. probably the only guaranteed method to solve the problem.
Re: USB to MIDI
Hydron, Tue May 06 2014, 02:14AM

The specific issue with these midi controllers is likely due to poor design, so there are probably other solutions too, but Eric's looks like a particularly classy way to do it.

Note that MIDI inputs should be opto-isolated (no gavlanic connection for either ground or signal) by specification, so no ground loops or anything - the USB-MIDI converter should be able to deal with EMI by clamping any induced voltages, but probably doesn't cos it's cheap chinese made garbage. If done inside the equipment like Eric's then you don't need to worry about any of this, as it doesn't pick up anything anyway.

USB is only mostly differential by the way, there are single ended reset and end-of-packet states (both lines low, see Link2, but when done well should be okay as long as it doesn't get too close. USB definitely causes issues in some circumstances, and is nowhere near as EMI immune as stuff like ethernet, so should always be regarded as suspect when things aren't behaving as expected around a tesla coil.

Edit: Looks like nice work Eric! Looking forward to having a look at the design if/when you release it.
Re: USB to MIDI
Goodchild, Tue May 06 2014, 02:32AM

Hydron wrote ...

The specific issue with these midi controllers is likely due to poor design, so there are probably other solutions too, but Eric's looks like a particularly classy way to do it.

Note that MIDI inputs should be opto-isolated (no gavlanic connection for either ground or signal) by specification, so no ground loops or anything - the USB-MIDI converter should be able to deal with EMI by clamping any induced voltages, but probably doesn't cos it's cheap chinese made garbage. If done inside the equipment like Eric's then you don't need to worry about any of this, as it doesn't pick up anything anyway.

USB is only mostly differential by the way, there are single ended reset and end-of-packet states (both lines low, see Link2, but when done well should be okay as long as it doesn't get too close. USB definitely causes issues in some circumstances, and is nowhere near as EMI immune as stuff like ethernet, so should always be regarded as suspect when things aren't behaving as expected around a tesla coil.

Edit: Looks like nice work Eric! Looking forward to having a look at the design if/when you release it.

Thanks for the kind words!

Part of the problem with those cheapo china made USB-MIDI things is the way they handle termination of the ground and shield on both the USB and the MIDI. I have seen it range from tied together to nothing connected with everything left floating.

USB standards don't really spec any defined way to terminate the shielding on USB slaves, as a result every manufacture handles it differently. I handled it by tying it to chassis ground, while also terminating chassis to DGND in a single location. This keeps the chassis from floating but helps prevent ground loops in the shield/GND line in the USB cable.

In addition filtering is employed on the USB data lines before being fed to the chassis grounded USB transceiver.

EDIT I have always been torn on how to handle the shield with MIDI, because it's data lines should be isolated and your DGND should also tie to chassis in at least one point to prevent a voltage from building up on the chassis. However if this is done, typically this makes your galvanic isolating opto pointless, because USB to MIDI converters typically tie their shield to their local ground.
Re: USB to MIDI
Steve Conner, Tue May 06 2014, 08:00AM

I think optoisolators are pointless for actual galvanic isolation around Tesla coils. Any half decent Tesla coil should be able to induce enough voltage in its surroundings to break an optoisolator down. When I've used them, it's in the way Eric described, with both sides grounded to more or less the same ground. In this configuration the opto basically acts as a sort of common-mode choke, protects sensitive logic from overvoltages, and also strips out high frequency spikes in the differential mode due to its slow response time.
Re: USB to MIDI
Graham Armitage, Sun Feb 15 2015, 10:39PM

I wanted to resurrect this thread as I was still having trouble with the nasty USB MIDI problem. I figured that sending the MIDI signal over ethernet would solve that problem. So I thought I would give it a try. The core of the solution is an ethernet shield on an arduino microprocessor. I hooked up an old wireless router that the arduino connected to via a patch cable. The laptop plays the midi signal via an rtpMIDI port (a virtual ethernet port) that is then sent wireless to the router. So no physical connection between laptop and MIDI controllers.

The arduino code is essentially running AppleMIDI library and when it sees a noteOn command I output the same note to the MIDI port which connects to the regular MIDI controller. Same for a noteOff. Essentially passing the ethernet MIDI stream from the laptop to the hardwired MIDI port. It allows me to run the laptop from anywhere safe via the wifi. There may be more elegant ways to do this, but it works and has eliminated my hanging note problem from the USB connection. Total cost was for an Arduino, ethernet shield, aluminum project box and some LEDs. Code was pretty simple.

One cool benefit is that now I can theoretically operate the coil from anywhere on the LAN, or open it up and play from anywhere in the world smile More geeky than practical.

Hope this provides an alternative to anyone else experiencing similar problems with the USB-MIDI.

Ethernet
Re: USB to MIDI
Goodchild, Tue Feb 17 2015, 02:11PM

Graham Armitage wrote ...

I wanted to resurrect this thread as I was still having trouble with the nasty USB MIDI problem. I figured that sending the MIDI signal over ethernet would solve that problem. So I thought I would give it a try. The core of the solution is an ethernet shield on an arduino microprocessor. I hooked up an old wireless router that the arduino connected to via a patch cable. The laptop plays the midi signal via an rtpMIDI port (a virtual ethernet port) that is then sent wireless to the router. So no physical connection between laptop and MIDI controllers.

The arduino code is essentially running AppleMIDI library and when it sees a noteOn command I output the same note to the MIDI port which connects to the regular MIDI controller. Same for a noteOff. Essentially passing the ethernet MIDI stream from the laptop to the hardwired MIDI port. It allows me to run the laptop from anywhere safe via the wifi. There may be more elegant ways to do this, but it works and has eliminated my hanging note problem from the USB connection. Total cost was for an Arduino, ethernet shield, aluminum project box and some LEDs. Code was pretty simple.

One cool benefit is that now I can theoretically operate the coil from anywhere on the LAN, or open it up and play from anywhere in the world smile More geeky than practical.

Hope this provides an alternative to anyone else experiencing similar problems with the USB-MIDI.

Ethernet



Beware the latency that you will be adding with the Apple MIDI over ethernet protocol. I have used it before and it has a lot of latency.

I still attest to doing direct USB to MIDI in the microprocessor. It's more work upfront, because of the need for a micro that can has USB and the need to write the embedded MIDI USB driver. However it's fare worth the investment in time.
Re: USB to MIDI
Graham Armitage, Tue Feb 17 2015, 08:56PM

I have not noticed much latency at all. As long as the latency is consistent, then a delay between the computer generating the MIDI signal and the Tesla actually playing it, doesn't bother me too much. It could be a problem when splitting channels between audio device and the DR. That could be corrected by adding latency into the audio channels, but it starts getting messy trying to sync the two - been there frown

I definitely do prefer your approach of USB directly to the micro. Maybe I will try that next.