Fixing a Broken iPod
March 27, 2011 4 Comments
A little while back I was tasked with repairing an (out of warranty) 2nd generation iPod nano. The play/pause button didn’t work, which is particularly debilitating because without it you can no longer:
- Turn it off until the battery runs out
(This site has moved to http://www.flashingleds.net, go there if you have comments or questions)
As it turns out, iPods have some remote control functionality through the dock connector, and since we live in the future all the details of the protocol and the connector pinout are nicely laid out on the internet. The solution to the broken button dilemma was therefore pretty straightforward: employ a microcontroller between the iPod and an external pushbutton, sending serial commands to mimic the behaviour of the regular play/pause button. Essentially I built a single button remote control.
Dock connectors are available at Sparkfun for $4. Looking at it you can see that there’s some space in the shell to stuff some electronics, and even a hole where the cable normally goes that we can use for a button.
Order two; you’re pretty much guaranteed to screw it up the first time
The smallest micro I had on hand was an 8-pin through-hole ATTiny13. This will fit, but only without a PCB. A surface mount version would be more sensible if you wanted to go about this in a more carefully planned manner than me. There’s not a lot else that needs to go in; the Tiny13 has a 9.6MHz internal oscillator and you can steal a clean 3.3V from the iPod on pin 18. The only external components I used were:
- 10kΩ pullup on the Tiny13 reset line
- 10kΩ pullup on pushbutton
- 470kΩ across ipod pins 1-21 to enable the serial interface
I just soldered the wires and resistors directly to the Tiny13 and the connector (tricker than it sounds). Unfortunately I didn’t take any pictures, but just imagine a messy pile of crap and you’ll have the idea. The finished product looks like this:
There’s a bunch of hot glue holding everything in place. I actually tried some $0.20 cyanoacrylate superglue first, but that stuff is crazy runny. I was testing the circuit on my own iPod at the time, and the glue immediately wicked up through the connector and backfilled my iPod with superglue. Recoverable, but not cool.
To minimise drain on the iPod battery the program keeps the Tiny13 in power-down sleep mode for most of its life. According to the datasheet this should result in a 500nA supply current, with momentary periods of a few mA when you push the button and wake it up. That’s what the literature says, but purely because I can I went ahead and hooked one up to a preposterously expensive piece of DC measurement gear, the mighty 236-SMU from Keithley:
This was measured with a supply voltage of 3.3V, running initially on the 9.6MHz oscillator then switching into the power down sleep mode. The resulting current draw is a paltry 185nA, better than expected from the datasheet. Considering that the iPod battery is (I think) 400mAh, it would take nearly 250 years for this thing to drain the battery. Basically what I’m saying is it’s fine to leave it plugged in.
I never cease to be astonished when I make something and it actually works, and this is no exception since it does indeed work very well. The source code is here for those after more details. It’s a very simple control loop based on interrupts from the pushbutton; the most complicated aspect is the software UART. The iPod doesn’t seem very picky about the baud rate; I shot for 19.2k but the stability of the 9.6MHz internal oscillator is not stellar … the thing worked fine regardless.