Assuming I can figure out a way to transmit wireless information from the ATtiny, I’d like to make that recent AC current change detector a self-contained and self-powered unit. At minimal cost, i.e. with as few parts as possible.
That’s a bit of a problem. Adding a transformer-based power supply, however feeble, or a ready-made AC/DC converter would probably triple the cost of the setup so far. Not good.
I really only need a teeny bit of power. The techniques to a get a JeeNode into low-power sensing have been well-researched and documented by now. It shouldn’t be too hard to make an ATtiny equally low-power.
First of all, this “power sensing node” really doesn’t have to be on all the time. Measuring power once every few seconds would be fine, and reporting over wireless only when there is a significant change in detected current. So for the sake of argument, let’s say we measure once a second, track the average of three to weed out intermittent spikes, and report only when that average changes 20% or more since the last value. For continuity, let’s also report once every 3 minutes, just to let the system know the node is alive. So that’s one packet with a 2-byte payload every 3 minutes most of the time, and one current measurement every second (with the same ADC sampling and filtering as before).
What this comes down to is that we need perhaps 3.3V @ 10 µA all the time, with a 30 mA peak current draw every couple of minutes.
A battery would do fine. Perhaps 2x AA or a CR123 1/2 AA. But it feels silly… this thing is tied to a power line!
Why not use a transformer-less power supply, as described in this well-known application note from MicroChip?
Well, there’s a problem. These types of supplies draw a constant amount of current, regardless of the load. Whatever the circuit doesn’t use is consumed by the zener diode. So to be able to drive a 30 mA peak, we’d need a power supply which constantly draws 30 mA, i.e. 6.6 watts of power. Whoa, no thanks!
Here’s a basic resistive transformer-less supply (capacitive would also be an option):
There is a way to reduce the current consumption, since we only need that 30 mA surge very briefly, and not very often: use a big fat capacitor on the end, which stores enough energy to provide the surge without the voltage collapsing too far. This might be a good candidate for a trickle-charged small NiMh cell or even a supercap!
Hm, let’s see. If the supply is dimensioned to only supply a very small amount of current, say 1 mA, then it would be more than enough to charge that capacitor and supply the current for the ATtiny while in power-down mode. A 0.47 F supercap (which I happen to have lying around) ought to be plenty. This power supply would draw 0.22 W – continuously. Still not stellar, but not worse than several other power bricks around here.
Alas, such a design comes with a major drawback: with such a small current feeding such a large cap, it will take ages for the initial voltage to build up. I did a quick test, and ended up waiting half an hour for the output to be useful for powering up an ATtiny + RFM12B. That’s a lot a waiting for when you plug in such a system for the first time, eager to see whether it works. It also means that the firmware in the ATTiny has to very careful at all times with the limited energy available to it.
Still, I’m tempted to try this. What’s half an hour in the grand scheme of things anyway?
I’ve been looking at the same application note for some appliance control modules I’m building. I came to the same rationale as you did about not using batteries since there is an AC supply available. The issue I have with a transformer-less power supply is you lose the isolation.
If you browse the internet, you’ll find many threads about that famous AN954A from microchip. The one below is an oldy from the pic forum:
=====
You are completely right, of course. This thread started with many very clear statements against AN521.
In another thread, discussion of the infamous AN954 – resistive transformerless supply triggered a host of warnings by forum members, pointing out the various safety hazards and reliability issues that both ApNotes failed to mention.
I agree that both ApNotes are incredibly misleading. A complete reliability discussion should be included in the ApNotes, and resistor failure modes should be analysed more carefully. Actually, in the AN521 the author seems to have no knowledge of the concept of reliability and failure analysis. I completely agree that it should be removed from MCP site, along with AN954.
Unexperienced developers might risk their lives, and even design hazardous equipment that can risk the end users’ lives
=====
I guess though, that the ‘A’ version of the appnote addressed all these issues, as I see safety stuff mentioned know.
But still, you ought to be carefull ;-)
have you seen this one ? If this is not a hoax, I would expect it to be easy to pick up a bit of AC hum and use it as the powersource. http://hackaday.com/2009/06/27/avr-rfid-tag/
Yes – that’s been around for a while. Pretty amazing.
I’d love to power the chip from inductive pickup – but at 50 Hz, the power transfer is a lot worse, I believe. Also, to power the wireless – however briefly – does require some “substantial” power (in this context – it’s still just a few milliwatts).
LNK30x series from Power Integration are quite nice, adding around 10-12 components and they are ‘green’ rated at idle condition. Ok, this adds a lot of complexity, but the total ‘cost’ is quite low because of the good efficiency and low idle power. I use the LNK also for DC/DC converters with incredible input voltage range of ~18-400V DC (for output currents <~200mA).
BR, Jörg.
That’s an interesting chip, thx!
Hey, I took a stab at making my own power supply based upon that datasheet:
Am I correct in thinking when you said use a super cap, you meant putting it as C2 in my schematic? If so, I think there is a problem there. The appnote says to size C2 to 2x the voltage across D1, so a > 10.2V cap (zener @ 5.1*2) is required. “Regular” super-caps (ones that don’t cost tens of dollars) are typically only in the 3-5V range.
I really like the idea of grabbing power with this method. I’ve got several wireless power switches/light dimmers in mind with this method.
BTW – in case the image didn’t work above, my schematic is here: http://www.circuitbee.com/circuit/view/0000000185
Hm, the 2x zener voltage surprises me. I’ve got a cap which goes up to 5.5V and am using a 5.1V zener. Together with the extra 0.7V drop across the diode, that gives me 4.4V. I’ll probably add a second diode if I need to drop to 3.7V and stay within RFM12B specs (or use a lower-value zener).
Haven’t tried this out yet. See tomorrow’s post on why I used a slightly different circuit.
The .47F is a bit overkill.
Why not use a 100uF cap, charge that to 12V (zener diode limited as before) and use the MCP1702 as a voltage regulator for the controller. This way you can use the voltage swing from 12V to ~4V on the capacitor for supplying 800uAs to the controller which translates to 8mA for 100ms. This is just an example. Use the values you need for calculation of the required capacity.
This setup will ‘charge up’ much faster (~s region).
BR, Jörg.
Yes, 0.47F is overkill – it’s just what I happened to have lying around.
But I don’t think your scheme will work. The MCP1702 is a linear regulator, it’ll simply turn the voltage difference into heat. It would work with a switching regulator, though. In fact, this was one of the designs I was thinking of trying out one day: find a switching regulator which goes up to say 60V as input with 3.3V out, and then use a high-voltage zener + cap to pick up that energy using this same transformer-less design, but with less waste in the resistors.
For a clever low-power setup, I’m thinking of trying out that LNK30x chip you mentioned above.
For rock-bottom simplicity, I’d still like to get this plain transformer-less setup going. It might be possible to dramatically reduce the size of the cap, see my upcoming posts on the
19th24th and 26th.I’m pretty sure that it works (i am using this on other projects). And its is also much cheaper than the supercap (it this is not already ‘lying around’ :-) ). Yes, the MCP turns the excess voltage into heat, but the capacitor stores much more ‘energy’ at higher voltage. 1F = 1AS/V means that for every 1V voltage drop (or increase) on the capacitor, it is able to deliver (or charge) 1As current. And what the controller needs to run is current (at 3.3V).
The LNK is quite easy to use, just be sure to implement the superfast diodes where specified! EMI can be an issue, but I found it to be ok with the recommended circuit.
Ups, sorry, what i wrote is complete bullsh….
I am nearly always using a (simple) switching regulator in my other circuits, exactly as you said.
Sometimes it is better to think before writing! (And then there is no ‘edit’ possible :-) )
Hmmm, now that I am home and have time to think about it, i have to correct my correction. I am feeling a bit sheepish, but what I wrote in my last but one post was perfectly correct (using a linear regulator), so it was no bullsh….
The energy (or ‘work’) stored in a cap is W=1/2CU². When discharging the cap from 12V to 4V the energy released is W=1/2100uF(12²-4²)V²=6400uWs=6.4mWs. At an average voltage of (12+4)V/2 = 8V this means that you can discharge 0.8mAs from the cap until it reaches 4V (ok, you can go a bit lower with the MCP1702) but this is just a rough estimate). 0.8mAs is the same as 8mA for 100ms. Same result as above.
Ok, with 1mA charge current, we cannot discharge more than 1mAs per second (=1mA average), this is clear.
With a linear regulator with higher maximum input voltage we could even get more energy into the cap.
Hope that this is it. Do you follow me?
Sorry for all the embarrassment this might have caused, next time I will not post anything when I am that busy….
No worries – plenty of bits left to keep discussing things :)
My gut feeling tells me that if you discharge from 12.3V to 3.3V, then you get 9 times as much (or more accurately: as long) useful power @3.3V as you would by discharging from 4.3V to 3.3V, so in that sense yes, using a higher voltage for zener + cap will help, even though there will be more waste by the linear regulator at the 12V level. I think we’re saying the same thing…
Too bad that higher-voltage electrolytic caps are also bigger. It may not be the main issue, but I don’t want to end up with beefy 4×4 cm caps!
Isn’t there some really cheap way to use a “switched capacitor” setup to transfer charge? I.e. take a cap and alternately connect it to an input reservoir cap and an output reservoir cap?
In the end, I’ve got two different usage scenarios: one is to run a node with very sporadic packet transmit power peaks (which is what this post is about). The other is to be able to drive a relay, or at least a latching relay, for a master-slave type of AC mains switch. My hunch is that a supercap might work for a latching relay spike, and the LNK30x is best for keeping a normal relay turned on for indefinite amounts of time.
Just to pick one detail of what you said: a good way to drive a relay with comparatively low power is to switch it on with nominal voltage and keep it switched on with 1/2 of the nominal voltage. This cuts down the power needed to 1/4. Most relays will ‘keep on going’ with even much less voltage. Only thing to look after is to avoid heavy vibrations like for example in automotive use.
What I use quite often is 12V relays with a 5V (linear stabilized) power supply circuit, where the relay is driven from the unregulated 6-7V and a voltage doubler (6-7V to ~12V) is used only for the first 10-20ms of switching on. This is build up with just three small SOT23 transistors, a few diodes and some small ceramic capacitors, driven by a PWM output of the controller.
Concerning the 12V 100uF cap I was talking about, as SMD component this is just 6.3×5.4mm² ‘big’ (16V/100u), nothing to really ‘worry’ about.
Some years ago, there have been very nice chips on the market for converting the 230V AC grid voltage to low DC voltages. These chips charged a capacitor only during the small periods around the grid zero crossings, in this way avoiding large voltage drops and power loss. But I can’t remember the types and don’t know if they are still available. I never used them, because they seemed to have a bad reputation of blowing up. But the basic idea was not bad.
Thx for the great info, Jörg!
W.r.t. charge only on zero-crossing: yes, I was wondering about that. But I can imagine that it could be extremely tricky: one glitch and you end up with a much larger voltage than you’d want.
I’ve ordered some parts to experiment with the LNK30x chip. Looking forward to trying it out!
I am using quite a lot of these cheap 433MHz AC remote switches in my home which you can buy for €9.99 for a set of three including remote. But especially for outdoor use these units are not very reliable (range dependent on temperature) and they give no ‘feedback’ (means you cannot operate them blindly). Nor can any special functionality be realized, like for example a timeout counter for my outdoor 300W halogen lamp (which the children tend to ‘forget’ to switch off).
In 8 working days I will get pcbs for my remote AC ‘actor’ (simple relay switch which fits into the standard ‘hole’ behind a wall outlet). This includes an LNK305 as power supply and an ‘arduino’ (or jeenode) like controller hardware including RFM12B. If you are interested, I could send you one for evaluation then. I am planning to use a jeelink first for control via PC, later I plan to equip my appliance switches with lithium coin cell powered transceivers. Maybe I will use MSP430G series controllers there, because they are even cheaper than the Atmels and I also use them professionally in my job projects. Let’s see if there will be enough spare time this winter…….
Whee – definitely interested! Using the remote switches as enclosures and perhaps reusing the relay is also an interesting option. Do you have a source for those €9.99 sets? I don’t think I’ve ever seen them that low around here.
What’s your take on secure communication when actually controlling stuff? I have some encryption code in the RF12 driver, but never used them in a serious setup with proper key mgmt etc.
Anyway – great stuff. We’re all moving in what seems to be pretty much the same direction! I’d be interested in the MSP430 as well, btw – I’m not married to Atmel.
http://www.amazon.de/gp/product/B004BEJGC4/ref=pd_lpo_k2_dp_sr_2/278-4702859-0433402?pf_rd_m=A3JWKAKR8XB7XF&pf_rd_s=lpo-top-stripe&pf_rd_r=1V9EN0TDHHVFV6D67JCD&pf_rd_t=201&pf_rd_p=471061493&pf_rd_i=B000NNONKM
This is just one source, this is not exactly what I have. I bought mine mostly as special offers in supermarkets. The downside is that although they all looked the same (with different names on it), some work as ON/OFF on one button of the remote (second button would be for dimmimg function if they had one), others worked ON on one button, OFF on the other (which s much better if you want to operate them blindly) and others excatly the other way round.
Security is a good point, up to now I have not used it. I have once experimented with HR20 thermostats retrofitted with an RFM12B where they used XTEA (?) (OpenHR20 project). Not my main point at the moment.
Amazing price, even for three empty boxes. One would expect these to be compliant with regulations, coming from Amazon. I need to figure out how many I could possibly need in the house, try to refit one with a different pcb, and then get a bunch of them in one go. New units might never come or be completely different.
Update: can’t be bought from the Netherlands. Drat.
They are indeed damn cheap! too bad I can’t get such prices for the swiss sev-1011 type. BTW I also ordered some lnk304 to reproduce the design example 139 on PI’s website (buck converter with dual 12V/3V3 output). Thank’s Jörg for pointing this out !
The AC/DC converter is the standard application of the LNK30x series. What is even nicer is that these chips can indeed be used with ~18-400V DC input voltage to generate 5-12V DC output with ~100..200mA. There is no other DC/DC converter on the market with such a high input voltage range (AFAIK). The 18V input voltage is clearly below the datasheets minimum recommended input voltage of ~75V DC, but it works (with certain restrictions and not guaranteed by the manufacturer). I have used them this way in products which are made in quantities of several 10K per year.
Very nice chips!