12

I have a Pi 3b+ in a MIDI foot controller and part of the I/O is a pair of expression pedal sockets. After, ahem, getting the tip and sleeve round the wrong way, they are working correctly now.

But, during testing, I disconnected one while the system was powered up and it shorted out the Pi, which is now dead. The circuit feeds 3.3 V to the ring, which is connected to the pedal potentiometer, and measures the voltage off the tip (connected to the pot's wiper). When the pedal is disconnected, the plug temporarily shorts the ring (3.3 V) to ground. So I added a 150 Ω resistor on the 3.3 V supply wire. But I don't know if that's enough, and I'm not game enough to try it without being fairly certain I won't destroy another Pi.

Is a current limiting resistor enough? If so, what value is "enough"?

Or do I need something more complicated to protect the Pi?

I don't know exactly how long the short lasts for, but it's well less than a second in practice.

Note: The circuit has an switch in the socket, so I can add a little bit of extra resistance when the jack is plugged in. That way, I can detect the "unplugged" state (ADC reads full 3.3 V) and max plugged voltage 3.1 V as separate states.

  • I see the EE guys use 330R. I sometimes use 470R, and if I want to play safe 520R. – tlfong01 Feb 12 at 5:13
  • 1
    @tlfong01 Ok sounds like a need a slightly higher value. Still would like to know what the "proper" solution to something like this is. – fret Feb 12 at 6:27
  • OK, so we have agreed on the current limiting resistor value. Now let us brainstorm to get a "proper" solution. First thing first, let us look at the (1) schematic: imgur.com/gallery/aRTIokz, (2) QUESTION: electronics.stackexchange.com/questions/480171/….. / to continue, ... – tlfong01 Feb 12 at 6:57
  • 2
    I already have a bus of i2c devices... and code to work with the ADS1115... it already all works. Bar the short circuiting issue. – fret Feb 12 at 9:22
  • 1
    If there is no connection to the ADC when the pedal is unplugged the ADC value just floats randomly. By tying it to 3V3 I get a valid signal when unplugged. The ADS1115 is already there in the circuit reading the value off the socket. Both the plugged and unplugged states are fine. Just the transition between where it shorts. – fret Feb 12 at 10:20
14

How do I avoid a temporary short circuit from destroying the PI?

It's very easy really:

  • power down your Pi
  • alter the connections
  • power on the Pi again

Electronics are not hot-pluggable by nature, they have to be designed in a special way to be hot-pluggable. People start to forget that because many modern interfaces support hot-plugging, notably USB. In older times you would apply the procedure above if you needed to connect an external keyboard to your laptop.

If you want to design a hot-pluggable interface, you have two options:

  • make sure the connector prevents unwanted contacts and ensures the correct connect-disconnect sequence (as USB does)
  • make sure your device survives any possible connections in any sequence

The latter is how audio jacks are designed: amplifiers have current limitation so they can survive a short, and a headphone can handle 2x voltage if it gets accidentally connected between L and R instead of L/R and GND.

Current limiting resistors are often used in JTAG/UART/debug adaptors to make them hot-pluggable or at least more robust. Whenever such a resistor will be enough depends on the circuit you have designed.

|improve this answer|||||
  • Yes I think in all the discussion a current limiting resistor is the right solution, but you don't actually look at what value would be a good choice in this situation? That is the crux of the question. – fret Feb 13 at 0:48
  • @fret There's no way to give a value without a schematic. On a theoretical level, the resistance must be (a) small enough so as not to interfere with your circuit, and (b) big enough to limit a short circuit current to a safe value. If value (a) is bigger than value (b), you're in luck: pick a value somewhere in the middle. If (a) is smaller than (b), the resistor is not a viable solution. – Dmitry Grigoryev Feb 13 at 7:53
5

If you short circuit the 3.3V rail to Gnd you will instantly kill the Pi.

Frankly anyone who connects a power rail to external circuitry (from the Pi or any other device) is just asking for trouble!

You can use the power rails to provide power to external circuitry with suitable care - which excludes a TRS plug which is practically guaranteed to cause a short - they are designed for audio (or occasionally video) signals. You should NEVER connect power on a live system - devices which are designed for hot plugging e.g. USB use special connectors to ensure safe connection.

No responsible engineer would connect a live power rail to use for logic connection without protection and would not use a TRS jack for power!

If you are powering an external circuit any series resistance will compromise its operation (unless the current is minimal). You DON"T put resistors in power rails.

No one can design your circuit for you, even if you published a proper specification.

|improve this answer|||||
  • 1
    So USB has a way to "ensure safe connection". I'd be interested to know what methods are used to allow hot plugging of devices? Also the series resistance in this case just takes away from the total range I can read at the ADC. It's not like a IC that needs a certain voltage, it's just a potentiometer connected via a TRS cable. Lots of similar devices do this, so I assume there is a standard way. That's what I'm asking for... – fret Feb 12 at 6:30
  • 3
    USB has connectors designed for the purpose. TRS jacks ARE NOT Despite other answers NOTHING you can do will help if you wire 3.3V to a TRS jack because the tip and ring make contact with Gnd on insertion. – Milliways Feb 12 at 9:02
  • @Milliways I completely agree with you in principle (TS speaker cords, for another example), but the audio industry has only recently come up with some purpose-designed connectors for specific things. Thus, we still have the same connector used for myriads of things that it shouldn't, even by otherwise reputable brands, with the resulting confusion among consumers, hobbyists, and even some professionals. – AaronD Feb 12 at 16:13
  • 2
    @fret USB uses contacts of different lengths inside the plug to control which lines connect first. – T.J.L. Feb 12 at 19:34
  • 1
    @fret on top of what TJL said, USB is designed with connectors in parallel (relative to the axis of insertion) and a keyed system to prevent an incorrectly-oriented plug from entering, so no contact on either end ever touches a contact on the other end it wasn't meant to at any point during the insertion/removal process. – Doktor J Feb 12 at 22:02

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.