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

0 Members and 1 Guest are viewing this topic.

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Powering Atmel AVR off mains [laminator controller project]
« on: September 09, 2014, 05:28:19 pm »
So I've finally got round to etching my own PCBs - and decided to streamline the process a little bit when it comes to passing the board through my Laminator by controlling the motor for the rollers (AVR > Optocoupler > TRIAC) but ran into a problem.

When I tore down the laminator I discovered, much to my chagrin, that the motor runs at mains voltage taken straight from the plug! Not even a board inside it to mod...

Oh well - just means I need a bigger Triac? Well... yes and no - I also need to power the AVR that's running the whole shebang! (actually, I could probably use an NE555 to do the same thing but hey-ho - that won't be as easy to adjust ;))

So what *is* the best way to power my board when all I have is 230V mains AC? Any ideas? This gent here has done something similar - but I can't see how he's getting the power to his PIC - I assume he's not throwing mains voltage to it but I can't see anything by way of voltage rectification or transformers!
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17815
  • 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 #1 on: September 09, 2014, 05:34:58 pm »
nothing stopping you using mains dropping resistors with single rectifier diode into a zener with a cap in parallel. Not the most isolated method though. I'm currently fixing some hair straighteners that work in this way, for some unearthly instead of using a comparator they used a pic and even relabeled it.
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #2 on: September 09, 2014, 06:22:55 pm »
Quote
for some unearthly instead of using a comparator they used a pic and even relabeled it.
What in the name of... weird - I would have thought that overkill for straighteners :O Then again, I suppose if you want precise temp control it might be the best option...possibly...

Quote
not the most isolated method though.
I'm not **too** worried about formally isolating it - it will all be inside the plastic casing - if I accidentally blow the arse out of it I have a coffee jar full of ATTiny13s (it's a long and boring story - grabbed them from the uni - they were going to throw them out!)

I've not dealt much with AC I'm afraid - let alone mains! (it scares me)

ANYWAY - so just to confirm: big resistor to drop the AC voltage down to the target voltage range of the AVR > high voltage diode to take out half the wave from the AC > zener+cap [parallel] to smooth out the remainder?

What's the name of this method of dropping the voltage btw? Actually... come to think of it... which equations would I use to calculate the size of the dropper resistor (is it simply Ohms law for the voltage drop at the target current > calculate power using P=I^2.R?) (that works out at... 1.125k ohms and 45W for the resistor I think? (assuming 0.2A for the AVR + triac trigger current so I'm probably overestimating it - but that seems kinda high -taking we're talking about alum clad resistor-sort of level here?)
« Last Edit: September 09, 2014, 06:24:49 pm by cprobertson1 »
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17815
  • 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 #3 on: September 09, 2014, 06:28:21 pm »
Better scared and cautious of the mains than cocky and dead. It took me 3 months to look at a work colleagues hair straighteners because I never had time to sit down and do it properly and calmly having cleared space.

200mA, are you joking ? for that you need a plug pack. You AVR won't need more than 5-10mA i don't know how much drive the triac needs.

Yes ohms law for the resistor value, my comment on isolation was more about yours and others safety in what sounds like may be a bodge.

Make sure that the "-" side is true main neutral and you have a chance of surviving if something goes wrong.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17815
  • 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 #4 on: September 09, 2014, 06:30:45 pm »
Quote
for some unearthly instead of using a comparator they used a pic and even relabeled it.
What in the name of... weird - I would have thought that overkill for straighteners :O Then again, I suppose if you want precise temp control it might be the best option...possibly...

Not that I'm an expert but I don't think so, the ADC or internal ref will have 1023 steps thats 4.88mV at 5V supply of resolution, offset errors on comparators are 2mV or less, it would mean though that different models could be reprogrammed etc but really I never saw why. Probably someone didn't know how to use a comparator.
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16283
  • Country: za
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #5 on: September 09, 2014, 06:40:25 pm »
Resistive power supply or even a 220n 400VAC class X2 capacitor, a diode, a 12V zener diode and a 470uF 25V capacitor then you will have a non isolated power supply for the PIC. Tip is to drive the triac in quadrant 4, with the common of the power supply being the one mains rail and the whole MCU having a -12V circuit with a 7905 regulator to drive the MCU, with a 2N2222 to the -5V rail driving the triac via a 220R resistor, with a 1k resistor holding it in the off state when desired. Most speed controllers use this method.

