Turn off mp3 audio for 5 seconds when I insert a USB drive

Hello. I have a pretty unique project. I’m building an art installation that uses around 200 dummy USB ports. The USBs aren’t connected to a computer. They just allow people to insert USB drives into them.

I want to have an mp3 clip play on loop until someone inserts a USB drive. When they do, I want the audio to stop for 5 seconds and then begin playing again.

I assume I can code the particle board to use a timer to cut out the audio signal from an MP3 player to the speaker for 5 seconds.

I previously built a version of this that pushed a momentary NC button directly behind the USB port. When you pushed in the USB drive, it pushed the button. It was quite complicated and finicky. Can I somehow use the digital signal from the USB port itself?

Any recommendations on a good set up for this? Happy to pay $20 to the best answer.

Sounds like a fun project.

Talking to an mp3 player module is straightforward with a photon, but electrically detecting a USB insert will be trickier. Ideally you could disconnect the metal shroud from pin 4 (ground) so that the two contacts are only closed when a device is inserted. All of your socket pin 4s (grounds) would be connected to the system ground, and all of the shrouds would be connected to some kind of multiplexing chip. Then, I believe that you’ll want to implement row/column matrix scanning.

Do you need to differentiate between the 200 different USB ports? What about if someone inserts a second drive while the first is already in – do you need to be able to tell how many drives are inserted or see when new insertions happen even if some are already inserted?