It’s been a long time since I posted my last update. MIT is keeping me busy – with quizzes every week for the last 5 weeks, as well as the usual helping of classes, problem sets, group projects, labs and reading.
For spring break I flew back to London to visit friends and family, so most of my free time was dedicated to catching up with people back home. But I did find some time to work on a mini project.
The idea was to build a small device that would plug into a phone’s 3.5mm headphone jack and allow me to control music by pressing buttons on the device (play/pause, volume up/down, next/previous track). I actually came up with this idea with a friend at a hackathon in early 2015, but didn’t act on it until now.
This idea isn’t really new either – it’s pretty common for this to be integrated into off-the-shelf headphones. But my headphones don’t have this, and I like my headphones.
With a little research I was able to uncover the Android specification for devices like these.
Basically, the circuit relies on having a 4-contact headphone jack. Two connectors for the left/right audio channels, one for ground and one for a microphone. In headphones without a microphone, the microphone contact is normally just shorted to ground.
By shorting the microphone contact to ground via a specific resistor, you can trigger one of four different software functions, A, B, C or D.
|Button Impedance Level||Device Support||Notes|
|70 ohm or less||Required||[Function A]|
|110 – 180 ohm||Required||[Function D]|
|210 – 290 ohm||Required||[Function B]|
|360 – 680 ohm||Required||[Function C]|
This table shows the required resistor values to trigger each function. I used 680, 220, 150 and 0 ohm resistors (the 0 ohm was just a short!).
On my phone (Oneplus One), the functions are Play/Pause, Volume up, Volume down and bring-up-music-controls. I suppose that these can be changed in software some how.
With this knowledge, all I had to do was construct a small circuit on veroboard and put it in a case.
I found the smallest aluminium box on digikey (as I was already doing an order for a larger project) and drilled the necessary holes. It isn’t really that small, but I think it looks quite nice and is good enough for a prototype.
I then wired up a circuit with resistors and tactile buttons on veroboard and aligned the buttons with the holes in the box. I used a piece of rubber from a bike inner tube to cover the buttons and glued the board in place. I also attached a female headphone jack (to connect headphones) and a male headphone cable (to connect to the phone). The ground and left/right audio channels pass directly from the headphone cable to the female jack. The microphone and ground connections are redirected to the circuit board so that they can be shorted together via the resistors when buttons are pressed.
After testing, I “potted” the device with hot glue. This made sure nothing would rattle around, and also provide strain relief for the wire and jack.
I screwed the back panel on and it was finished! It works as expected. However it is a bit too large to be practical most of the time. It’s still a WIP.