5
\$\begingroup\$

I am new to electronics. I want to make a power switch controller by a digital pin as shown on the following figure.

How to do this safely?

enter image description here

Update: I forgot to let you know the bulb is just an example for the sake of drawing. The real scenario, it is a female socket into which any equipment male socket is inserted.

\$\endgroup\$
1

3 Answers 3

13
\$\begingroup\$

Updated after update of the question. Changes are regarding the zero-crossing

The best solution for an incandescent lamp is an SSR (Solid State Relay) with zero-crossing detection. (Zero-crossing switching increases the bulb's life.) An SSR module is the most convenient, but they're not cheap.

enter image description here

If you want to switch other (unknown) loads you better pick a random-switching SSR, i.e. without the zero-crossing circuit.

If price is an issue you can better build the SSR from discrete components. Below is an example using the MOC3041 as opto-triac. Will cost about 2 euros.

enter image description here

Again, the MOC3041 has a zero-crossing circuit. For other loads than an incandescent bulb use the random switching MOC3051.

Not as nice, but easier: an electromechanical relay:

enter image description here

The transistor is needed because the microcontroller can't supply the required current for the relay, so you have to amplify this current.


About the zero-crossing: you may have noticed that incandescent bulbs always fail when they're switched on. That's because the mains phase can be near its maximum when switching on. Combined with the low resistance of a cold bulb this results in a high current peak, which may burn the filament. When you switch on a zero crossing you avoid these peaks.

\$\endgroup\$
1
  • \$\begingroup\$ I have the vague impression that I've seen a very similar answer before ;-). But that's OK, the answer is to-the-point. +1 \$\endgroup\$ Jun 24, 2011 at 12:31
1
\$\begingroup\$

There's many things you can do to separate the relay from the digital side. You could opto-isolate it. You could use a peripheral driver chip. You could set up a darlington pair transistor arrangement.

Personally I'd just use a driver chip - it's quick and easy.

Most driver chips are just glorified darlington pairs anyway.

One commonly used driver is the ULN2803

\$\endgroup\$
8
  • \$\begingroup\$ +1: Could you give me a more detailed info? \$\endgroup\$ Jun 24, 2011 at 11:47
  • \$\begingroup\$ @Matt - the ULN2803 is common, but only if you have to switch several loads. For just 1 relay a single transistor will do nicely. \$\endgroup\$
    – stevenvh
    Jun 24, 2011 at 12:25
  • \$\begingroup\$ @xport - what do you want to know more about? \$\endgroup\$
    – stevenvh
    Jun 24, 2011 at 12:26
  • \$\begingroup\$ @xport: @stevenvh is right: if you need to switch one relay just use a transitor. The 2803 is basically an IC with 8 copies of the transistor circuit in his answer. So if you want to switch 8 bulbs go for the 2803. \$\endgroup\$ Jun 24, 2011 at 12:34
  • \$\begingroup\$ Or a single element driver chip - the 2803 was just an example of what is available. I'd prefer a darlington pair to a single transistor personally. \$\endgroup\$
    – Majenko
    Jun 24, 2011 at 12:57
0
\$\begingroup\$

Depends on the current form your digital output. Is it a microcontroller, some circuit, a switch, or something else? If it is a low current output, you have to use some kind of simple transistor, as example, to control the relay.
Also check that the relay is rated for 240V. Depending on what controls what, some kind of isolation between the circuits might be good.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.