http://www.mouser.com/catalog/specsheets/stevalill004v1.pdf

This illustrates the whole idea, look on p9 for the circuit.
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16283
  • Country: za
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #6 on: September 09, 2014, 06:41:22 pm »
Quote
for some unearthly instead of using a comparator they used a pic and even relabeled it.
What in the name of... weird - I would have thought that overkill for straighteners :O Then again, I suppose if you want precise temp control it might be the best option...possibly...

Not that I'm an expert but I don't think so, the ADC or internal ref will have 1023 steps thats 4.88mV at 5V supply of resolution, offset errors on comparators are 2mV or less, it would mean though that different models could be reprogrammed etc but really I never saw why. Probably someone didn't know how to use a comparator.

GHD right..............

Televisionmagforum has a whole series of videos on fixing them on YT.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17815
  • 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 #7 on: September 09, 2014, 06:48:49 pm »
yea the most common fault is one of the main mains dropper resistors fail.........
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16283
  • Country: za
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #8 on: September 09, 2014, 06:53:22 pm »
No, most common is you were sold a fake one...........

Then again here a genuine GHD is darn expensive, and even there you are not sure unless you buy from the authorised agents. Fonk kong mall ones are dirt cheap, and I simply aim them at the round file when I get asked if I can fix it.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17815
  • 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 #9 on: September 09, 2014, 06:55:28 pm »
Well my colleague assures me they are original and to be honest I was impressed with how well made they are, I mean they even screwed down the heater wires to the PCB rather than just solder them.
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #10 on: September 09, 2014, 06:59:32 pm »
Quote
200mA, are you joking ?

Ha! Sorry, meant to be 0.2mA not 0.2A! haha - lol sorry, ATTiny13 runs at 240 microAmps at 1MHz and I'm running it at 0.1MHz which is about 0.13-0.15mA according to the datasheet. 50mA for the gate trigger on the triacs I have handy though - might need to see about finding a lower power version. Again, since I'll be buying parts in it's not a problem xD

Quote
Better scared and cautious of the mains than cocky and dead.
Very true! ;)

I'm considering just powering it from a battery and hacking a battery slot on the top of the casing. BUT then again I wouldn't actually learn anything from doing that ;)



Quote
Resistive power supply ... resistor holding it in the off state when desired. Most speed controllers use this method.
Thanks SeanB! Will look into that soon!
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16863
  • Country: lv
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #11 on: September 09, 2014, 07:09:18 pm »
You don't need much average current to drive triac. You can open it with short pulses and it will stay open until mains voltage becomes zero again. Either sense mains or just do multiple short pulses. So All the thing will consume a small current, you only need a big enough capacitor to supply current during those pulses.
 

Offline mrkev

  • Regular Contributor
  • *
  • Posts: 225
  • Country: cz
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #12 on: September 09, 2014, 07:28:31 pm »
The problem with powering your circuit from uninsulated mains is the uninsulated mains... If someone swap the neutral with the live, the circuit will work, but you'll get the live potencial at your gnd... So use this only if you can insulate WHOLE device completely.
Other thing is that cap is usually better than resistor (they are often used together). There is gonna be voltage drop, but as the voltage on cap is not in phase with the current, it won't get hot. This method is OK, if your current is below few mA (IMHO that is enough for you), making voltage drop on resistor about 50V and another 200V on cap; so you shouldn't need more than 2W resistor... Somethimes (especially cheap chineese circuits) use something like 0.5W or 1W resitori nstead of fuse...
 

Offline kingofkya

  • Regular Contributor
  • *
  • Posts: 143
  • Country: us
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #13 on: September 09, 2014, 08:28:57 pm »
You might want to check this part out. Just follow the app notes in the datasheet.
http://www.mouser.com/ds/2/149/FSAR001B-112572.pdf

You can do the same thing with transistors and passives but you have to pay attention to how your biasing transistors.As well as capacitor droppers. Here is a few of my experiences if that helps. http://hackaday.io/project/1092/logs


 

