My son and I are building a lamp based on Arduino Uno (he put me in charge of hardware) and he wants it to be able to flash based on music input from his phone. I found schematics to add a DC bias to the input to account for the AC nature of the music but he would like to know when the plug is inserted in the jack. We procured a 5 pin 3.5mm jack similar to http://www.switchcraft.com/Drawings/35rasmt4bhntrx_cd.pdf but I can figure out how to interface either pins 4 or 5 to the Arduino so to detect insertion. I Googled for this information but could find such application.
Its only got changeover contacts for disconnecting an internal speaker from the audio output on insertion,
which is not especially useful for informing a microcontroller.
If your audio inputs have a relatively low(*) dc resistance to ground you could try adding a 10M resistor to
5V from one of the switch pins - upon insertion that will be disconnected from the audio dc bias and float
up to logic HIGH. A large resistance value for the pullup reduces the chance of loud pops and crackles.
MarkT:
Its only got changeover contacts for disconnecting an internal speaker from the audio output on insertion,
which is not especially useful for informing a microcontroller.
If your audio inputs have a relatively low(*) dc resistance to ground you could try adding a 10M resistor to
5V from one of the switch pins - upon insertion that will be disconnected from the audio dc bias and float
up to logic HIGH. A large resistance value for the pullup reduces the chance of loud pops and crackles.
(*) a few kohms
Thanks for the quick reply. This is what my intended circuit looks like:
If I understand you correctly, I'd put the pull up resistor on the switched pin of the jack as follow:
Instead of the pull up resistor, could I use the internal pull up capability of the Arduino for its digital inputs? Also, I do not understand your comment regarding the large resistance would reduce chance of noise, if the pull up resistance is connected to the switched pin, it would be disconnected up insertion of a plug in the jack thus no longer in path of audio current, wouldn't it?
No, that won't work as you don't have a DC path from the pin to ground. Perhaps add 100k to ground on
the signal pin to ground - it'll beat the 10M and doesn't present too large a load.