Author Topic: How to measure/detect AC current in rooflight controller?  (Read 233 times)

0 Members and 1 Guest are viewing this topic.

Offline yesyesTopic starter

  • Newbie
  • Posts: 9
  • Country: gb
How to measure/detect AC current in rooflight controller?
« on: July 03, 2024, 04:05:07 pm »
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
 

Offline Kim Christensen

  • Super Contributor
  • ***
  • Posts: 1511
  • Country: ca
Re: How to measure/detect AC current in rooflight controller?
« Reply #1 on: July 03, 2024, 04:20:17 pm »
The easiest is to time how long it takes for the window to fully open and close. Then have a timer that expires 5-10% beyond those values and turns the power off. No sensor required.

I'm not 100% sure what your end goal is? Is the current detection a safety feature in case a limit switch fails, or do you really need to know the window's state?

« Last Edit: July 03, 2024, 04:57:25 pm by Kim Christensen »
 

Offline yesyesTopic starter

  • Newbie
  • Posts: 9
  • Country: gb
Re: How to measure/detect AC current in rooflight controller?
« Reply #2 on: July 03, 2024, 04:33:10 pm »
The easiest is to time how long it takes for the window to fully open and close. Then have a timer that expires 25% beyond those values and turns the power off. No sensor required.

I'm not 100% sure what your end goal is? Is the current detection a safety feature in case a limit switch fails, or do you really need to know the window's state?

Thanks!!
Yes, timing it was my first thought, and I might still go for that if current sensing turns out too complicated.
I just thought I would want to take the guesswork out of it, if possible, and actually measure when it's done opening or closing. ;-)

Chris
 

Offline yesyesTopic starter

  • Newbie
  • Posts: 9
  • Country: gb
Re: How to measure/detect AC current in rooflight controller?
« Reply #3 on: July 03, 2024, 04:36:52 pm »
Would something like the attached circuit work?

R1 is the sense resistor / shunt.
C1 smooths the half-wave rectified signal
R2 discharges C1 (high value resistor)
R3 is the base resistor
LED1 is the LED of an opto-isolator (probably doesn't need to be an AC opto as the NPN transistor wouldn't let the negative half wave through anyway)
 

Offline Kim Christensen

  • Super Contributor
  • ***
  • Posts: 1511
  • Country: ca
Re: How to measure/detect AC current in rooflight controller?
« Reply #4 on: July 03, 2024, 06:04:08 pm »
It won't work as drawn. Transistors don't switch AC and LEDs don't like high voltage reversed polarity. You'd also need a bit of filtering for RFI so it doesn't trigger on noise.
I would probably just put the Opto-LED across the current sense resistor with some back to back diodes to limit the max voltage across the resistor. (Few other parts to limit LED current and filter any noise)
 

Offline yesyesTopic starter

  • Newbie
  • Posts: 9
  • Country: gb
Re: How to measure/detect AC current in rooflight controller?
« Reply #5 on: July 03, 2024, 06:37:26 pm »
It won't work as drawn. Transistors don't switch AC and LEDs don't like high voltage reversed polarity. You'd also need a bit of filtering for RFI so it doesn't trigger on noise.
I would probably just put the Opto-LED across the current sense resistor with some back to back diodes to limit the max voltage across the resistor. (Few other parts to limit LED current and filter any noise)

Thank you!
Yes, I think I embarrassed myself with that last circuit  :-DD

I hadn't thought about putting an LED straight across the sense resistor. That sounds a lot easier, and easy enough to test out.
So I size the resistor so that I get around 3V drop at 20mA and put the LED with current limiting resistor (and perhaps a series diode?) across that. I assume the back-to-back diodes go in parallel to the LED?

I'm not too worried about noise. I think I'll take a few readings in software and average them out before making a decision. It doesn't have to be fast.


Another reason to measure, instead of just timing it is that this way I would be able to detect if someone (well, me) uses the wall switch to open it and set the window state to "not sure if closed"  ;)
 

Offline Kim Christensen

  • Super Contributor
  • ***
  • Posts: 1511
  • Country: ca
Re: How to measure/detect AC current in rooflight controller?
« Reply #6 on: July 03, 2024, 08:07:27 pm »
Thinking about it some more, I would try something like this. R4 is the current shunt resistor. Q1/R3 limits the max LED current to 0.7V/R3. D3 conducts during the reverse cycle.
What you get is a pulsed output (50Hz) from the opto when the current is above a set threshold. No pulses when there's low/no current. You'll need a fuse to protect the circuit, because it won't survive 15A+ (With sane component choices) if the motor/wiring shorts. R1/C1 does a bit of noise filtering.
« Last Edit: July 03, 2024, 08:09:55 pm by Kim Christensen »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf