Author Topic: Powering Atmel AVR off mains [laminator controller project]  (Read 21851 times)

0 Members and 1 Guest are viewing this topic.

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8420
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #25 on: September 10, 2014, 01:40:19 pm »
Most importantly, what is the best way to probe the circuit with my multimeter while keeping myself at arms length? I dont have crocodile leads rated to 250V which basically leaves me with my standard Fluke TL71 probes - do I just have to bite the bullet and get in there manually? Ideally I shouldn't have to touch the 230V coming off mains, but at the same time what if I wire it wrong - better safe than sorry! (And better sorry than dead - at least in most circumstances)
Remember that to receive a shock, current has to flow through you meaning a complete circuit. Making sure you're not grounded (or at least have a very high resistance to ground, >1M, which is why ESD straps have such a resistor in them) and doing the probing with one hand if at all possible will reduce the risk.
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2320
  • Country: au
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #26 on: September 10, 2014, 01:42:44 pm »
Remember that to receive a shock, current has to flow through you meaning a complete circuit. Making sure you're not grounded (or at least have a very high resistance to ground, >1M, which is why ESD straps have such a resistor in them) and doing the probing with one hand if at all possible will reduce the risk.

And designing circuits that rely on these sorts of rituals for safety (rather than being designed intrinsically safely) will get someone killed.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 18070
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #27 on: September 10, 2014, 01:50:47 pm »
Remember that to receive a shock, current has to flow through you meaning a complete circuit. Making sure you're not grounded (or at least have a very high resistance to ground, >1M, which is why ESD straps have such a resistor in them) and doing the probing with one hand if at all possible will reduce the risk.

And designing circuits that rely on these sorts of rituals for safety (rather than being designed intrinsically safely) will get someone killed.

I agree
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #28 on: September 10, 2014, 02:10:29 pm »
Sorry, will reply to the other posts when I get back from work!

Quick question, see how this is labelled as an "Isolated TRIAC" , what does that actually mean? I can't find much on the datasheet about it (I think this is the summary datasheet) Does it mean it's electrically isolated or is it some terminology for TRIACs that I've overlooked?

Many thanks!
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 18070
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #29 on: September 10, 2014, 02:19:51 pm »
I can't sere how it can be isolated, you have "-", "+", "signal", that's 3 the "-" generally is in common with the signal, and so not isolated, you need a 4th terminal, I don't see that.
 

Offline PepeK

  • Regular Contributor
  • *
  • Posts: 62
  • Country: sk
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #30 on: September 10, 2014, 02:47:30 pm »
Sorry, will reply to the other posts when I get back from work!

Quick question, see how this is labelled as an "Isolated TRIAC" , what does that actually mean? I can't find much on the datasheet about it (I think this is the summary datasheet) Does it mean it's electrically isolated or is it some terminology for TRIACs that I've overlooked?

Many thanks!

Non isolated triac in the TO 220 package = metal plane used for a cooling is connected to one of the pins (A1 or A2).
Isolated triac = metal plane is isolated from all pins. This has a meaning if you install multiple triacs on one common heatsink.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 18070
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #31 on: September 10, 2014, 03:38:08 pm »
Well that website is telling a clear lie and don't know what they are talking about. The datasheet makes it clear enough.
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #32 on: September 10, 2014, 04:03:51 pm »
Finally home from work: will chalk up a circuit diagram in a couple of hours (the usual barrage of household tasks I'm afraid!)

Quote
Well that website is telling a clear lie and don't know what they are talking about. The datasheet makes it clear enough.
Ha! I only use them for one-off parts and small projects as they're cheaper than Maplin.

Quote
And designing circuits that rely on these sorts of rituals for safety (rather than being designed intrinsically safely) will get someone killed.
Indeed! Duly noted :P I'm leaning towards battery-powering the atmel and having it in a small externally mounted project case and connected to the optocoupler inside the casing for the laminator: that way I can tinker all I need on the outside (and more importantly, change the batteries) and at the same time isolate it from the main circuit via the optocoupler to the TRIAC.

Can you confirm that would actually work the way I think it would? (i.e. is it safe xD)

--EDIT--

Actually, having said that - that's kinda taking the easy way out - I'll investigate using a transformer.
« Last Edit: September 10, 2014, 04:09:14 pm by cprobertson1 »
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 18070
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #33 on: September 10, 2014, 04:26:15 pm »
You will still need power to the triac gate but making sure it's a;; sealed up is good.
 

Offline eneuro

  • Super Contributor
  • ***
  • Posts: 1541
  • Country: 00
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #34 on: September 11, 2014, 09:15:18 pm »
But don't forget that relays require way more current to turn on than a TRIAC or optotriac.
There is also something like AC mosfets switch, which require much less current -only charge mosfets VGS which in my case of two 1000V 3Ohm RDSON mosfets in series is about 2000pF to charge during switch ON and the same to discharge to switch this thing OFF, but did not tested it with inductive loads so far-maybe current sensing will be needed to switch it off in current minimum/zero like a triac driven loads.
Just finishing its galvanic isolated 0.5A-1A gate driver isolated from MCU via 5kV optocoupler ;)

