Computing stuff tied to the physical world

Running off a 6800 µF cap

In Hardware, Software on Nov 15, 2011 at 00:01

The running on charge post described how to charge a 0.47 Farad supercap with a very small current, which drew only about 0.26 W. A more recent post improved this to 0.13 W by replacing the voltage-dropping resistor by a special “X2” high voltage capacitor.

Nice, but there was one pretty awkward side-effect: it took ages to charge the supercap after being plugged-in, so you had to wait an hour until the sensing node would start to send out wireless packets!

As it turns out, the supercap is really overkill if the node is sleeping 99% of the time in ultra low-power mode.

Here’s a test I did, using a lab power supply feeding the following circuit:

JC s Doodles page 21

The resistor is dimensioned in such a way that it’ll charge the capacitor with 10 mA. This was a mistake – I wanted to use 1 mA, i.e. approximately the same as 220 kΩ would with AC mains, but it turns out that the ATtiny code isn’t low-power enough yet. So for this experiment I’m just sticking to 10 mA.

For the capacitor, I used a 6,800 µF 6.3V type. Here’s how it charges up under no load:

DSC 2745

A very simple RC charger, with zener cut-off. So this thing is supplying 3.64 V to the circuit within mere seconds. That’s with 10 mA coming in.

Then I took the radioBlip sketch, and modified it to send out one packet every second (with low-power sleeping):

DSC 2746

The blue line is the serial output, which are two blips caused by this debug code around the sleep phase:

Screen Shot 2011 11 02 at 17 30 23

This not only makes good markers, it’s also a great way to trigger the scope. Keep in mind that the first blip is the ‘b’ when the node comes out of sleep, and the second one is the ‘a’ when it’s about to go sleeping again.

So that’s roughly 10 ms in the delay, then about 5 ms to send the packet, then another 10 ms delay, and then the node enters sleep mode. The cycle repeats once a second, and hence also the scope display refresh.

The yellow line shows the voltage level of the power supply going into the JeeNode (the scale is 50 mV per division, but the 0V baseline is way down, off the display area). As you can see, the power drops about 40 mV while the node does its thing and sends out a packet.

First conclusion: a 6,800 µF capacitor has plenty of energy to drive the JeeNode as part of a sensor network. It only uses a small amount of its charge as the JeeNode wakes up and starts transmitting.

But now the fun part: seeing how little the voltage drops, I wanted to see how long the capacitor would be able to power the node without being “topped up” with new charge.

Take a look at this scope snapshot:

DSC 2747

I turned on “persistence” so that old traces remain on the screen, and then turned off the lab power supply. What you’re seeing is several rounds of sending a packet, each time with the capacitor discharged a little further.

The rest of the time, the JeeNode is in ultra low-power mode. This is where the supply capacitor gets re-charged in normal use. In that last experiment it doesn’t happen, so the scope trace runs off the right edge and comes back at the same level on the left, after the next trigger, i.e. 1 second later.

Neat huh?

The discharge is slightly higher than before, because I changed the sketch to send out 40-byte packets instead of 4. In fact, if you look closely, you can see three discharge slopes in that last image:

JC s Doodles page 21

A = the first delay(10) i.e. ATmega running
B = packet send, i.e. RFM12B transmitting, ATmega low power
C = the second delay(10), only ATmega running again

Here I’ve turned up the scale and am averaging over successive samples to bring this out more clearly:

DSC 2750

You can even “see” the transmitter startup and the re-charge once all is over, despite the low resolution.

So the conclusion is that even a 6,800 µF capacitor is overkill, assuming the sketch has been properly designed to use ultra low-power mode. And maybe the 0.13 W power supply could be made even smaller?