Offline eneuro

  • Super Contributor
  • ***
  • Posts: 1528
  • Country: 00
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #14 on: September 09, 2014, 09:29:33 pm »
50mA for the gate trigger on the triacs I have handy though - might need to see about finding a lower power version.
Rather consider using zero-cross optoisolated triac driver MOC3043 with LED trigger current 5mAmax  in the case of 3043 version while 3041 has 15mAmax and 3042 10mAmax ;)
I used to add NPN transistor on AVR output pin and @ 5V MCU power supply 330R resistor in series with MOC3041 input LED, so while it is abput 1.2Vf on this diode we get about 11mA current and there were no problems even with MOC3041 to drive BTA16 triacks, while MCU pin with 4.7k resistor makes very small switching current in AVR.
Those values 15mAmax, 10mAmax, 5mAmax are maximum triger currents and it looks like they are switched at much lower currents, but I used to limit this current to about 10mA and do not care which version of MOC304X I put into circuit it works  8)

« Last Edit: September 09, 2014, 09:31:41 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
-||-|-
 

Online amyk

  • Super Contributor
  • ***
  • Posts: 8275
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #15 on: September 10, 2014, 02:58:58 am »
The input clamp diodes on PICs are sufficiently well-spec'd that they could probably be used both for powering it and as a triac trigger at the same time:
http://ww1.microchip.com/downloads/en/AppNotes/00521c.pdf
http://ww1.microchip.com/downloads/en/AppNotes/00954A.pdf

Since the motor is unlikely to operate at the low current consumed by the MCU, you could arrange it so that the voltage across the triac powers the rest of the circuit through a capacitive/resistive dropper when it's off, and when the triac is on, a low-value resistor provides the necessary voltage.

I'll also echo the remarks about these simple direct-mains-powered circuits being non-isolated, and thus you should exercise caution and isolate any user-accessible parts.
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #16 on: September 10, 2014, 09:16:50 am »
Quote
I'll also echo the remarks about these simple direct-mains-powered circuits being non-isolated, and thus you should exercise caution and isolate any user-accessible parts
Whole laminator has a plastic outer casing: there's an aluminimium bar inside it going across the rollers, if it went live it could in theory transmit to any copper clad board going through it but it has mains going to power resistors on it for the heating anyway. I'll test it with the casing on at any rate ;)

Quote
The input clamp diodes on PICs are sufficiently well-spec'd that they could probably be used both for powering it and as a triac trigger at the same time
Mind I'm using an AVR ATTiny13 ;) I trust them about as far as I can throw them. Which to be fair is about 30 meters so that's not as bad as it sounds.

Quote
eneuro, kingofkya, amyk
will check your links tonight - at work just now and the firewall is blocking them xD


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)


Thank you all for your help by the way! I'll get a few circuit diagrams up tonight for "approval" xD
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17815
  • 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 #17 on: September 10, 2014, 09:30:33 am »
power anything under test from an RCD!
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #18 on: September 10, 2014, 10:33:41 am »
Quote
power anything under test from an RCD!
Very good shout! Will do!

Im considering just making the timing device (with the AVR) battery powered in order to keep away from the mains entirely: I can trigger the motor with a TRIAC or a relay while keeping myself more or less well away from the mains. Will also make it a bit more modular so I can modify it in future as required. In terms of safety this is probably the best option - at least until I know more about AC and mains power.

--edit--
IF I do go battery-powered I'll still post a proposed schematic for the circuit as if it were running from the mains - might as well turn it into a learning experience and get some feedback on it and advice on how to improve it!
« Last Edit: September 10, 2014, 10:37:10 am by cprobertson1 »
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17815
  • 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 #19 on: September 10, 2014, 11:06:19 am »
You will still need a common connection for the mains and still won't be isolated unless you use an optocoupler if that can be done. A relay is a good idea, if it's low speed switching like every few seconds it will be fine
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #20 on: September 10, 2014, 11:24:16 am »
Probably going to be switching on for [1/10 to 1/2 seconds, off for 10 seconds]: i.e fairly slow.

Quote
You will still need a common connection for the mains and still won't be isolated unless you use an optocoupler if that can be done.
l be using an optocoupler/TRIAC sorry - meant to say earlier xD. Was just going to feed a wire down through the case from the IC (the signal line should be low voltage DC) and have all the high voltage stuff like the relay or optocoupler/TRIAC inside)

