# Control of AC outlets?

• posted

Cliff notes:

How do i use a PIC microcontroller to turn on/off AC outlets? (whether they be part of an existing power strip or a custom panel) What alterations are needed to be made to the outlet?

Long version:

Hi,

I'm a college senior computer science major, and am currently taking a course on embedded interfaces. FYI: I'm a complete neophyte to embedded systems and advanced electronics. (I got the basics down [i hope]) We'll be using PIC chips in the course btw, so i'd like to use them as a foundation before i learn other things.

My goal is to be able to create a system which is particular to one of my hobbies (namely: reef aquariums) and i'm trying to figure out the feasibility of certain things. I know it is possible to control AC outlets (as i've seen other systems do the same) but i have no idea where to start figuring out how. Basically i want to be able to use logic to determine whether a certain outlet is allowing electricity through it. Dunno if this is more of an electronics question than an embedded one.

I haven't decided whether to hack into an existing power strip, or if i'm going to create a custom panel of outlets myself, but i imagine that in either case the method of controlling the outlets would be pretty similar.

Anybody have any info on where i could start learning about something like this?

thanks, keith

• posted

"Keith Thornhill" schreef in bericht news:D3aFf.347057\$0l5.100601@dukeread06...

( ... )

Dear Sir, Thank you for posting a well defined request! The answer falls apart into several well-separated parts:

1) gather input information 2) define logics, i.e. build some controller to take information and change outputs according to input states & well defined rules 3) given the outputs, switch AC power

As I understand your request, you feel able to manage points 1 & 2, and only request help for point 3. If this holds true, the simple answer is: "use solid state relay(s)" Solid state relay is the industry name for a triac and optocoupler and periphery typically in a 4-pin TO220-like housing Pins 1-2 can be driven from TTL-levels or like, pins 3-4 are in series with the AC power circuit.

Hoping this is helpful & clear enough, KA

• posted

Then *please* keep your prying fingers well away from the AC power network. Those things can *kill* you, or worse yet, any innocent bystander, if you don't know what you're doing. And you you just said you don't. Succeeding that course can't possibly be worth seriously injuring, say, your girlfriend, can it?

It's mainly one of electrical installation safety, and thus *not* to be taken lightly.

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
• posted

Thanks a bunch.

Do you have any suggestions for specific SSRs that will work well when using a PIC to control them?

If anybody is reading this and has done something similar what i'm trying to do (control AC outlets via microcontroller) then i'd love to pick your brain.

-keith

• posted

Relays are a much safer option and easy to drive from a micro with a transistor.

• posted

Why? There is nothing inherently "safe" about a relay; an SSR can be driven by the CMOS output of a PIC or other microcontroller directly, and is optically isolated from the AC load. Most SSRs switch on the zero crossing, while an electromechanical relay can and will arc. The SSR is powered by the AC side, while an EM relay will require a substantial amount of DC current when energized, and depending on the load, may require snubbers to prevent transients from upsetting the microcontroller.

--Gene

• posted

I'm curious: how are mechanical relays safer than an optically isolated solid-state-relay solution?

A group I used to work for did a fair bit of mains-level AC input/output stuff, and we used the SSRs quite a bit. The ones we used came in potted modules with 4 pins, and IIRC, provided something likew 10KV of isolation between the TTL side and the

110/220 VAC side.
--
Grant Edwards                   grante             Yow!  I would like to
at               urinate in an OVULAR,
• posted

To answer that you need to look at the failure mechanisms of the component. SSR's, when they fail mostly fail short-circuit. Relays are just as likely to fail open as closed (depending on the means by which it failed). Also, SSR's will exhibit a small leakage current into the load, whereas open relay contacts do not.

If the OP was to utilise a Pulse Maintained Relay as a common element for the power feed, then using SSR's for individual circuits would be OK in his application. Pulse maintained relays are arranged such that any single component failure de-energises the relay (hence isolating the load).

I would suggest that, as he is in the process of being educated, he takes appropriate advice on AC power installation practice from suitable members of his tutorial staff.

--
********************************************************************
Paul E. Bennett ....................
• posted