One of the differences between triac and AC mosfet switch is it stays open when switched on regardless of current and one can put many mosfets in pararell to lower RDSON, while triac will switch off when current drops below its lower limit, and should be switched on again.

12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
“Let the future tell the truth, and evaluate each one according to his work and accomplishments. The present is theirs; the future, for which I have really worked, is mine”  - Nikola Tesla
-||-|-
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #35 on: September 12, 2014, 07:09:56 pm »
Hi, sorry, was busy - in the process of moving between two jobs at the moment and all the fun that surrounds that!  :palm:

ANYWAY - care to opine on the schematic? Long story short I'll keep all the "low voltage section" in a small enclosure that will be mounted on the outside of the case with one wire going to the inside and linked to the TRIAC.

Incidentally, were I to use a transformer, is it just a case of tapping the right voltage off it and feeding it to the low voltage section in place of that battery (with some diodes and caps for a rectifier? Come to think of it - will that TRIAC need a heatsink?
« Last Edit: September 12, 2014, 07:20:08 pm by cprobertson1 »
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 18070
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #36 on: September 12, 2014, 07:38:52 pm »
as we explained previously this won't work, where is your ground reference for the triac between triac and opto coupler ? the opto coupler goes on the mains side so that you have the input coming out of the laminator and that is isolated.
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #37 on: September 12, 2014, 10:27:53 pm »
Quote
as we explained previously this won't work
Oops sorry, misread your previous message!

Okaydokeys - will have another bash at it. Ubern00b moment - my apologies! Will get back to you all shortly - thanks again for your help and patience btw =/
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2320
  • Country: au
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #38 on: September 12, 2014, 10:44:59 pm »
as we explained previously this won't work, where is your ground reference for the triac between triac and opto coupler ? the opto coupler goes on the mains side so that you have the input coming out of the laminator and that is isolated.

True; but take that optocoupler, replace it with an optotriac (MOC3023 or similar), and just move it to the right so its triac pins are on the high voltage side (see MOC3023 datasheet). Then the circuit looks fine (except the current to the LED in the optotriac/optocoupler isn't current-limited by any resistor).
 

Offline LukeW

  • Frequent Contributor
  • **
  • Posts: 686
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #39 on: September 13, 2014, 04:05:16 am »
Does your power supply have to be galvanically isolated from the mains or not?

Non isolated options:
- Transformerless capacitive-reactance power supply, eg. see Microchip AN954 for a general overview, if only very small power is needed.
- Some HV off-line buck converter ICs such as TEA1721 from NXP or some of the PowerIntegrations ones.

- Isolated options:
- Some of the "potted blob" small flyback SMPS modules from MornSun or CUI, eg. CUI PBK-1-5
- Some of the larger board mount flyback SMPS modules, eg CUI VOF-6-5

Over the years Silicon Chip magazine has had several projects such as light dimmers and fan timers where they have run a PIC and a triac directly from 240VAC in an enclosed double insulated device using a transformerless power supply (similar to AN954) with no optocouplers or galvanic isolation or flyback SMPS. Perhaps looking at some of those circuits could give you ideas, if this is the same sort of thing you're trying to do. But make sure you understand the safety implications of that - don't touch the microcontroller or connect anything to it while the mains is on.
« Last Edit: September 13, 2014, 04:07:45 am by LukeW »
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2320
  • Country: au
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #40 on: September 13, 2014, 08:32:13 am »
- Transformerless capacitive-reactance power supply, eg. see Microchip AN954 for a general overview, if only very small power is needed.

Very interesting reference, but one thing that baffles me about the circuits is that they output line & line - 5v rather than neutral & neutral - 5v. Surely that can only be bad news? I just can't think of a good reason to do that...
« Last Edit: September 13, 2014, 08:34:04 am by rs20 »
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8420
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #41 on: September 13, 2014, 12:21:13 pm »
Very interesting reference, but one thing that baffles me about the circuits is that they output line & line - 5v rather than neutral & neutral - 5v. Surely that can only be bad news? I just can't think of a good reason to do that...
If it's in an isolated and doubly-insulated device, there is no ground, and with an unpolarised plug it shouldn't matter which is line/neutral - they're both just as live.
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2320
  • Country: au
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #42 on: September 13, 2014, 01:01:05 pm »
Very interesting reference, but one thing that baffles me about the circuits is that they output line & line - 5v rather than neutral & neutral - 5v. Surely that can only be bad news? I just can't think of a good reason to do that...
If it's in an isolated and doubly-insulated device, there is no ground, and with an unpolarised plug it shouldn't matter which is line/neutral - they're both just as live.

OK, so in some (maybe even 99%) of cases, it makes no difference. But in that 1% case, when you're talking about a device in a country that uses Multiple Earthed Neutral (e.g. NZ, Australia) using a polarised socket, and that misfiring cordless drill goes through your washing machine into the controller circuitry, this circuit will get you killed. I don't care if you can contrive cases where it makes no difference -- if you can't tell me a reason to do it, it's irrelevant, especially when I can point out how potentially deadly it is. If engineers copy and produce the circuits in this datasheet in quantity, people will die as a direct consequence. I find that horrifying.
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16366
  • Country: za
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #43 on: September 13, 2014, 02:49:36 pm »
- Transformerless capacitive-reactance power supply, eg. see Microchip AN954 for a general overview, if only very small power is needed.

Very interesting reference, but one thing that baffles me about the circuits is that they output line & line - 5v rather than neutral & neutral - 5v. Surely that can only be bad news? I just can't think of a good reason to do that...

They use the positive lead as a common connection, and drive the triac with -5V because most triacs are a lot easier to trigger drawing a current out of the gate. You may find it strange that a triac can be triggered with either a current in or out of the gate irrespective of the mains instantaneous polarity but it does work.

The voltage is only referenced to the common rail, that it is swinging up and down between +340v and -340V with reference to the earth is not related, you can plug it in the line or the neutral ( referenced to mains earth) line wityh no difference in operation.
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2320
  • Country: au
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #44 on: September 13, 2014, 03:16:10 pm »
The voltage is only referenced to the common rail, that it is swinging up and down between +340v and -340V with reference to the earth is not related, you can plug it in the line or the neutral ( referenced to mains earth) line wityh no difference in operation.

I understand it doesn't affect the operation of the circuit. Again, my whole point is that having a rail swinging up and down between +340v and -340V with reference to the earth becomes extremely relevant to one's interests when you have one finger on that rail and another finger on earth. Yes, maybe the person in that situation has done something truly strange and shouldn't be surprised to die, but again you've said that "it doesn't matter" and I think if it really doesn't matter then the safer option should be encouraged? I don't know why both of you are defending a clearly more dangerous solution by saying that the bad design decision doesn't have any positive consequences. Like saying wearing a seatbelt is pointless because, hey, you still reach your destination, right?
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16366
  • Country: za
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #45 on: September 13, 2014, 03:26:44 pm »
In operation it does not matter, but for debugging or repair it does, but these are not normal operation considerations. You have multiple non earthed appliances, and the PC or laptop you use has a power supply that is both non isolated and floating with respect to the mains, and is lethal on the primary side to touch.
 

Offline eneuro

  • Super Contributor
  • ***
  • Posts: 1541
  • Country: 00
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #46 on: September 13, 2014, 08:52:08 pm »
In operation it does not matter, but for debugging or repair it does, but these are not normal operation considerations.

Probably something like this might work, while this prototype works at home 24h a day/7days a week as a small air fan speed controller  ;)  Triac i sswitched in zerro-crossing by  mentioned MOC304x based microcontrolled AVR DIP8 ATTiny85 MCU powered by rectified 1000V KBPC full bridge step down to 12V by 1W Zener diode from 230VAC mains with 470nF MKT cap and about 440 Ohm in series with 2x 100k resistors (to prevent sparks) on this high voltage cap to discharge-I do not like when I put 230VAC plug into the wall and there are sparks or touching 230VAC after removeing from wall socket,

Of course someone can say there is no sense put optoisolator on AVR pins while MCU is powered from mains... well its easy switch on/off 230VAC triac using this MOC304x ICs (wih snubber network while I have BTA16 triac http://www.onsemi.com/pub_link/Collateral/BTA16-600CW3-D.PDF -not snubberless version but WITH INSULATED RADIATOR TAP -it does not mean I touch it -i use multimeter temperature sensor regrdless it is insulated or not!!! (BT138 has MAINs on TAP as I remember http://www.nxp.com/documents/data_sheet/BT138-600E.pdf yep mains terminal 1, so I do not recommend it for new mains players who wants very often touch it to see if it get hot !!!) and if I wanted galvanic insulated MCU and only one part touchable here this potentiometer, than.. I can remove top-left big red cap and those few bigger resistors and KBPC bridge and in this place simply solder inputs from external 230VAC -> 9V-12V wall adapter and I have fully optoisolated down half PCB from 230VAC mains, but power consumption of DC MCU control circuit is less than 20mA  and its internals not easy to touch, so In this DIY version there is no external galvanic insulation of MCU circuit, but can be done easy if needed 8)
Of course there is 230VAC 2A fuse hidden by triac radiator disconnecting AC mains brown load  ;)

BTW: If someone made ever teardown of hairdryer and saw those 230VAC wires with DC motor powered by diodes and voltage taken from resistive red hot springs cooled only by its fan and imagine how close it is to human wet hair.... it is better do not know what is inside those things and how it works  :-DD
« Last Edit: September 13, 2014, 09:11:06 pm by eneuro »
12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
“Let the future tell the truth, and evaluate each one according to his work and accomplishments. The present is theirs; the future, for which I have really worked, is mine”  - Nikola Tesla
-||-|-
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8420
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #47 on: September 14, 2014, 12:38:46 pm »
OK, so in some (maybe even 99%) of cases, it makes no difference. But in that 1% case, when you're talking about a device in a country that uses Multiple Earthed Neutral (e.g. NZ, Australia) using a polarised socket, and that misfiring cordless drill goes through your washing machine into the controller circuitry, this circuit will get you killed. I don't care if you can contrive cases where it makes no difference -- if you can't tell me a reason to do it, it's irrelevant, especially when I can point out how potentially deadly it is. If engineers copy and produce the circuits in this datasheet in quantity, people will die as a direct consequence. I find that horrifying.
If you "find that horrifying" maybe you should stop driving because you could die in an accident, doing any sort of travel for the same reason, eating food because you could die of food poisoning, ...  :)

