Reliable way to detect when digital pin connects to digital pin

Hi all,

I'm working on a project where I need to detect when a 1/4 audio jack has been inserted into a port.
my goal is to be able to define in the code what two pins have received a current and create a "virtual" patch cable. I want to achieve this without modifying the cable at all, so the solution is (in my limited view) in the port or circuity between the port and the Arduino.

You can't set all pins to input expecting them to not short circuit when connected instead of sending signals to each other, right? I thought of sending an extremely short pulse from each pin while all else were inputs but I'm not sure if the Arduino can handle this rapid switching for it's entire life and doesn't seem reliable.

Any help is appreciated.
Thanks!

Please elaborate.

IF its a switched socket - like this -

you MAY be able to use the switch closures to detect the presence of an inserted plug, provided that your circuit is capacitively coupled so that no DC currents flow

You will need to give a lot more detail about what is being plugged in and what the "box" the sockets are on does.

1 Like

Wrong! They will not short circuit regardless of what combination of in and out you configure them. They have to be electrically connected either by a conductor or a fault in the processor. Sorry to inform you there is no wear out mechanism in the Arduino. I have somw of the PWM outputs running at 960 Khz for 5 years + and no problems.

I recommend you get a copy of the Arduino Cookbook and read it as well as observing several of the basic electronics and Arduino tutorials that are on line. Many are good some no so.

1 Like

if @johnerrington 's method does not work for you:
What is on the other side of the jack plug? A headphone? A guitar amplifier?

I am not sure, that I understand your question, but my understanding is:

  • YOu want to detect if there is any signal present on the channels?
    OR
  • You want to detect if the direction of the channels are input/output, what can change dynamically in your application?

I'm making a MIDI controller for Ableton. The 1/4 inch sockets will be assigned to different parameters of a synth, so that when one is connected to another via a 1/4 inch cable the parameter value in the DAW will be linked.

Thanks for the reply, by fooling around i found out that i can complete a circuit by running voltage through 2 contacts on the socket. With this knowledge I can detect the presence of a 1/4 jack, and I still have a contact that can run voltage across a connected cable.

To detect what two sockets a cable is plugged in to, I'll use that extra contact to flash a digital pin connected to each side - if nothing returns, I'll assume the two jacks are two different cables and try again when another jack is inserted.

Hopefully they are not connected to the amplifier and just open.

Not sure what you mean, but I'm using the socket is meant for TRS jacks (for 3 separate loads across a cable), and the cable is a TS, meaning where two separate contact points should be, 1 is. I'll just be sending voltage to a digital pin and using the jack to close the circuit.

The ones I use have an auxiliary isolated contact, hopefully that is what you are using. Some do not have that and the contacts are part of the audio circuit, using that could damage the amp.

None of the circuity or cables will be connected to any real audio equipment, nor will they be use to transfer any electrical signal other than short pulses to check connection, so I don't think this will be an issue (unless you are talking about a different kind of amp?)

Well, the safest way for presence detection is what @johnerrington wrote!
Use an connector that has the presence detection additional pin.
Then you will be able to find out if a cable is connected without interfering with any audio or communications signals.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.