Gene unlike an SSR, a relay breaks both lines, SSRs leak current even when off, If you use relays with "force guided contacts" you can self monitor to give a warning if the contacts get welded.

• posted

I personally make that last paragraph *stronger* . I'd feel much safer for him and those around him if he used a UL/CSA/(IIRC)VDE listed unit which had attached line cord, outlet(s) and isolated logic level inputs.

• posted

That's simply paranoid. Of course it can kill you. But how many engineering students does it actually kill?

• posted

No, a _DPDT_ relay breaks both lines, not "a relay". I have never seen a consumer product that monitored its relays for failure.

Another post implies that a relay is safer because it is just as likely to fail open as closed. Depending on the application, this just means there are two failure modes to handle, rather than one.

The OP is looking to control aquarium equipment, not provide human life support, so let's not over-engineer this.

OP needs to understand how to control high voltage with a reasonable amount of safety. In the past weeks, there was a discussion here about using mains power to replace a \$0.50 1.5V alkaline battery, with a design that was clearly a hazard. There is a difference between a design that is "safe" and a design that is "failsafe".

Certainly, an SSR can be used as the basis of a "safe" design.

--Gene

• posted

The safety would be the first thing they teach on such course.

• posted

Sorry Gene i was just answering your question. SSR's are not permitted in applications where failure could lead to a dangerous condition, for example in the gas valve control of your dometic boiler, unless they have an independent backup disconnection device. While it's true that self monitoring relays are not used in the home they are mandatory in industry in machine stop systems, probably only a matter of time before they make it into the home. Not only that but a relay is usually much cheaper than an SSR.

• posted

One would already be a lot more than enough.

And besides, this guy is far from being an "engineering student". He's a computer science major who freely admitted that he knows _zilch_ about electronics.

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
• posted

But does OP have background to understand routine hazards?

• posted

To be accurate, I said I'm not familiar with advanced electronics.

i'm fine with basic circuitry. i'm simply trying to see what things i will need to accomplish my goal so i can start investigating how to utilize them.

i appreciate the concern for my well-being, but this thread seems to have gotten a little off-course. i'm still looking for some concrete methods for exactly how to control an SSR with a microcontroller to switch AC power.

-keith

• posted

Do you mean that you want the system to be able to sense when a load is connected to an outlet and drawing power?

Yep the same, but it would be easier to build your own panel. Kinda hard to stuff everything inside an existing outlet strip depending on the outlet strip in question.

As someone alse has said, SSRs are more expensive, but they can be had pretty cheap through surplus outlets. It doesn't matter what type/brand of SSR you use as long as it is rated to handle the expected load. I don't know, but I would expect that nowdays most are capable of handling inductive loads such as flourescent lighting that utilizes a ballast transformer or an air pump.

An EMR isn't that much more difficult to drive. One transistor, one diode, and one resistor per relay and a common power supply for all the relay coils. If RFI might be a problem (doubtful) you could always add an RC snubber across the contacts to help reduce it. Contact arcing and RFI are more of a problem when switching inductive loads.

If you want to learn even more you could roll your SSRs using triacs and opto drivers. I wouldn't reccomend it, but it would certainly be a learning experience.

Don't let em scare you off tho. Just be careful and use good common sense. A little reading up on AC wiring and safety may be in order before you start building anything.

\$File/an-145.pdf

Mike

• posted

No. I simply want to be able to manipulte an outlet to arbitrarily control whether or not current is allowed to pass through it. the on/off state of the outlet in question can be remembered by my chip.

thanks for the info.

• posted

The low volttage control input of an SSR simply looks like a current limited LED to the micro. Ground the - terminal connect the + terminal to an output pin. When the pin goes high the relay is on. Connect one of the SSR output terminals to the hot side of the outlet to be controlled and the other terminal to the hot wire from the AC source. IIRC the hot lead is the white wire in home wiring in the USA. The rest of the outley wiring is normal, you're just breaking the hot lead and inserting the SSR output terminals inline with it. That's about all there is to it. If the load is sufficiently high current you may need to mount the SSRs on a heatsink to keep them cool.

Mike

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.