Read 230Vac signal

Go To Last Post
24 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

For my current project I need to read the state of 4 230Vac devices.

My first idea was to use a 230Vac relay, and simply connect 0V/5V to the NC/NO terminals.
However I cant seem to find a relay that is cheap and small enough for that to be an option.

I would like something that will fit within 10x20mm, it can be a bit longer, but not much wider.
The only relays I can find with a 230Vac coil, is power relays which are bulky, and expensive... since I dont need the current rating, I looked for a signal relay, but they only do to 48Vdc.

Maybe I am trying to solve this in a bad way?
I would like the isolation a relay brings, but if its not avaliable, its not really an option.

I guess the alternative is diode and resistor, maybe with a opto coupler for isolation ?

Any advise is most welcome.
(I am well aware that 230Vac is deadly, this will only be installed by professionals)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use an optocoupler with antiparallel LEDs, like SFH6286. Put 10nF 1kV in series to get 1mA, and another 1k in series to survive the plug-in, and 10M across the terminals to discharge the 10nF when you unplug it so you can't zap anyone.

The 10M requires a note. There is ~360V peak across it, so do not use a single 200V resistor. 2*5M lets you stay in 1206.

The next step up in isolation is a widebody optocoupler, and then several metres of POF fiber.

/Kasper

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A little bonus info regarding plug in/out.

The devices will be connected to screw terminals, so they will not be plugged/unplugged while they are live, however the AVR part could be active when they are installed.

It will mostly be used for monitoring if a pump is turned on, so a cable will be fed from its power source to the AVR board.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am not talking about the loads. You need to design it in such a way that, no matter what (such as if no loads were connected, and it was then unplugged from the wall, which would be typical during testing) you can not pull more than a few uC out of it by touching it ('it' includes exposed pins of plugs once unplugged).

That's a legal requirement (lavspændingsdirektivet), and it costs dkk 0.06 to meet it.

/Kasper

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Like this (attachment) ?
Not the correct opto, but same pin out, just only with 1 led.

Ofcause price is not that important, that I would skimp on components, the cheapest relay that almost fit the bill is 40dkk anyway.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Almost. Move R39 all the way left. It can then bleed off any charge on C30. Alternatively, put it across C30.

If you do not have an anti-parallel led optocoupler in the drawer, add an antiparallel diode so as not to kill the led with fatal reverse bias.

/Kasper

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

KKP wrote:
The 10M requires a note. There is ~360V peak across it, so do not use a single 200V resistor. 2*5M lets you stay in 1206.

Does the 10M require a specific watt rating, since you suggest 2x5M ?
Farnell seems to have 10M in 1206 with 1/4W 400V

http://dk.farnell.com/welwyn/lhv...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

KKP wrote:
Almost. Move R39 all the way left. It can then bleed off any charge on C30. Alternatively, put it across C30.

If you do not have an anti-parallel led optocoupler in the drawer, add an antiparallel diode so as not to kill the led with fatal reverse bias.

/Kasper

I will get the right part, just didnt find a eagle footprint, so picked a general opto.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ohm's law. The 10M resistor will dissipate only 5mW. The reason for suggesting two resistors in series is that 200V types tend to be far cheaper, and I have seen 400V types fail open due to migration. I switched to 2*200V and have not seen it since.

The 1M drawn will dissipate 50mW, which is also fine. (actually, as drawn, 1mOhm will dissipate 53 MW:)

/Kasper

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

oops, I am missing a zero in the drawing should be 10M.

I wont be making enough of these for less than 1dkk to matter, but the migration issue ofcause do.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

... and a little reminder, Kasper suggested a diode across pins 1 and 2 of your opto. Anode to pin 2.

Cheers,

Ross

Ross McKenzie, Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wonder,
can the OP live with the knowledge that 230V is applied to the device, or does he/she/it also needs to know if the device is actually working so needs to know the current flow through the device?????

an opto coupler with bidirectional LEDs is a good choise, make sure though the that leaking distance is big enough, from the head you need 8-10mm distance between the primary connection(mains) and the secondary connection. as you need to be able to withstand a power spike/surge on the mains lines.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:
... and a little reminder, Kasper suggested a diode across pins 1 and 2 of your opto. Anode to pin 2.

I will get the opto type with 2 leds, just didnt find a suitable footprint in eagle for drawing it up

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

