Hi,
I have a rooflight window on a flat roof with mains voltage motor drive that I want to control remotely. It is one of these 3-wire jobs with one Neutral and 2 separate Live, one for up/open and one for down/close.
Controlling the window itself isn't the issue. I would use a circuit with 2 relays controlled by a microcontroller (ESP8266), see attached circuit.
Relay RL2 switches between existing wall switch and remote control (unenergised state is wall switch). Relay RL1 switches between open and close. RL1 will select the direction first while RL2 is still in the "wall switch" position, then RL2 will switch over for the duration of the open or close action.
Now, the issue is that the window doesn't have limit switches. Or rather, it has, but I have no access to them. But I want to detect when the window is fully open or fully closed.
I had the idea to measure the AC current to detect this. I made a contraption to measure the current just using the existing wall switch using a clamp current meter. I found that, while opening, the window draws about 50mA and while closing 20mA at 240V AC. When it is fully open or closed, it no longer draws current (so it does have internal limit switches). So I could use that to switch back RL2 when current to the window stops.
The question now is, what is the best way to measure the current in this circuit so that it can be read by a micro? I don't really need the exact measurement. All I would need is a digital signal that tells the micro whether, say, 15mA or more are being drawn or not. Though, it would be a bonus if it could also detect over-current in case the window is jammed or something like that.
I found cheap breakout boards with current sensor ICs like the ACS724 (5A version), but I don't think it has the resolution/accuracy needed. 20mA might get drowned out by measurement noise. There are also boards with an on-board current transformer that I could stick one of the mains wires through, but I think it will have the same issue.
Could I use a shunt resistor in the Live wire between AC in and RL2 that reaches a certain voltage at 20mA that is just enough base voltage for an NPN transistor to switch on (plus voltage drop across a diode). The transistor could then drive the LED of a opto-isolator, for example. Would that work? Are there any better / easier ways?
Thanks!!
Chris