Amazing things, them ATmega’s. And them scopes!

  1. I recently started looking at these Rigol scopes.. Put it out of my head for a while.. But then, JC starting to blog about them… Argh! I shall resist the temptation to buy one..

    Keep up the interesting posts!

    • The Rigol used here is on loan from a friend. Next month, I hope to receive my own new scope, which is actually a fairly high-end model from Hameg. To be honest, I had not expected this Rigol scope to be as useful as it has already turned out to be. But the reality is that a digital storage scope really is an incredible tool.

      Then again, for micro-controller work a good logic analyzer is probably a far better investment.

      I’ll post my analysis of what I got, what it does for debugging, and why I picked this particular model once I have enough experience with the new scope.

    • I know! He’s a complete tease isn’t he!

      Here’s me with my old green CRT tube budget model… sniff (Take pity, send scopes!).

      However, I do have a logic analyser, which although also cheap from robomotic, does everything I need.

    • I am using a Rigol DS1052D with integrated 16 channel logic analyzer since ~2 years now and this little thing fulfills >99% of my daily requirements. Value for money is absolutely marvellous.

    • Here are some nice screen shots of Jörg’s MSO: http://www.batronix.com/shop/oscilloscopes/Rigol-DS1052D.html – it gives a good indication of what this thing can do, IMO. I agree – this looks to me like one of the best value-for-money deals on the market (I’m no expert on this, but I’ve looked at quite a few brands and models in the past month or so).

    • I see there seems to be a DS1052E model too, which is quite a lot cheaper, but lacks the logic analyser. This wouldn’t be much of a loss for me as I already have an 8 channel one connected to the laptop.

      Jörg, do you know if there is anything else missing from the E model compared to yours?

  2. The detail you can deduce from that scope trace is superb.

    Don’t forget when you move to AC to include a diode in series with the resistor. No point in wasting the reverse flow part of the AC cycle.

    • The reverse flow part can be used for another such device — by connecting it reversed.

  3. Squeezing a little more information from the excellent traces gives estimates for the actual current drawn in each sector: A=C< 17mA, B<32mA (and a short B preamble of 10mA). Error bands are large; tolerances of C & R, interpolating the traces and the ‘knee’ of the zener I.V curve.

    Averaged over the ~1sec period with the larger payload, the current draw is equivalent to 0.67mA continuous, implying the power feed side needs <1mA average to stay ahead. Interestingly, the efficiency function of the supply has a discontinuity – the best % is when the charge in/out is exactly balanced and the zener just barely clamps, minimising wasted reverse zener current.

    How about a feedback path to make the ATmega its own regulator?

    Undersize the feeding current, sense the Vcc and suppress transmission until approaching the zener clamp value. Enter the normal compute, transmit, delay loop and sense again on exit – if the Vcc has drooped too much, double the loop delay to allow the total charge on C to recover.

    The effect should give a self-regulating Vcc between just below the zener clamp voltage and a safe hysteresis point, say 0.25v lower. The only cost is a few missed transmissions that can be marked in the subsequent packet as intentional in case the monitor confuses this with poor reception. Keep a reasonable C value and even a mains voltage loss on that node can be reported positively before the BOD triggers if the droop does not recover as expected.

    A 5mW supply getting closer…

    • Fantastic ideas. In the Hameg scope, the math function includes differentation, which should allow me to get at the slope, i.e. actual current draw. And it has twice the screen resolution, so hopefully it’ll also show slightly better what’s going on.

      I’m thinking of getting a small transformer of 30 .. 60 VAC or so, to be able to get fairly realistic effects without having to constantly get near that 220V – isolated or otherwise, it still makes testing hard.

  4. Might I suggest a 220||110 with centre tap secondary? If you chose the type with a split bobbin (the windings are in separate plastic slots around the core), the isolation from the mains is excellent. Then ground the “iron” and the centre tap.

    This way, your maximum likely exposure is ~50VAC – a tickle only. Unless you are poking around the current sensor, you are unlikely to get across the full 110v. If you want real-life loads within the transformer VA rating, use a second to step back up to 220.

    Results should be scalable. You will get some artifacts (e.g. switch on surges for T1/T2, reduction in observed spikes, some sinewave distortion and a few watts lost warming the windings) but maybe worth it for the additional safety.

    Your existing isolation box is almost a candidate; but with the intermediate voltage at only 21Vac, perhaps the scaling not so linear. But the parts are to hand…. ;-)

    • Looks like it’s hard to find a 110V w/ center tap (sorry for my American English spelling, too late for me to switch).

      What I did find is some small 1.1 .. 2.4 VA transformers with dual 18V and dual 28V secondaries. The two combined give me a range of 18..92 V levels, as a convenient way to adjust supply feed currents without changing resistor or capacitor values in the test circuit. Looks like 50..60 VAC is reasonably safe (outside the bathtub!).

      The isolation box with two identical toroidial transformers is working out quite nicely (but indeed still risky). It’ll let me test thing up to over 100W. With those two little transformers, I ought to get some nice extra options. Hm, maybe I’ll double one of them up in reverse, to get 110 and 220V as well.

      Makes me wonder: the 1.1 VA 56V transformer is rated 20 mA. Does that mean it’ll not drive more than 5 mA when doubled up and supplying 220V? That would mean it’s dangerous, but not lethal anymore.

  5. JC,

    Please check the transformer construction first – either a double bobbin or if overwound, a foil screen between primary and secondary is fine. Without the screen, undetected primary to secondary breakdown is possible.

    If you arrange the secondary switching to retain symmetry ( 18-0-18, 28-0-28, 46-0-46), still earth the ‘0’ and get 18, 28, 36, 46, 56, 92 with a worst case potential to ground of 46 Vac. Have fun with the phasing ! BTW, the ill-fated ELCB can finally be used here to good effect in the three symmetrical cases.

    The 20mA number is coming from the winding/core rating – usually balanced between keeping the core out of saturation and the winding self heating within bounds. The output impedance will be low enough to draw substantially more that 20mA into a short circuit until the windings fry.

    Don’t be surprised by some ugly waveform distortion – the smaller form factor transformers tend to skimp on the iron and partly saturate, producing odd numbered harmonics.

    • These are the transformers I found, from DigiKey 2x 18V and 2x 28V.

      Fantastic idea to connect something close to a secondary’s center tap to ground (in any config, in fact). If floating, we might as well limit the potential-to-ground levels and as you say, make the ELCB do something useful. So basically, you end up with non-lethal voltages and currents, no matter which voltages in the range 18..92 V are used. Now that will add some comfort!

    • Ok, I’ve found a 2x 11 position rotary switch which will let me produce 18..276 VAC with numerous steps in between. Needs 1x dual 18V and 2x dual 28V transformers. Everything beyond 94V would be with a 115..230V to ground potential, i.e. dangerous (and perhaps for that reason not such a good idea – I could add an separate switch to enable those).

  6. Excellent choice – dual bobbin and a ‘Hi-pot’ test to be proud of. Lots of turns of very fine wire, so the regulation is unavoidably poor – effectively adds to the R dropper in the charge feed, so no harm done if you are measuring the charging current.

    The centre tap idea is an old one – often seen at construction sites where a large bright yellow transformer is feeding blue weatherproof locking outlets with 50-0-50. Judged to be intrinsically safe outputs despite the pools of water and jagged cable cutting metal around. Easy to inspect – Blue plugs? OK. Yellow plugs? Down tools and close the site ! (Well, at least in Europe)

  7. You could always put a variac before your 1:1 isolation transformer. I picked one up at a junk shop years ago, it doesn’t isolate (that’s what the other transformer is for) but it lets me vary my 230v AC from pretty much nothing, all the way up to 280v. Very useful for running up old valve radios gently :-)

  8. JC

    Your comment about the 20mA rating of the voltage shifting transformers got me thinking. Is there enhanced safety available somehow?

    The key is the low power demand, a few watts are enough. That is in the range of cheap audio amplifiers. Match the amp output impedance with a step up transformer, give it a sniff of 50hz input and voila, an infinitely variable, intrinsically safe test supply !

    Professional audio “line output” transformers exist http://singapore.rs-online.com/web/p/audio-transformer/2106475/ , but a stock 5-0-5||0-110-220 <3VA is enough.

    Your test equipment determines the output (hot) side configuration. With differential probes, ground the transformer centre point. Then maximum V exposure is halved & maximum current flow is limited by the power injected from the amplifier.

    With single-ended probes, ground one side of the transformer output as reference. The Vmax is not reduced, but the current limit is still active.

    If you recycle some substantial hi-fi unit, damp the audio output with some dummy load in parallel with the transformer to prevent supplying too many watts to the circuit.

    • You mean feed a 50 Hz sine wave into a small audio amp (or chip) and then transform the output to get into the 0..250 VAC range?

      As long as the output current stays under say 10 mA due to internal resistance, it’d be safe, right?

      Brilliant. The neat thing is that this could even generate a cleaner sine wave than the power line. Might be an excellent way to see load distortion effects, even.

      Speaking of sine waves – there’s a post coming up about that (about a week from now).

  9. I think I’ve still got a small audio amp module somewhere, powered by 12 VDC. If I hook up a small 230 <-> 6.3 V transformer in reverse, then that might be enough to generate a variable high voltage. By measuring the short circuit current I could limit the amount of power with a dummy load, as you say.

    Then feed it from a variable 45 .. 65 Hz sine wave oscillator with adjustable amplitude and that’s it? It’d make a fantastic low-power AC mains simulator!

  10. Exactly! Completely isolated and very limited ability to do the experimenter any damage.

    Getting a reference sine wave is a little harder – depends on the purity of the driving oscillator, the distortion of the amplifier and transformer effects . Chip based modules tend to be class B types which have non-linearity around the zero crossing, but <1% is available. Putting the dummy load directly on the amplifier output and oversizing the transformer will keep it in the mostly linear region.

    Fire up that new ‘scope when it finally arrives and the FFT will evaluate how good a reference the waveform is.

    Now here’s another thought. Drive the amplifier from a fast DAC (e.g. MCP4921) with precomputed coefficients and you can have the waveform of your choice with frequency as precise as the resonator !

Comments are closed.