I have some TRS Sockets (Female) ( Phone connector (audio) - Wikipedia ) Hooked up to analog pins (T -> A0-3, R -> VREF, S -> GND). This allows the usage of external Expression and Sustain Pedals commonly used in Digital Music Production, which connect a potentiometer to those pins accordingly.
Now some Sustain Pedals are using a Switch instead of a poti. Those are connected using a TS Plug (Male) (so the Ring contact gets connected to the Shaft).
Can I use some clever Electronics stuff to avoid the short and allow the usage of both types of pedals on a jack?
Your thread is very confusing when it comes to plugs and jacks. A plug is the male part, a jack is the female part. The link you gave is usually called a phone plug which mates to a phone jack. And yes, all such connections will always short somewhere when inserted or removed, by design, for safety of the user. The circuit itself has to allow this. Those connectors were never designed, as you have discovered, for HOT switching.
so if you get a TS jack you know it's a switch and if you get a TRS jack you know it's a potentiometer
Connect them as you would for a switch with a pullup resistor (builtin) for the TS and as you described a potentiometer would be wired with the wiper to A0 and 5v and GND on the two other ends.
or are you saying you are getting sometimes a TRS jack but it's not a potentiometer but a switch ?
And your question is that on your board you only have one jack (the female part) with 3 contacts and you want to be able to plug either the TR or TRS in this jack without any risk.
(only there are more jacks so even if the Arduino wouldn't mind having its VREF shorted to GND (which i doubt) and these of course should not influence each other - which certainly becomes an issue plugin in the TS)
you would still get 10 bits sampling over a lower range of voltage ➜ select the resistor smartly so that you can use the builtin 1.1V analog reference and you don't loose anything (I'm a software guy so no guarantees on what I say with the resistance - seems to me it could be a voltage divider)
The more I am thinking about this... Does an external reference voltage solve the issue? can i just bridge the 5V with a resistor to the VREF to achieve independent and stable reference?
You should never use the Aref pin to power things.
The pin can only be used to connect an external reference voltage, with the right code.
Powering things from the Aref pin is very wrong, and potentially deadly to the Arduino.
You should always power pots from the 5volt pin.
Add a low value resistors in series with the 5volt supply of each socket, like 47ohm.
That will limit fault current to a safe 100mA during insertion of the plug.
Only downside is that you might not fully reach 1023 of the A/D.
Leo..