I'm doing an audio installation where multiple headphone jacks are on a wall and the user will plug into the jacks and each jack plays an mp3 that starts playing from the beginning when it gets plugged in. Is this possible with an RPi? What is the best approach?
4 Answers
Use custom jack socket with plug detection. Hook the audio pins to Pi jack and the detect pin to GPIO. Make sure the detect pin works against ground (most of them do, but there always is a possibility of some exotic configuration).
You pretty much can't use the Pi jack directly anyway, as doing so would put the power port toward the customer.
Depending on how many jacks you need, possibly at some point it would be cheaper to use a PC with N cheap USB soundcards than N Pis. Researching which cards work would be a real pain, I guess.
- 221
- 1
- 5
The Pi has only 1 "headphone jack" but no way of detecting if anything is actually connected to it, so you are out of luck unless you are designing your own hardware.
- 62,573
- 32
- 113
- 225
EDIT:
I have found this digikey paper : a deep dive into audio jack switches and configurations where switch concept is explain.
- 2,167
- 1
- 8
- 19
You can listen for ACPI events and act on them. You can use acpid directly or a client called acpi_listen that comes bundled with acpid.
acpi_listen works as following:
# acpi_listen
jack/headphone HEADPHONE plug
jack/headphone HEADPHONE unplug
- 199
- 2
