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 snap-in board spacers between the two boards 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 spacers, 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 replace the spacers with longer screws, 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.
Friday, September 26, 2014
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.
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?).
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.
Wednesday, August 27, 2014
µBoost user guide
This is the permanent spot for the µBoost user guide.
The µBoost is a battery powered USB power supply. It can supply up to 1A @ 5V from 3 primary cells (AA, C or D) or up to 500 mA from 2 primary cells.
You can use any supply voltage as long as it is lower than 5 volts. That means that you can use a LiPoly, NiCd, NiMh or any other chemistry you like.
Use of primary cells at more than 1A of current draw is not recommended. The batteries' internal resistance will cause them to get quite hot. Additionally, the higher the current draw, the less energy the batteries will deliver before they die (the extra energy is lost as heat). This is not a problem with most secondary battery chemistries, such as NiMh, Lion or LiPoly. If you wish, you can add a battery charger in parallel with the battery and µBoost.
The quiescent current of the converter (that is, its consumption with no load) is around 140 µA, which means that without being used, a set of AA batteries would last around 2 years.
The lower the input voltage, the hotter the MOSFET, diode and inductor will get during high current operation. It is not recommended to pull 1A with a 3 volt (2 battery) supply. Even if this weren't excessive switch current for the MOSFET, it would require pulling too much current from the primary cells than is good for them. If you heat up primary or secondary cells they can leak or explode.
The µBoost is a battery powered USB power supply. It can supply up to 1A @ 5V from 3 primary cells (AA, C or D) or up to 500 mA from 2 primary cells.
You can use any supply voltage as long as it is lower than 5 volts. That means that you can use a LiPoly, NiCd, NiMh or any other chemistry you like.
Use of primary cells at more than 1A of current draw is not recommended. The batteries' internal resistance will cause them to get quite hot. Additionally, the higher the current draw, the less energy the batteries will deliver before they die (the extra energy is lost as heat). This is not a problem with most secondary battery chemistries, such as NiMh, Lion or LiPoly. If you wish, you can add a battery charger in parallel with the battery and µBoost.
The quiescent current of the converter (that is, its consumption with no load) is around 140 µA, which means that without being used, a set of AA batteries would last around 2 years.
The lower the input voltage, the hotter the MOSFET, diode and inductor will get during high current operation. It is not recommended to pull 1A with a 3 volt (2 battery) supply. Even if this weren't excessive switch current for the MOSFET, it would require pulling too much current from the primary cells than is good for them. If you heat up primary or secondary cells they can leak or explode.
Theory of operation
The µBoost is built around an NCP1450 boost converter controller with an external MOSFET switch. Because the switch is external, the controller itself has no limit on how much current it can switch (or supply). The MOSFET itself has a maximum drain current rating of a massive 8 amps, but in a boost converter arrangement the switching current is generally much higher than the output current rating. The same is true of the Schottky diode, which is rated at 3 amps and a maximum forward voltage drop of 0.5 V and the inductor, which is rated for over 2 amps.
A boost converter works because an inductor resists a change in the current flowing through it by generating a voltage. The inductor is connected between the line and load. Immediately after the inductor is a switch between the inductor's output and ground (in this case, the switch is the MOSFET). When the switch is closed, the inductor is connected across the input voltage, and it is effectively "charged." When the switch is opened, the current flow through the inductor is interrupted. The inductor attempts to "correct" this state of affairs by generating a high(er) voltage. That voltage passes through the diode to the load. When the switch is closed, the diode is reverse-biased and blocks current flow the "wrong" way from the load. The output filter capacitor supplies the load during this time.
The two data lines have resistor voltage dividers. These dividers are set to provide a constant voltage to the data pins. These voltages tell Apple iDevices the ampacity of the charger. The spec for these voltages is unpublished, but was discovered by the good folks at AdaFruit.
The only difference between the 500 mA circuit and the 1A circuit is the high side D+ resistors. It is 75k for 1A of charge current and 43k for 500 mA.
Schematic
Tuesday, August 26, 2014
Low power breakthrough
I've made a few battery powered projects since I've started, and the one constant in all of them is that none of them had a power switch. All of them (that had a microcontroller), went to sleep and used either a button interrupt or a timer to wake up again.
I've discovered that all of this time I was missing a crucial power-saving step.
One of the things I'd been doing in setup() was turning off all of the excess peripherals in the PRR - the Power Reduction Register. It turns out, however, that this is insufficient to turn the A/D converter off completely. You also must (first) clear the ADEN bit in ADCSRA. Not doing so wastes around 250 µA. It doesn't sound like a lot, but for the blinky earrings, which are powered by a CR1225, that is enough to kill the battery in about a week rather than allowing it to sit powered off basically for the shelf life of the battery. In the Crazy Clock, it's enough to reduce the (estimated) battery life from 18 months or so down to 3.
So... Before you put an AVR to sleep, clear the ADEN bit in ADCSRA and then set as many bits as you can in PRR.
I've discovered that all of this time I was missing a crucial power-saving step.
One of the things I'd been doing in setup() was turning off all of the excess peripherals in the PRR - the Power Reduction Register. It turns out, however, that this is insufficient to turn the A/D converter off completely. You also must (first) clear the ADEN bit in ADCSRA. Not doing so wastes around 250 µA. It doesn't sound like a lot, but for the blinky earrings, which are powered by a CR1225, that is enough to kill the battery in about a week rather than allowing it to sit powered off basically for the shelf life of the battery. In the Crazy Clock, it's enough to reduce the (estimated) battery life from 18 months or so down to 3.
So... Before you put an AVR to sleep, clear the ADEN bit in ADCSRA and then set as many bits as you can in PRR.
Friday, August 22, 2014
Measure with a micrometer, mark with chalk, cut with an axe.
I happened to see a link to this from Dave over at eevblog. TL;DR, it's a 5 ppm mechanical wristwatch for $800K.
That CNN says it keeps "perfect" time is laughable, but I'll give them that 5 ppm is certainly a high standard for a purely mechanical movement.
But it got me thinking... I've made all the crazy clocks I can think of... but just how accurate could a lavet stepper clock be?
Well, the going rate on eBay for a rubidium standard with 10 MHz output is around $180 or so. A simple firmware tweak should give us the same 10 Hz interrupt source: 10 MHz with a prescale of 16 is 625 kHz. 625 kHz divided by 1024 is 61 5/128, so 5 cycles of 62 and 123 cycles of 61 would be correct.
The result would be a lavet stepper clock that ticked with an accuracy of better than one part per billion. It would be no more than a tenth of a second off per century.
Of course, it wouldn't be synchronized to anything - it would depend on the user to actually point the hands to the right spot. But as long as it had power, you could count on it being a whole lot more accurate than a wristwatch 3.5 orders of magnitude more expensive.
You could do the same thing with GPS much cheaper, of course. You wouldn't even need a microcontroller. GPS modules have synchronized PPS outputs. You could use a flip-flop and two AND gates to turn the PPS output into alternating positive pulses on the two coil wires. If the PPS pulse isn't long enough, then you might need to add a pulse stretcher, but even then a microcontroller is still overkill.
That CNN says it keeps "perfect" time is laughable, but I'll give them that 5 ppm is certainly a high standard for a purely mechanical movement.
But it got me thinking... I've made all the crazy clocks I can think of... but just how accurate could a lavet stepper clock be?
Well, the going rate on eBay for a rubidium standard with 10 MHz output is around $180 or so. A simple firmware tweak should give us the same 10 Hz interrupt source: 10 MHz with a prescale of 16 is 625 kHz. 625 kHz divided by 1024 is 61 5/128, so 5 cycles of 62 and 123 cycles of 61 would be correct.
The result would be a lavet stepper clock that ticked with an accuracy of better than one part per billion. It would be no more than a tenth of a second off per century.
Of course, it wouldn't be synchronized to anything - it would depend on the user to actually point the hands to the right spot. But as long as it had power, you could count on it being a whole lot more accurate than a wristwatch 3.5 orders of magnitude more expensive.
You could do the same thing with GPS much cheaper, of course. You wouldn't even need a microcontroller. GPS modules have synchronized PPS outputs. You could use a flip-flop and two AND gates to turn the PPS output into alternating positive pulses on the two coil wires. If the PPS pulse isn't long enough, then you might need to add a pulse stretcher, but even then a microcontroller is still overkill.
Subscribe to:
Posts (Atom)