I think I actually have a couple of high voltage relays salvaged from my old boiler lying around - think they were made my Omron and can take up to 400V or 10A so that's well within limits.

How isolated are relays? i.e is there a risk I'd end up with mains going through to the signal wires from the microcontroller? I'm pretty sure there's a partition inside these ones separating the coil from the switching elements - can't remember, I have touched them like once since I got them.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17815
  • 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 #21 on: September 10, 2014, 11:27:03 am »
Isolation on relays is generally many hundreds if not a few thousands of volts, check yours out. Yes you could use relays it's not the most efficient but possibly simpler for you right now.
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #22 on: September 10, 2014, 12:14:07 pm »
Omron G5L relays (contacts 10A/250V) are good for 2 kV @50/60Hz for up to 1 min, impulse 4.5kV isolation.
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #23 on: September 10, 2014, 12:38:01 pm »
But don't forget that relays require way more current to turn on than a TRIAC or optotriac. You're never going to drive a relay using a linear regulator off mains. If you want isolation, use an optotriac, these are very easy to use, just follow the example diagrams on the optotriac datasheets.
 

Offline PepeK

  • Regular Contributor
  • *
  • Posts: 62
  • Country: sk
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #24 on: September 10, 2014, 12:43:10 pm »
Buy the smallest 1 - 2 VA transformer from 230 or 120 V to 6 or 9V and create a circuit : rectifier, filtering capacitor, 7805 stabilizer. Non isolated mains are really dangerous, imagine one day you decide to flash a new program via ISP connector and your computer will connected through ISP cable to mains ...
 

Online amyk

  • Super Contributor
  • ***
  • Posts: 8275
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: 2318
  • 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: 17815
  • 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: 17815
  • 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: 17815
  • 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: 17815
  • 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: 1528
  • 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: 17815
  • 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: 2318
  • 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: 2318
  • 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 »
 

Online amyk

  • Super Contributor
  • ***
  • Posts: 8275
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: 2318
  • 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: 16283
  • 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: 2318
  • 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: 16283
  • 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: 1528
  • 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
-||-|-
 

Online amyk

  • Super Contributor
  • ***
  • Posts: 8275
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: 2318
  • 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...
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #50 on: September 14, 2014, 11:29:00 pm »
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...

Is it written anywhere that they're using a 2 pin plug? This circuit is equally applicable to a grounded-frame, toaster-type application (correct me if I'm wrong). In any case, you just haven't answered my question at all because using neutral instead of live is no more complicated; you haven't named a benefit of using live compared to neutral.
 

Offline mrkev

  • Regular Contributor
  • *
  • Posts: 225
  • Country: cz
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #51 on: September 14, 2014, 11:41:53 pm »
I didnt name benefit, bucause whole question is wrong. You can't garantee connection to live/neutral. So you have to count with worst case, which is in the schematic (the only benefit is that you, and any designer, can actually see that it is on live potential)... How do you wanna make sure, that it's always gonna be connected the way you want?
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #52 on: September 15, 2014, 12:19:47 am »
I didnt name benefit, bucause whole question is wrong. You can't garantee connection to live/neutral. So you have to count with worst case, which is in the schematic (the only benefit is that you, and any designer, can actually see that it is on live potential)... How do you wanna make sure, that it's always gonna be connected the way you want?

Thanks for taking the time to explain, we're getting somewhere now. I agree that the worst case for both designs is equally bad, because live/neutral might be switched. But when worst case is equally bad, you choose the option that's most likely to be good. And in many cases, that worst case is far less common with a (nominally) neutral-referenced. I'm making a probabilistic argument here: on extremely rare occasions the insulation will be defeated, on many occasions the plug will be 3 pronged, on most occasions the cord will be wired correctly, therefore the (nominally) neutral-referenced circuit has a lower expected number of electrocutions. E(electrocutions with neutral-referenced circuit) < E(electrocutions with live-referenced circuit). So I don't need guarantees, nor do I need to "make sure" that the wiring is done the way I expect it, because as long as the wiring is done right at least 51% of the time, my argument still holds.