meslomp wrote:
I wonder,
can the OP live with the knowledge that 230V is applied to the device, or does he/she/it also needs to know if the device is actually working so needs to know the current flow through the device?????

an opto coupler with bidirectional LEDs is a good choise, make sure though the that leaking distance is big enough, from the head you need 8-10mm distance between the primary connection(mains) and the secondary connection. as you need to be able to withstand a power spike/surge on the mains lines.


Voltage is enough, there are other sensors that will detect if water level is not ok, ie pump is not working, and humans will have to figure out whats up :)

From the tables 2mm should be enough for level 2 devices, no ?
There is a 10mm spacing version avaliable however, and 9.x for smd.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

KKP wrote:
Put 10nF 1kV in series to get 1mA, and another 1k in series to survive the plug-in

Why are we using an capacitor to limit the current to 1mA instead of a resistor ?
And how did you select the 10nF.

From the datasheet, it seems the transmitter is limited at 1.5V and 5mA.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Because (ideally speaking) a capacitor does not dissipate power.

If a resistor is used, it would have to dissipate about 220mW.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MORA99 wrote:
From the tables 2mm should be enough for level 2 devices, no ?
There is a 10mm spacing version avaliable however, and 9.x for smd.

Ok, it seems 2mm is a bit low.
The recommendations I found say 8mm between primary and low-voltage, and 4mm between 230Vac L/N.

A few of the packages come close to the 8mm, but they all have 2.54 distance between the 2 230Vac lines, but the cap and resistor have stepped down the potential at that point.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Note that the output of the opto will be pulsed due to the mains frequency. You can integrate the output using R and C or just do it in software. Don't use an external interupt! Use a timer interrupt and poll the input at a regular rate, say, 1ms. Load a downcounter variable with slightly more than the mains period when you detect a logic 0 on the input.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
Note that the output of the opto will be pulsed due to the mains frequency. You can integrate the output using R and C or just do it in software. Don't use an external interupt! Use a timer interrupt and poll the input at a regular rate, say, 1ms. Load a downcounter variable with slightly more than the mains period when you detect a logic 0 on the input.

But with a bidirectional opto coupler is this still an issue ?, maybe at zero crossing.
I will need to solve it in hardware, so that a stable signal is delivered, does not matter if its active low or high.

The inputs are not connected directly to an AVR, but to an I2C IO expander, so I cant read it very fast, it will probaly be read in a 5s loop.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For what it is worth ... I like this one.

Cheers,

Ross

Attachment(s): 

Ross McKenzie, Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ross:
This circuit was meant as a zero crossing detector.
And it has rather a high power dissipation. At my local electricity rate, it would cost me aud 4.5/year.

Another one in the same category I did, is
http://wap.taur.dk/zcd/sch.jpg

There is no external 'VCC', that is tied to pin14. It is 'self powering' through the protection diodes, and power dissipation is ~240mW.

MORA99: You will get a dropout a few ms wide at the peak of the sine. If you can not tolerate this, put a capacitor across the output. It forms a filter with the pull-up, and that can be quite large, so the capacitor can be small.

/Kasper

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

KKP wrote:
Ross:
This circuit was meant as a zero crossing detector.
And it has rather a high power dissipation. At my local electricity rate, it would cost me aud 4.5/year.

Another one in the same category I did, is
http://wap.taur.dk/zcd/sch.jpg

There is no external 'VCC', that is tied to pin14. It is 'self powering' through the protection diodes, and power dissipation is ~240mW.


Yes I know. Thanks for sharing your circuit Kasper.

Cheers,

Ross

Ross McKenzie, Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

KKP wrote:
MORA99: You will get a dropout a few ms wide at the peak of the sine. If you can not tolerate this, put a capacitor across the output. It forms a filter with the pull-up, and that can be quite large, so the capacitor can be small.

Where would you put the capacitor ?
The logic is inverted as I see it, so when there is 230Vac, there is 0V on the output since the transistor is pulling low.
And when there is not 230Vac, the pull up is pulling high for 5V.
So I want a capacitor to hold the line low for a few ms after the transistor cuts out, is a capacitor across the 2 output pins enough ?

I have 22pf 100nf 10uf 330uf on the board atm, guess 100nf is too little, but maybe 10uf can do ?
(The less unique parts the better)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

try this link
http://www.8052.com/forumchat/read/169691

P.Ashok Kumar