[sdiy] Detecting the presence of a receiving MIDI device through current sensing

MTG grant at musictechnologiesgroup.com
Tue Jan 28 05:25:38 CET 2020


I like the last bit, the sensing. Certainly there will be current flow 
and voltage drop if anyone is attached.  The bit at the beginning about 
"constant" current flow ... seems to me you'd be adding edges from the 
circuit that is active while the MIDI one is not, so that introduces 
it's own issues. But it's all quite clever. I like it.

I saw a Yamaha memory expansion that came with it's own battery-backed 
SRAM (separate from the synth's native battery-backed SRAM). Having seen 
inside a few PIN-pads and their tendency to "self-destruct" upon 
tampering I was thinking this expansion utilized executable code in the 
added battery-backed SRAM. Devious! It didn't turn out to be that, but 
one's paranoia gets the mind thinking...

GB

On 1/27/2020 8:07 PM, Didrik Madheden wrote:
> I had an idle thought about reducing power rail interference in audio
> circuits by equalizing the currents that any given part of the circuit
> draws at any given time. For example, a MIDI transmitter may use up to
> 5 mA when transmitting. If the circuit was also set to dump 5 mA into
> a dummy resistor whenever it was NOT transmitting, that part of the
> circuit would always draw exactly 5 mA, and no interference would be
> injected into the power lines due to changes in load. Then I realized
> that different MIDI implementations might draw slightly different
> amounts of current depending on which optocoupler it's using, not to
> mention what would happen if no MIDI device was connected, in which
> case the circuit itself would inject the exact same amount of analog
> noise it was supposed to prevent...
> 
> This is an absolutely silly consideration. At least in this context.
> In secure digital devices, power analysis is actually a field of
> security research, where digital devices have secrets that are never
> supposed to leave the chip, but which can be recovered by measuring
> fluctuations in current consumption due to different parts of the CPU
> causing different amounts of power use. I've also once made a Gameboy
> program that plays audio through power line interference by purposely
> turning on and off the CPU's power save mode in well timed sequence.
> 
> But I digress. Normally, this is where my train of thought would end,
> and I would go think about something else. This time, however I
> remembered the discussions on this list about MIDI running status woes
> where a device may get unconnected and reconnected. So I thought, hmm,
> could the idea discussed above actually be useful?
> 
> Consider this: 5 pin MIDI is a 1-5 mA current loop that typically goes
> through a 1.6 V optocoupler and three 220 ohm resistors. So, by
> sensing the voltage after the 220 ohm resistor on the +5 V line, you
> could deduce whether a device is present on the other side. If nothing
> is connected, you're just seeing +5V through a 220 ohm resistor, which
> should be close to rock solid. If it's transmitting, by Ohm's law
> there will be at least a V=I*R=0.001*220=0.22 V voltage drop while
> transmitting a byte. With a bit of margin, you could detect anything
> below 4.9 V as the presence of another device. You could for example
> detect this by sampling the voltage with an ADC in a suitable moment.
> Or, you could use a comparator with one input set to a 0.98*Vcc
> voltage divider.
> 
> A good time to check this would be when sending active sense commands,
> which are meant for exactly this thing, just not exactly like this.
> 
> This approach would have several downsides. It can't detect if a
> device has been powered off but is still connected. It can't detect
> anything about thru-connected devices. It would probably fail to
> produce any useful information on non-powered MIDI splitter devices.
> 
> What it *could* do, is to provide a basic heuristic for when a
> transmitting device might suitably need to refresh the status byte, as
> well as potentially resend CC's. Something that would nominally not
> hurt anyway.
> 
> It's silly. It's crazy. But has something like this ever been done to
> anyone's knowledge?
> 



More information about the Synth-diy mailing list