I am intrigued (and convinced, in a oh-geez-are-you-serious kind of way) by your argument that making the circuit live makes sure that the design engineers know what they're dealing with. The thought that a design engineer might get N and E confused and design a circuit with exposed N is kinda depressing, but I can see that happening. So weird to make a circuit more (statistically/probabilistically) dangerous only so that people know it's dangerous, and therefore treat it with the respect that it deserves. I can see that being a far bigger consideration than the tiny probabilities I'm talking about above.
 

Offline mrkev

  • Regular Contributor
  • *
  • Posts: 225
  • Country: cz
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #53 on: September 15, 2014, 12:29:59 am »
Well I wouldn't care about proffesional designers, but you never know when hobbyists are involved :). Sure, using metal case, 3 pin plug and connecting whole thing on neutral pottencial is the best way to do it. But as it's not written anywhere, I count on 2 pin plug and it's better to show more dangerous case right in schematic.
That reminds me of one of my friend, who didn't realise (in second year of high school) that when you use bridge rectifier, you will end up with BOTH nodes (vcc and gnd) connected to live mains, each just half of the time...
« Last Edit: September 15, 2014, 01:26:37 am by mrkev »
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #54 on: September 15, 2014, 11:57:09 am »
[Reads up]

Crikey! That was an interesting and enjoyable read ;)

Quote
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).
Will do - was using a seperate optocoupler + triac as it's just what I had handy; will look into getting an optotriac :)

Yeah, I did wonder about putting a limiting resistor on the optotriac/coupler but didn't have a full datasheet so I figured I'd wait until I figured out the course details before going into the finer things xD

Quote
Well I wouldn't care about professional designers, but you never know when hobbyists are involved
I second that warning! I've seen some funky things in my time, and some of them were even my fault ;) Never open up your old projects unless you're ready for a shock. Pun not intended...

@eneuro: will look into it!
@LukeW: Thanks - again, will look into it!



Woo - thats the catchup over - I reckon I'm going to do a teardown on a couple of high and low end transformers (namely plug packs) and get an idea of what sort of structure to expect; might as well do my research before playing with mains! I've also bought a textbook on the subject as well so I'll be getting back to you soon with what I hope will be a step forward ;)
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #55 on: September 16, 2014, 06:41:08 pm »
I've been looking at TRIACS and optocouplers and it's hurting my head - in terms of simplicity and avoiding having to buy too many parts in I think a relay is the best option as I have all the parts I'll need right here.

Might anybody care to opine on this circuit?

