I am working on a project that involves a raspberry pi acting as an internet radio client which the public can access by plugging their own headphones into a 3.5mm (1/8”) jack. They will have access to volume control and nothing else. The project’s constrains are:
- the plug has to be robust, and panel-mountable
- the sound quality must be good
- the raspberry pi must know when someone has plugged in.
I am using a usb soundcard connected to a headphone amp to give me volume control, and higher quality sound. for the robust plug and sensing capability, the headphone out is connected to a breadboard which connects to a high quality 3 conductor 4 pin barrel jack and contains a circuit that interfaces with the RPi’s GPIO.
The jack contains a switch which is normally closed, and is opened when a plug is in the jack. I’ve attached a link to the circuit on the breadboard.
The circuit behaves properly when the headphone amp is not turned on, or when the sound source is ungrounded, such as a smart-phone, but when the soundcard out is used, or the headphone amp is on, the GPIO digital pin remains high.
I think it is an issue with the relative grounds of the RPi and the headphone amp. I found the circuit I'm using here. I’m not very savvy with electronics, so I'm not sure what changes to make to get the proper behaviour, but it feels like I'm so close. Is there a simple solution?
Here's the circuit I'm using:
R1=100k, R2=50k, R3=10k, C1=0.1uF