There's always a risk. As the saying goes, "life is the leading cause of death". Engineering is all about tradeoffs and in this case if using a non-isolated supply means 99% of people benefit from a cheaper product while the truly idiotic 1% get killed, maybe it's worth it. (Statistically speaking the risk of electrocution is very rare, compared to a lot of other things that people do every day without ever worrying about it, so even 1% is a huge overestimate!)
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2320
  • Country: au
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #48 on: September 14, 2014, 01:16:38 pm »
There's always a risk. As the saying goes, "life is the leading cause of death". Engineering is all about tradeoffs and in this case if using a non-isolated supply means 99% of people benefit from a cheaper product while the truly idiotic 1% get killed, maybe it's worth it. (Statistically speaking the risk of electrocution is very rare, compared to a lot of other things that people do every day without ever worrying about it, so even 1% is a huge overestimate!)

Oh. My. God. How can I make this any clearer:

"Risky thing"            Risk                        OFFSETTING BENEFIT
-------------------------------------------------------------------------------------
Driving a car            Car crash                   Being able to see friends and family, check

Eating food              Food poisoning              Survival, check

Transformerless          Potential electrocution     Reduced BOM, check
    power supply           if insulation is broken 

The choice to tie uC     Many more circuit nodes,    WTF GOES HERE
    to live instead of     (e.g. all of uC) are at
    neutral                dangerous potential