(NB battery will be a 9V to power the relay: I've not included the 5V regulator for the Atmel)
 

Online NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9016
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #56 on: September 16, 2014, 11:18:59 pm »
"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

If you're driving a triac directly from the microcontroller, the microcontroller supply would have to be directly connected to hot in order to allow the triac to switch the hot instead of the neutral. That can end up safer than switching the neutral and making the loads live all the time.

One trick you can use is to use a series RC circuit to drive the gate of the triac (sized such that capacitor passes enough current to trigger the triac and the resistor only enough to limit transients), then have a small MOSFET shunt the gate to common in order to turn the triac off.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #57 on: September 17, 2014, 07:01:42 am »
just noticed I uploaded the wrong schematic, sorry - will fix it once I get back from work - was just replacing the optocoupler/triac with a relay


---EDIT--- [to avoid double-posting xD]

See a "optocoupled triac driver" such as the TLP3041, 3042 and 3043 from Toshiba; can that control the motor directly, or do I need to put the output from that to a seperate triac?
« Last Edit: September 17, 2014, 11:19:50 am by cprobertson1 »
 

Offline mrkev

  • Regular Contributor
  • *
  • Posts: 225
  • Country: cz
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #58 on: September 17, 2014, 12:13:39 pm »
Just read the datasheet:
  • Peak Off-State Voltage : 400 V (min)
  • On-State Current : 100 mA (max)
I wouldn't use anything below 600V on 230V mains and that current means, that you can power only things below 20W... However you can swich your power triac with this (much more easily than with that opto you had before).
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #59 on: September 17, 2014, 01:31:09 pm »
Quote
I wouldn't use anything below 600V on 230V mains and that current means, that you can power only things below 20W... However you can swich your power triac with this (much more easily than with that opto you had before).

Excellent! I wasn't sure if there was something peculiar hiding somewhere that I'd missed - good to know I can run things directly off it should the need arise! Good shout on the 600V max - I think these are aimed at 115Vac instead of my 230Vac

I'll need to buy them in specifically from somewhere if I want the higher voltage option: which makes me lean towards using one of the relays I already have - though I'm still wondering if that 230VAC listed on the side of them is the max or the intended voltage... the only copy of the datasheets I could find required you to pay for them |O

Anyway, back to work for me - will post my findings and plans here!
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #60 on: September 19, 2014, 09:12:59 am »
Quote
I wouldn't use anything below 600V on 230V mains
I just noticed all the optotriacs on spiratronics are 400V rated... what is the worst case scenario were I to use one of these? (bearing in mind I can keep everything inside the casing - I've decided to install the low voltage section inside the main casing, with either a drawer type battery compartment on the side or a small transformer to power the low voltage side)

NB - still considering my options at the moment: I can always buy parts in specially but it's easier to grab them off the spiratronics website as they're fairly cheap and reliable.

Can anybody suggest any other sites? Maplin don't have the parts I need (and are expensive anyway) and Farnell/Element-14 have a £20 minimum spend.

--EDIT--
Are RS worth considering?
« Last Edit: September 19, 2014, 09:27:16 am by cprobertson1 »
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #61 on: August 03, 2015, 11:45:28 am »
Sorry to ressurect a dead post!

Finally getting around to actually modding the laminator - I originally decided not to even try playing with mains until I knew a bit more about what I was doing!


I'm planning on using a couple of low-coil-voltage relays that I can power from five volts to interface with the mains line to the motor and heater on the laminator - was just wanting to check that what I'm intending to do is safe (and will actually work!)

I've been investigating the possibility of using a trasnfromer - as being able to build my own power supplies at arbitrary voltages would be a useful skill (for whenever I don't have a wallwart at a particular voltage) - would the below circuit be safe enough for my needs (everything is inside a plastic case, though I'll get to that in a minute as I may need to mod something there!) 


The next question is with regards to mounting this transformer : what would be the easiest way to make an electrical connection to the transformer itself (its designed for PCB mounting)


The final problem was that I was considering cutting the case so that I can get right into the rollers, which will allow me to clear jams easier and increase cooling - but the problem is that this will expose the aluminium frame that the rollers and heater beds are mounted to - were I to do this, would it be sufficient to install an earth wire going to the mains earth and connecting it directly to that metal chassis?

The mod to the case itself would involve cutting away the plastic near the rollers, the motor and proposed transformer mod would be squirreled away in one corner underneath plastic or in a separate, fully sealed plastic enclosure connected to the side of the laminator



If it comes to it, I can just power the microcontroller and relay coils from a 9V battery or a wall-wart (though I've been trying to avoid these as I reckon I can only get 4-6 hours out of a battery, running at an average of about 100mA owing to the relay coils, or alternatively having two plugs coming from one appliance!)



What are people's opinions on the best way to do this (safely!) - many thanks!


PS - I know that's a 9V transformer, I had originally bought it to replace a damaged one in a piece of hardware that I ended up scrapping for parts, meaning I had a transformer left over! I'm planning on using a buck regulator to drop it down to the 5V used by the microcontroller and relay coils
 

Online amyk

  • Super Contributor
  • ***
  • Posts: 8275
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #62 on: August 03, 2015, 11:56:34 am »
Just use a capacitive dropper, make sure you don't have any exposed metal parts, and be done with it...
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #63 on: August 03, 2015, 12:20:52 pm »
Tempting! Though I'd need to order in a cap (and dig out my textbook to calculate the values) - don't have any X or Y rated caps in my parts drawers I'm afraid.

The only other problem is that I may have to redesign the case a bit so I can clear jams (either exposing the roller chassis or putting a removable cover on it with a switch that disconnects the power supply when its removed)

I was also wondering if the lack of isolation from a transformer might be a problem (assuming it's all sealed, with the only external controller being a plastic-shaft pot with an integrated switch, I don't think it would be - but figured I'd better check, just in case!)
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #64 on: August 03, 2015, 01:27:22 pm »
You do know you can buy these transformers that have AC 90 to 265Vac input, and DC output?
http://nl.farnell.com/ac-dc-converters-pcb-mount-single-output
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #65 on: August 03, 2015, 02:04:41 pm »
Awesome! Will need to remember that for future projects ;)

I was only using that one I mentioned earlier as I had bought it in to replace the transformer on a bit of gear that I ended up binning and didn't want to leave it gathering dust (it's brand new)

A £5 its a quarter the price of the original laminator, but I'll certainly consider them!

Will certainly keep it in mind for a future project as well! Thanks :D
« Last Edit: August 03, 2015, 02:09:31 pm by cprobertson1 »
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #66 on: August 03, 2015, 02:10:18 pm »
If you look good enough you'll find them to fit popular brands of real transformers.
Same as those smps 78xx drop-in replacements.
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #67 on: August 03, 2015, 02:16:57 pm »
Nice xD

What's the easiest way to connect the mains wires to the transformer? (there is no board in the laminator, meaning I'll either have to make my own use point to point construction and silicone everything down)
 

Offline LukeW

  • Frequent Contributor
  • **
  • Posts: 686
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #68 on: August 03, 2015, 04:35:18 pm »
Should be OK to just securely solder a wire to the PCB-mount pin and insulate it with heatshrink.

And use mains-rated wire following the standard color code for your country.

Also, in the schematic posted above, I would move the fuse before the transformer, so it's the "first thing" after the mains plug. Also consider adding a mains power switch, and a power-on indicator LED or lamp if you want.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #69 on: August 03, 2015, 05:14:33 pm »
For a bit more you'll have metal chassis or open frame Meanwell or Tracopower supplies. Slightly bigger, but still a cute size for significant power. Maybe even small potted modules such as those transformers, but then equipped with screw terminals or solder pads. Look here: http://www.tracopower.com/ http://www.meanwell.com/ http://www.recom-international.com/
Please don't bodge a supply from el-cheapo Chinese eBay sellers, they're just suicide supplies.

Yes, I know you can use a 78xx with a regular transformer, but that is heavy, ancient and inefficient. Technology evolves.
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #70 on: August 03, 2015, 05:32:18 pm »
Quote
I know you can use a 78xx with a regular transformer, but that is heavy, ancient and inefficient. Technology evolve
- aye, sorry, should have said - that wasn't my schematic! I was planning on using an LM2575T buck regulator to drop it down from the 9V that my transformer supplies.

Quote
Also, in the schematic posted above, I would move the fuse before the transformer, so it's the "first thing" after the mains plug. Also consider adding a mains power switch, and a power-on indicator LED or lamp if you want.

There's a fuse in the mains plug (but I think it's the 13 Amp fuse that came with it) - should I put an additional fuse to the transformer side as well? Theres also two existing LEDs (power on/at-temperature) and a switch on the laminator - my design was going to add an extra layer to that (two extra LEDs - one to indicate the heater is on and one to indicate the motor is running).

