converting 220v ac signal to logic signal

emb

Member
HI All,,,

I have a push button on the 220v AC side connected to neutral line...I need it to produce a logic signal when it pressed.

what i think to do something like this



any modification ?
is there any disadvantages using this approach ?
is there any other method better to use ?

regards
 
i think to do something like this
What you have there is a good safe option.

any modification ?
You may need to add some de-bouncing circuitry to the input to the micro.
You could use an opto-isolator instead of a relay. May be cheaper if you have several inputs, but you will also have to rectify and smooth the signal into or out from the opto-isolator.

JimB
 
Reactions: emb
It's perfectly fine, and will work - however, it's somewhat large, expensive, and crude - but for simplicity, and safety (as a mains relay is intrinsically isolating) it's hard to beat.

A 'nicer' method would be an opto-isolator, but it's not as simple as a relay.
 
Reactions: emb
thank you all

i searched about opto-coupler method and find the following circuit


how can i choose the value of R1,R2 and R3 values ? ZD value?

regards
 
A capacitor-fed power supply would be much simpler and much cooler.
100n in half-wave allows 3.5mA or 7mA in full wave so you can work out the value you need.
 
Reactions: emb
i think to do something like this
I use a 5 volt wall wort. (cell phone charger) We all have boxes of them laying around.
Input 110/220 ac, output 5V dc
The turn on has a small delay. The turn off will have a long delay unless you put a load on it. I usually put 10mA LED + resistor load so I can see what is happening.
 
Reactions: emb
As you can see, there are several different methods to do what you want, each with different characteristics. How fast a response do you kneed? That is, does the uC need to see a signal the instant AC is present, or is a short delay acceptable. For example, the relay method will energize and release within about 1/10th second of when the switch is pressed and released. The signal from a 5 V wall wart will activate a little slower, maybe 1/2 second, but might release much slower, like a few seconds.

ak
 
Reactions: emb
hi all,,

i found the following circuit using optocoupler



any modification ?

should i use protective elements ?

the power rating of the resistors ?



regards
 
C1 is the crucial component, it MUST be a special capacitor rated for this use - it must be X-rated.

R3 should probably be a fusible type, as it's there as a fuse - R1 and R2 are just to discharge the capacitor.

BTW, this circuit provides AC pulses on the output, not a DC voltage.
 

I simulate the circuit the output was 5v .
when the button pressed the output goes low and still low while button pressed..

Is there a problem in simulator ?

When I remove the bridge the output was AC pulses when the button pressed

Regards
 
I don't use simulators, but they often don't work as in real life.

There's no AC smoothing in that circuit, so the output will be a pulse not DC.

Did you have the simulator input as DC instead of AC?.


No .. it's a.c. input

What should I do to get DC output ?
 
when the button pressed the output goes low and still low while button pressed
How were you checking the output? A DMM will average the signal and show it as very close to 0V, whereas in fact it is a series of very brief 5VDC pulses (one pulse per half-cycle).
 
Reactions: emb
You could just use a 240 Vac powered 5 V supply, such as a mains driven USB supply that you have kicking around. All your isolation and smoothing is taken care of in the power supply. You may need a load resistor to discharge the output as with no other load it could take some time to decay.

If you do use a relay, I would suggest a much smaller load resistor than 10 kΩ. I would use something like 500 Ω to ensure 10 mA flows though the contacts when they close to help keep the contact working. The actual current needed depends on the relay and a minimum current is often quoted for them.
 
Reactions: emb
Why are you switching the neutral?, normally never done.
Live side only.
Max.

I have a switch already connected to neutral


How were you checking the output? A DMM will average the signal and show it as very close to 0V, whereas in fact it is a series of very brief 5VDC pulses (one pulse per half-cycle).

yes i used DMM and i check the output on the oscilloscope it was as you say..

 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…