I understand perfectly well that risks need to be taken, but I say risks should only be taken if you can freakin' NAME a potential counter-benefit. Everyone here has failed to name that counter-benefit. I don't mean the benefit of transformless power supplies, but specifically the benefit of choosing live as a reference instead of neutral. What I'm proposing is exactly the same circuits as in AN954, but with line and neutral switched so that now the majority of the nodes in the circuit are at a typically safe potential. Same BOM, safer (and yes, I don't care if it's 1 ppm risk of death instead of 1.01 ppm, it's still unacceptable to choose the worse option for NO REASON). Am I wrong?   
 

Offline mrkev

  • Regular Contributor
  • *
  • Posts: 225
  • Country: cz
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #49 on: September 14, 2014, 10:23:17 pm »
Well, it's the very same circuit either way. Even in multiple grounded system, you could have live voltage where neutral should be (f.e. with badly made extension cord). So even if you'd do what you propose, you can't garantee that it's gonna be at neutral or N+5V and you'll HAVE TO double insulate all the function parts of the powered device.
Since you are using double insulation, you don't wanna use cord with 3 pins, so the answer to that "wtf goes here" is, it's just a simplyfied circuit and they are using power cord with just 2 pins, so live and neutral are exchangable -> worst case is on the picture...

Using power cord with 3 pins will not 100% garantee the right connection of neutral, so it's NOT any added safety! It's just wasted money -> use it on better insulation instead...
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf