Friday, September 26, 2014

AVR ISP Pogo adapter

I've been buying and using SparkFun's ISP Pogo adapter, but there are a couple of things about it's design that - at least for me - could be improved.

The basic design - two boards that are rigidly fixed in a precise vertical alignment each supporting the pins - is good. But I don't value the Molex and JST connectors. I'd rather be able to grasp more easily onto the top board without having so much stuff in the way.

Fortunately, designing one isn't hard. Just put two 6 pin AVR ISP footprints on a board and connect each related trace. You use a pair of boards to make one fixture, and since they're both the same, they'll both align perfectly. You use a pair of 1/4" #4 unthreaded spacer between the two boards and a 1/2" #4 bolt and #4 nut to hold the boards together. With the spacers, there will be enough room on the lower board to install a right-angle DIP header, leaving the top of the top board completely open and usable as a grip/pressure surface.

You assemble the adapter and align the pogo pins the same way SparkFun says to do it on theirs. Start  by attaching a 2x3 right angle DIP header to what will become the bottom board, making sure to install it on the TOP of the board, and that it doesn't stick up more than 1/4 inch (so that it won't touch the top board once it's in place). Next, mechanically assemble the two boards together with the two machine screws, spacers and nuts, making sure that the TOP of each faces the same direction and is oriented the same way. Next, temporarily attach a piece of cellophane tape to the top of the top board, then insert the pogo pins through the bottom board and into the holes of the top board so that they rest against the tape. Carefully check the pins to make sure they're straight and level. If the pins are racked, twist the boards so that they're straight, loosening the hardware if necessary. Solder the pins to the bottom board, then remove the tape and solder the pins from the top of the top board. The second footprint on the top board will be left unconnected.

It turns out that SparkFun's drill holes are the same diameter as the Pogo pin itself. They may be counting on their PCB vendor consistently erring on larger holes. I can only hope that OSHPark does the same. A snug fit is ok, but not fitting at all would be bad. We'll see.

I envision bigger things from this design, potentially. Because the top is (nominally) flat, you could remove the top two screws and screw longer ones in, attaching the whole adapter to a larger programming jig, possibly for mass programming panels of devices all at once. The only hard part of that is figuring out how to get avrdude to individually address multiple USBTiny programmers simultaneously attached.

Monday, September 22, 2014

Crazy clock power consumption

I've been mostly guessing about the power consumption of the Crazy Clock controller. But today, I validated my guesses.

My Rigol DS1052E doesn't have an integration function. As Dave explained recently on EEVblog, integration is the best way to quantify power consumption when the waveform is complex. If you can graph amperage against time and integrate that, the result is energy consumed against time - mAs/s. It's not exactly analogous, because the mAs/s isn't really a rate. It's the number of mAs consumed in a second's worth of time.

I took the whole kit-n-kaboodle to work today early and performed the integration. The result was that while the controller sleeps, there's around a 1 kHz complex waveform consisting of a sharp rise to 1.25mA or so, then a decay down to 0. My Rigol scope said it was an average of around 220 µA. But is that accurate in terms of energy consumption?

The integration function over one cycle of that complex waveform reported 220 nAs (actually, it was 220 µVs, but with a µCurrent Gold set for the µA/mV scale, so change Volts to Amps and divide by 1000). Since that was over the course of 1 ms of time, it's 220 nAs/.001 sec, or 220 µAs/s - the same as the 220 µA average current reported by my Rigol.

And that makes logical sense as well. The boost converter is turning 1.5 volts from a AA battery into 3.3 volts, and the datasheet says it should be doing so at roughly 80% efficiency. The ATTiny while napping should be consuming around 100 µA @ 3.3 volts when clocked at 500 kHz. In principle, that means that the battery draw should actually be something like 275 µA, so it's probable that either my measurements are a tiny bit off, the controller is a tiny bit more frugal or the boost converter is a tiny bit more efficient. Or all 3. But it's still in very much the correct ballpark.

Saturday, September 20, 2014

Failure is one thing. Not knowing why is another.

For the first time, I'm stymied.

I've made mistakes since I started this making thing. All of them have been learning opportunities. If you've bee following me on twitter, you'll have seen some "Tips du jour" - most of those are lessons that I've learned from figuring out what I did wrong.

Well, now I've got a situation I can't figure out.

I have the same circuit on two different boards. One one board, it works perfectly. On the other, it doesn't work at all.

The circuit in question is a boost converter based around the NCP1450-5 boost controller. Both circuits have the identical schematic. The board layouts differ, but  I've conferred with a colleague at work and he didn't see anything wrong with it either.

The symptom is that with no load, the output is 5 volts. But while circuit A can supply up to an amp of output with less than a tenth of a volt of sag, barely 100 mA of load on circuit B is sufficient for the voltage to sag down to the battery voltage. It's as if the controller "gives up" on trying.

My first thought was that the feedback sampling was being drawn from too close to the output of the regulator as opposed to near the load. But if you do the math, there isn't enough voltage drop on the traces of either design to account for anything.

I then thought that perhaps the output filter cap was too far away from the cathode of the diode. So I added a 68 µF tantalum cap tacked onto the end of the cathode and a short wire to ground. That didn't help.

The board that doesn't work also has a LiPoly battery charger on it, but the exact same circuit on a separate board has been used in concert with the working version of the booster board for a while now, so the mere presence of that circuit doesn't cause any trouble (and why would it anyway?).
The schematic

The board that doesn't work

The board that works.

Monday, September 15, 2014

Pi Power destructive testing report

I took some time this evening and pressed Pi Power to, and beyond, its limits.

First, one thing I discovered is that the failure mode that I observed was that the MOSFET shorts. That causes the input voltage to pass through unmodified to the output voltage, which would likely destroy the Pi. I think a follow-on version of Pi Power will need to add an output over-voltage protection circuit of some sort. That will, however, raise the price.

Second, it looks like I am going to need to de-rate the top end of the voltage range. As the input voltage increases, so does the switching frequency. At 14 volts, the frequency is north of 300 kHz. That's enough that the capacitance of the MOSFET (that is, its maximum switching speed) starts to contribute excessive power dissipation, causing it to heat up. 2 amps at 15 volt input was enough to blow the MOSFET after a few minutes. At 14 volts, it was still hanging on.

I also pressed Pi Power with 9 volts input to see where the current overload protection would trip. When I tried it before, I was using a weaker 12 volt power supply which wasn't able to get that far. I found that the current protection kicks in at around 4.25 amps. The current limit resistor value of 39 kΩ came out of an online TI design tool. I did the math on the datasheet and came up with a value closer to 22 kΩ, and posed a question to StackOverflow about it and never got an answer. But it looks like my calculations were more correct than TI's. The question is whether to change the value in the design to reduce the current limit to be more in line with the limitations of the circuit, or leave it high so that it basically just protects against dead shorts.

Still, in most cases I've personally observed, the current draw of a reasonably loaded Raspberry Pi is closer to 1A than 2. And at that load, with an input voltage of 6-14 volts, Pi Power does just fine.