Go Down

Topic: how to check whether a AC circuit is closed  (Read 476 times) previous topic - next topic

wolph42

Mar 08, 2018, 11:25 am Last Edit: Mar 08, 2018, 04:13 pm by wolph42
Hi first post on this forum!

I'm completely new to the world of Arduino and I'm already aiming at quite an ambitious project where I want to control my (floor)heating system. Fortunately somebody already did such a project, which teaches me a lot.

The other project however is non-wifi entirely, I do not have that option and moreoever I want a central control hub where I can check online what the status.

Because this design will be inherently less robust I want to build in an extra check aka sensor. Reading it however is what my question is about:

If I toggle a switch on a (230V AC) circuit using a esp8266 (inside a Sonoff) I would like to independently check whether  the switch is actually toggled. My question is how can I best do that?

I like to use a 2nd esp8266 to send me the readout, but how do I generate the readout? I could e.g. put 'something' inside the AC circuit that checks whether there's a current running or not and reports its findings to the the 2nd esp8266, but what IS that 'something'?
Perhaps there's  a better alternative then what I'm thinking off. Im open for that too!

edit: might be relevant, the currents I want to detect (two types) are ~10mA and ~100mA

wvmarle

To detect a current you add a small resistor (often called shunt in this application) and measure the voltage over it. The higher the current the greater this voltage but to limit losses you have to keep this voltage low.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

wolph42

thanks for the swift reply. When I read it i realised that I said 'DC' current, I meant AC current (don't know what I was thinking). Basically I need to 'sense' whether the mains is connected.

floresta

You could do almost what you want by using a photocell to monitor the LED on the first Sonoff and use that to trigger your second ESP8266.

This will only detect whether the relay has been energized, not whether there is actually any current flowing through it's contacts, but this may be sufficient.

If you are going to control a floor heating system I would strongly suggest having your Sonoff trigger a hefty solid state relay.  I wouldn't trust that tiny relay in the Sonoff to handle the current in spite of the 'rating' of the Sonoff.

Don

wolph42

Thanks! I figured it would help to give more info then just 'need to detect AC current'. Yes detecting whether the led is on is a good intermediate, its not really failsafe as the led could also burn when there's an issue. But its certainly something to keep in mind if not other (more direct sensing) solution presents itself.

As for the relay, the thermic actuators operate at 2 to 3W so I think I'm safe with a sonoff. The big issue is that this translates to 9 to 12 mA, which is really difficult to detect (at least from what I've found so far...)

You might be thinking of the flow pump, that thats 20-80W which is roughly 100-500 mA, so even then its still no issue. Actually now I reaslise that I need a detector for that one too.

floresta

Actually I was thinking of my own floor heating which is totally electric with currents above 10 A per circuit.

Don

wolph42

 :o  that's really a lot, and yes indeed then you'll need one whopping big relay. I've been digging further on this topic and I have found some similar topics. The options I found so far are either use a shunt (as was mentioned earlier) not my favorite as its intrusive, the other is measuring either generated induction with a spool or measuring the hall effect with an IC, both however will generate mV so then I also need an opamp, and granted there has been a time that I build circuits...half my age ago so I'm still familiar with the terms, but thats about as far as it gets.

I'm still open to other solutions.

wvmarle

10A doesn't need a very big relay (though the 230V may add to the size). Car relays are pretty small and can carry much bigger currents - in DC to boot (which makes the switching off harder than for AC).
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

wolph42

I think I have the solution. As explained I need to check whether the relay is working and I wanted to do that by measuring the (very tiny) current. I just realised that i can better measure the voltage over the relay. this will be 0 when open and 230 when closed. Now I just need to figure out what electronics I need to actually (safely) measure it and report it to an arduino port. Again open for suggestions.

wvmarle

#9
Mar 12, 2018, 02:02 am Last Edit: Mar 12, 2018, 02:02 am by wvmarle
Bridge rectifier (to make it DC - a single diode probably does the job) + capacitor (1 uF is enough - to smooth the output current) + optocoupler with appropriate current limiting resistor. 390k is a good value, that gives 1 mA to the optocoupler which is enough for switching a small signal while keeping the power dissipation down (in this case to just under 400 mW so you need a 1W resistor).

You will have to make sure it's all insulated really well, as a small mistake with these voltages can have pretty bad consequences. Yet you do have to allow for some air flow to get rid of the heat of the resistor - or it'll get really warm in there even at just 400 mW.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

wolph42

Thank you for the swift reply. I'm well aware that working with mains requires enough safety measures (so far I've been reminded 2x in my life and i can remember both cases vividly even though they where very short). I've build electronics during my study physics but that alas was roughly a century ago, so i'll probably make some schematics and upload them here to let others check.

Anyway, @230V wouldnt a 390k resistor produce  a current of 0.6 mA ? (you say 1mA, or are you just rounding off?). Same with the power, you say 400mW, but I end up with 135mW, which would mean that a 250mW resistor would be enough (and produce a lot less heat)?

wvmarle

#11
Mar 12, 2018, 11:11 am Last Edit: Mar 12, 2018, 11:14 am by wvmarle
Anyway, @230V wouldnt a 390k resistor produce  a current of 0.6 mA ? (you say 1mA, or are you just rounding off?).
No: after rectifying and smoothing you have about 325V (I calculated with 380V but that's phase difference; 325V is peak voltage for a single phase, so I'm off there).

1 mA is quite minimal for an optocoupler and it's not fully on, but enough to pull down a 10k pull-up (or your Arduino's internal pull-up). So you'd need a 330k resistor for almost 1 mA, and have about 330 mW of power dissipation. A 1/2W resistor is minimal; better take a 1W as you're dissipating that power constantly.



Diode should be a 1N4004 (400V reverse voltage) or higher, capacitor rated 400V or higher.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

floresta

Make sure your affairs are in order and your insurance is paid up.

Don

wolph42

#13
Mar 14, 2018, 09:56 am Last Edit: Mar 14, 2018, 10:21 am by wolph42
@WVmarle: thank you for sharing, I've been readin up on these types of circuits and I'm amazed how many are out there (and how many of those are really dangerous). I'll check yours as well.

@floresta: I've a couple of encounters with mains in my life which have burned themselves quite well into my memory, even if the encounter was short (I was about to say 'short lived' but that's a bit too much pun). Hence I'm well aware of the prices of a mistake.

In the mean time I'm looking into a third alley (it really helps having these types of discussions as it keeps your mind busy looking for solutions) which is sensing the water flow (which after all is what I want to check) alas again not easy if you want to do it non-invasive. And again someone else thought of it before I did :D: https://forum.arduino.cc/index.php?topic=463316.0

It will still take a couple of weeks before my material is in, which gives me ample time to think and read about this. Again thank you for your input!

edit: and a 4th method came to mind: checking the dT between the in and out pipes. Only issue there is that the out pipes are not closed off (when they reach the group) so that water will mix with the water from other out pipes. Another drawback is that its hard to test the valves when there's no heating. It is however so far the most simple (and safest) method to implement.

Go Up