Thursday, November 20, 2008

AA-to-USB revisited

[Apologies to our faithful readers who haven't seen this blog updated in a week, only to have it updated with my old and smoldering nerd project. I know you hang out here to catch a glimpse of Brynna. Fear not! With the weekend coming, we'll have some more to say soon.]

Previous posts on this project are here

Nope, I haven't given up yet on this one. When last we left it, some four months ago, I had a sort-of-working circuit board. It worked well enough to create a nice 5 V supply for a USB device from a pair of AA batteries - the green LED said so. But, it couldn't power my iPhone, because it just supplied power - there no brains behind it like in a computer. As a result, being a nice standards-compliant device, the iPhone wouldn't take the power presented to it. So, I had a working device of marginal value to me.

Since then things have been a bit busier - can't imagine why - and I haven't had much time or inclination to follow up.

But, about a month ago, I managed to sneak off to the lab for a bit for every engineer's favorite past time: taking things apart. There are tons of USB chargers out there, and a bunch of them work with the iPhone. How is it that they are able to convince the iPhone to draw power? To find out, I took a car charger I have and cracked it open.

The key thing in these pictures is the cluster of resistors (R9-R12) clustered next to the USB connector. These form what's called a voltage divider that puts about 2 V on each of the two data lines of the USB port. This jives with information I was able to glean from others who have tried to hack their own iPhone chargers - including the maker of the popular MintyBoost. Some say to add a pull-up resistor to each of the data lines, others say a resistor divider. I'm following the resistor divider I found in this car charger.

(What I really would have liked to do was take apart one of the Apple AC-power adapters for the iPod/iPhone. That obviously would be the most authoritative design (once you get past the AC-DC conversion). However, it turns out they are devilishly difficult to get into without breaking them, and I'd rather not risk doing that. I wasn't able to find anyone who'd taken one apart and posted the pics for all to see, alas, something that has been done to just about every other Apple product out there.)

So, I just needed to cram four more resistors onto the circuit board in the neighborhood of the USB connector. I was able to do this by placing them on the underside of the board, beneath the connector, and being a little clever with the circuit routing.

The addition made the board a touch wider then before. I needed to squeeze and shift things a bit to make sure the thing was less than one square inch, since BatchPCB rounds up and charges by the square inch. I just made it. I sent off the order and received by boards earlier this week. I had ordered 10, but somehow received 17. I'm going to chalk this up to them probably having a little extra space in a panel of circuit boards, and squeezing in a few extra copies of mine for the heck of it. I'll need to send them a nice thank you email.

Anyway, in the last day or two I've been able to populate the board and try it out. I had one false start when I soldered the main chip incorrectly. Being square, with leads all around, and very external markings, I didn't notice until too late that I'd had it rotated 90 degrees from the beginning. The next time, though, I managed to get it right. Viola!

As you can see, there's little different from the earlier version except for the four resistors under the connector. The other difference is that I can show off the sliding top enclosure I made with the rapid prototyper at work.

Even better than having an LED glow to tell me the thing works is for my iPhone to do it.

One thing that I have learned after letting my phone charge from this thing for a while - rechargeable NiMH batteries are probably a better fit for this circuit than alkaline AAs. The reasons are technical, and tough to explain without graphs. The short answer is that NiMH batteries' cell voltage drops more slowly than alkaline AAs. Even though the alkalines have more energy inside them, their cell voltage drops too low for the circuit to work before the batteries are fully drained. It would be like having a gas tank where the gas line exited from the middle of the tank instead of the bottom. This suits me just fine - I prefer using rechargeables when I can in any case. As it happens, I've got some neat rechargeables to use from USB Cell, which you can recharge using a USB port. Hmmm...use the USB port to charge the batteries to power the USB port. Eureka!

So, what was the final breakdown for this project? I shelled out about $35 for parts - enough to populate 7 or 8 boards, along with some free sample chips from TI. Each run of circuit boards was about $38. Goodness knows how many hours went into designing, assembling, and debugging it. I figured that, for parts, I could make them for $13 in lots of ten. I have so far only made one finished, working device.

All this effort just to be able to charge my iPhone on the go? Well, in my defense, I could say that I haven't just made a charger for the iPhone. I've made one for just about any USB device out there, including H's iPod and our Flip camcorder. Plus, this circuit, now that I've got the boards for it, will make a handy AA, 5-V power supply for future projects I might come up with. [Updated 2008-11-21 20:11] There's one that I have my eye on tackling -and LED nightlight for Brynna, roughly modeled along these lines. But, as usually happens, I'm thinking of expanding it a bit, so that the lights don't just shine, but twinkle in and out. That'd require some sort of microcontroller, and some coding, and...

[Updated 2008-11-21 20:11] In the end, as I stated at the start of the project, that it was not really ever about the having of an iPhone charger. It was, first and foremost, about the making of one.

No comments: