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

0 Members and 1 Guest are viewing this topic.

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: 9021
  • 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
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8276
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