That reminds me actually, should the transformer be in parallel or series to the heater/motor circuitry? In a DC circuit I'd quite happily put it in parallel, but with AC, eh, figured I'd better double check!

Thanks for your help luke and jeroen3!

Incidentally, I'll get a proper schematic up later tonight detailing the existing circuitry and my planned mods.
 

Offline cprobertson1Topic starter

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: scotland
  • 2M0XTS / MM6XKC
Re: Powering Atmel AVR off mains [laminator controller project]
« Reply #71 on: August 03, 2015, 08:42:40 pm »
Here we go (see attachment).

NOTE - there is no extra fuse on the primary side of the transformer, it's just the 13A fuse in the plug, and the 1A fuse before the diode bridge: do you reckon that fuse should be moved or an additional fuse added?

also, the dual-throw, dual-pole ON-OFF-ON switch on the laminator just switches between high and low temp settings (literally by changing which thermal switch is in-line with the heater - and I've just noticed that I migh have thatpower indicator on the wrong line - whoops. Oh well.)

Ps - I know that ATTiny13 is overkill for controlling a few switches, I was originally going to use an ATTiny4 or 8, but discovered that I didn't have an easy way to actually program them (they use some funky TPI interface which my programmer doesn't support, and I couldn't be bothered hacking anything else together!)
« Last Edit: August 03, 2015, 08:45:28 pm by cprobertson1 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf