I think there's a simple solution to this problem, but I can't quite figure it out.
I'm working on a project where various sensors are connected to the AVR ADC lines through TRS (1/4" stereo) jacks. The wiring is Tip: Wiper, Ring: +5V, Sleeve: GND.
That all works fine. The problem is that the TRS plugs may be removed while the micro is running, which can cause a quick short as the ring on the plug makes contact with the sleeve on the jack connector, etc. This doesn't fry anything, but it does cause the AVR to restart.
How do I protect against this? Do I need to put a diode in there somewhere? Also, what would be the best way to make the ADC signal 0v when no plug is connected?
The jack that I'm using has normally closed (i.e. when no plug is inserted) switches on each of the T, R and S contacts. Perhaps I could put those to use?
Any help or suggestions appreciated.