[sdiy] Detecting the presence of a receiving MIDI device through current sensing
Didrik Madheden
nitro2k01 at gmail.com
Tue Jan 28 14:01:52 CET 2020
On Tue, 28 Jan 2020 at 07:55, <rsdio at audiobanshee.com> wrote:
> I’m a big fan of D/A chips that convert to current rather than voltage. They have weighted current sources, each producing half the current of the previous bit. You simply feed the digital value in parallel, and the current sources are combined to produce the correct total current according to the digital value. What I find to be really neat is that all of the bits that are “off” are actually just switched to an inverted output, rather than trying to turn off the current. You then have both the normal and the inverted signal and can combine them with a differential operational amplifier stage. This differential output from the D/A converter ends up producing a lot less noise than a single-ended converter. Another benefit of this design is that the D/A converters can run at rates like 125 MHz. Yeah, that’s 125 MHz, not just 125 kHz.
>
Sounds interesting. Reminds me of the R2R DAC topology, but arranged
differently. Do you have any part numbers?
> Getting back to your idea, I have a couple of points.
>
> First, MIDI is not 1 mA to 5 mA. Instead, it’s defined specifically as a 5 mA loop. That’s a nominal value, so it doesn’t have to be perfect, but the specification is not a range but a set value. You need to send enough current to fully engage the optoisolator LED emitter. Sending one-fifth the current is likely to cause issues with some MIDI devices. Granted, the MIDI Specification requires that the optoisolator must turn on with less than 5 mA, but it doesn’t allow the transmitter to produce less than 5 mA by design.
>
I know we're same page because you go onto quote real world values,
but I take issue with the last sentence. In the end, the circuit is
defined by the suggested resistor and diode values, combined with a 5
V supply, which becomes the compliance voltage of the system. Just to
construct an absurd example, consider that you would for some stupid
reason connect a 100k resistor across the current loop pins instead of
a typical optocoupler circuit. A MIDI transmitting circuit is in no
way obligated to provide a 500 V output just to pay lip service to the
5 mA figure. :)
5 mA is what the transmitter should always guarantee to be able to
output, but since this is an ugly hack, you're depending on whatever
is connected on the other side. So I tried to to define a worst case,
conservative figure. With the PC-900 and 6N138 figure in mind though,
that gives a little more headroom, and 3.5 mA might be a viable
threshold.
> That said, you will need to allow for quite a bit of variation. You can alleviate some of that by using a precision 5 V reference and 0.1% resistors.
I'm not sure what this would actually add, though. To me it seems it
would just add another restriction by requiring a high precision part.
What I'm proposing is that the most useful way to define the threshold
is in terms of a ratio of the system Vcc, for example 0.98*Vcc, or
slightly lower factor if you can afford more headroom. The beauty of
doing it this way is that it actually doesn't matter of if Vcc is a
little bit out of tolerance, whether that's 4.9 V or 5.1 V. You're
looking for either spot on Vcc, or a certain voltage drop below Vcc.
Only for very big excursions would the diode drop component dominate
so much that a ratio of Vcc would no longer be a good approximation.
But the voltage divider guarantees that the detection threshold is
smaller than Vcc, and that's all you really need, assuming you get the
ratio right in the middle between Vcc and the voltage produced by the
circuit..
> Patent this quickly, because you’ve already published...
IANAL, and I know you're probably joking, but as far as I understand,
I've forfeited my right to a patent by publishing the details here
(semi-)publicly. On the other hand, this conversation would also
likely serve as prior art, invalidating any other patent filings of
the same idea. Not that I think the idea is valuable enough to patent
in the first place. I'd rather it stay unpatented and unpatentable,
and used by whoever wants to use it.
--
/Didrik
More information about the Synth-diy
mailing list