Switching Mains from a uC - Page 1
Forum section: electronics / projects

author: HeZ
author_rank: Newbie
timestamp: August 22, 2015, 05:10:53 pm
content: G'day!I have a question that may have been asked around here before. But as a LONGG time Dave fan, I am a first time forum goer - search did not help me find the resolution (maybe wrong search terms, who knows).I am looking for the best way to switch a mains load (AUS 230V/50Hz) from the wall side of a C14 to switch on/off a cheap 12V LED PSU (http://www.aliexpress.com/snapshot/6627070841.html?orderId=66943257553500) from aliexpress - using 3.3 or 5 V from a raspberry PI/arduino. The idea is I would like to be able to switch on/off the 12v supply to a 3D printer RAMPS board using M80/81, be that by directly switching the power from PS_ON or by passing PS_ON through the PI.I have built quite a few printers in my time - my two main ones at the moment are controlled by ATX psu's. So life is easy there.But I have several prototypes that are being powered by these cheap ones (They work great - paying $200+ is totally unnecessary imo). I would love to be able to control them via Octopi and M80/81. But although I have a degree in the field and a good understanding of mains wiring, it is my pet hate to touch mains in any way shape or form. The current ones I have are in a full enclosure and were wired up by my dad (licensed to do so longer than I have been alive) to a fused and switched C14. So I am trying to avoid the obvious and simple solution of adding in a relay.What I am really looking for is an OEM solution that can just plug into the wall and be switched - like Dave's new lights but not remote controlled - more reliable. In my mind it looks like a power meter or a RCD connector that you plugin between the wall and you appliance.Thoughts?Does it exist?Cheers,Chris

author: singapol
author_rank: Frequent Contributor
timestamp: August 22, 2015, 05:48:06 pm
content: The said power supply comes with main 230Vac plug and on/off switch so what's the problem?If you feel uneasy about touching AC mains then put the power switch in a box.

author: ajb
author_rank: Super Contributor
timestamp: August 22, 2015, 05:59:33 pm
content: Something that can be controlled by an mcu that doesn't require doing ANY mains writing is going to be tricky. Sparkfun hasthis, but it's 120V with North American plugs. They have a kit version which appears to be configurable for 240, but that's mains wiring. Fully enclosed DMX relay packs are available, but are going to be more expensive and now your mcu needs to spit out DMX as opposed to just using a gpio.

author: bson
author_rank: Unknown
timestamp: August 22, 2015, 09:00:31 pm
content: You could leave the primary to be hard switched and add a soft switch for the secondary.

author: technix
author_rank: Super Contributor
timestamp: August 22, 2015, 11:23:30 pm
content: Several solutions:1. If you absolutely needs to switch off the mains, you can use a relay, mechanical or solid state. I personally like the idea of using solid state relays to switch heavy duty mains gear (my whole room, for example)2. Still switching mains, you can use a TRIAC. This is like a light dimmer though you are not running it in the middle of the wave. However TRIAC triggering needs some experiment to master.3. You can leave the wall wart powered and switch the low voltage side instead, using for example a PMOS switch. Attached are two examples you may find useful. IRF4905 (TO-220) and IRF7404 (SO-8) are my personal favorite.

author: HackedFridgeMagnet
author_rank: Super Contributor
timestamp: August 23, 2015, 01:23:12 am
content: http://www.jaycar.com.au/Kits,-Science-%26-Learning/Electronic-Project-Kits/Control-%26-Automation/PIR-Controlled-Mains-Power-Switch/p/KC5455http://www.jaycar.com.au/Power-Products-Electrical/Distribution-%26-Interconnect/Mains-Control-%26-Protection-Devices/Wireless-3-Outlet-Mains-Controller/p/MS6142http://www.thoroughbredaudio.com/EASY/index.htmlSomething like these?I would just but a relay in a box.http://www.digikey.com.au/product-detail/en/G7L-2A-TUB-CB-DC12/Z3807-ND/369385You need to over spec the switching current by at least 35% percent if driving an inductive load.Also put a reversed biased diode across the coil to prevent spikes.Spare a thought for EMI issues too.

author: SL4P
author_rank: Super Contributor
timestamp: August 23, 2015, 04:46:46 am
content: Mains wiring MUST HAVEStrain reliefEarthingInsulation/IsolationFuse or other protection