Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

converting 220v ac signal to logic signal

Status
Not open for further replies.
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.

you mean like this ?

hhh.jpg




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.

like this ?

wrrrrrrrrrr.png


regards
 
Why are you switching the neutral?, normally never done.
Live side only.

Not at all, it's quite common to switch the neutral, and in a great many cases you don't even know which you're switching. Quite a number of TV's over the years have used single pole switches, and switched the neutral.

However, on a personal note, I'd always switch the live - if the choice existed.
 
Not at all, it's quite common to switch the neutral, and in a great many cases you don't even know which you're switching. Quite a number of TV's over the years have used single pole switches, and switched the neutral.

However, on a personal note, I'd always switch the live - if the choice existed.
Well when I was in the Electrical/Electronic field in the UK it was a NoNo and now here in N.A. also.
Just for the same reason you do not fuse a neutral.
Here in N.A. the two pin plug used in a power socket is polarized by way of keyed pins to ensure polarity.
Done in the cause of safety.
Max.
 
Yes. You haven't labelled the connections on the 5 V psu but it's obvious where they go. Just make sure you get the output the right way round, or put 10 kΩ in series (after the load resistor) to make sure it won't damage the Arduino if you have got it wrong.


That's what I mean if you use a relay.
 
Yes. You haven't labelled the connections on the 5 V psu but it's obvious where they go. Just make sure you get the output the right way round, or put 10 kΩ in series (after the load resistor) to make sure it won't damage the Arduino if you have got it wrong.


That's what I mean if you use a relay.


Like this ?
**broken link removed**

And how to choose RL ?

I have 5v ps like this ..

**broken link removed**
 
Last edited by a moderator:
That circuit is what I would suggest.

I would chose RL to discharge the output capacitor of the PSU in the time needed. As it is a push button, I would guess that if the user lets go of the button, you would want the Arduino to respond in half a second, or be able to recognise a second press after a gap of that length.

If the output capacitor is 220 μF, then to get a time constant of 0.5 seconds you need a resistor of 2.2 kΩ.

On the point of the pushbutton switching the neutral, and leakage current through the power supply may cause the whole Arduino circuit to go to a raised voltage. There shouldn't be enough leakage current to be dangerous, but I suggest that you earth the Arduino ground so that any leakage is carried to ground.

If you have a linear power supply, with a 50/60 Hz transformer, there will be less leakage. If it's output voltage is greater than 5 V, you could put a zener diode in parallel with the Arduino input, and the 10 kΩ resistor will limit the current it the zener to keep everything happy. The output capacitor on a linear supply may be larger so needing a smaller RL.
 
On the point of the pushbutton switching the neutral, and leakage current through the power supply may cause the whole Arduino circuit to go to a raised voltage. There shouldn't be enough leakage current to be dangerous, but I suggest that you earth the Arduino ground so that any leakage is carried to ground.

.


thank you for your appreciated effort :)

how earth the arduino ground ?
 
I'm surprised nobody suggested a straight connection. A 10MΩ (or two 5M) resistor with a 5V (or 3V) zener will give you a 50Hz signal. Not isolated so potentially dangerous - but 240V througth a 10MΩ resistor is not going to kill anyone. Microchip have an application note dedicated to this subject.

Mike.
 
Well when I was in the Electrical/Electronic field in the UK it was a NoNo and now here in N.A. also.
Just for the same reason you do not fuse a neutral.
Here in N.A. the two pin plug used in a power socket is polarized by way of keyed pins to ensure polarity.

If you were in the UK you know that all plugs here are three pin, fused and earthed.

However, if the unit you're powering has a figure-8 removable mains plug (as a great deal of equipment has) then you have a 50/50 chance of getting it the wrong way round, and of course the earth doesn't pass down the 2 core cable either.

So in that case it makes no difference which you switch, as the odds are 50/50 either way.
 
If you were in the UK you know that all plugs here are three pin, fused and earthed.

.
I did my training and obtained Electrical and Industrial Electronic licence qualifications in the UK so I installed many a ring main!.;)
Just because it is done and is possible, doesn't make it right when it is potentially dangerous.!.
Max.
 
Here's the LTspice simulation of a simple opto circuit that should do what you want.
I didn't include the switch (which should be in the hot, not neutral lead) but just turned the AC on and off in the V1 AC source to simulate the switch action.

Unlike Nigel, who does not use simulators, I have used them for over 30 years and find that a Spice simulation usually gives a good approximation of the real circuit operation as long as you take care not to simulate the devices outside their ratings (or recognize when they are).

upload_2018-7-1_8-50-49.png
 
Here's the LTspice simulation of a simple opto circuit that should do what you want.
I didn't include the switch (which should be in the hot, not neutral lead) but just turned the AC on and off in the V1 AC source to simulate the switch action.

Unlike Nigel, who does not use simulators, I have used them for over 30 years and find that a Spice simulation usually gives a good approximation of the real circuit operation as long as you take care not to simulate the devices outside their ratings (or recognize when they are).

View attachment 113638


What is the type of C1 ?
What is the type and power Rating of R2?
should i use protective elements on input side ?
What is the purpose of D1?

Regards :)
 
Last edited by a moderator:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top