Measure 50-70mA AC

Ideally, I need to reliably measure a really small amount of AC current approximately 50-70mA. However if that isn't feasible, simply detecting whether or not a 50-70mA source is on will suffice.

The source is a irrigation solenoid (I need to determine when it is on to update my log as to when it was last on).

I have an Lolin D1 mini pro (esp8266 based).

I already have a few acs712 on hand. But they haven't been so reliable with such a small amount of current. Perhaps it is just the one's I've got (cheap off Amazon).

If anyone has any experience, or product recommendations with this sort of thing it would be much appreciated!

Hi,
Why not use an optocoupler across the valve solenoid?
A small bridge rectifier between the solenoid coil and the opto to provide DC feed.

The advantage would be the Arduino would be isolated form the inductive circuit of the solenoid control circuit.

Tom... :slight_smile:

Here's my idea:

L1 is the solenoid.
R1 may not be needed. Put the bridge across the solenoid to make sure it still activates without R1
C1 smooths the output of the bridge or else you could be seeing a square-wave output from the opto-coupler. Use a 47uF Electrolytic.
R2 is needed to protect the LED in the opto-coupler.

Configure the GPIO to INPUT_PULLUP, or better, use an external pullup of 10K.

When the solenoid is energised, measure the DC voltage on C1 to calculate the value of R2 you need to protect the diode.

GPIO will be low when the solenoid is energised and high when not.

Measuring current draw should be more reliable than voltage across the solenoid.
Current would also detect a faulty solenoid.

Construct a ~1.5volt power zener with three 1N4004 diodes.
Two in series, and one reversed in parallel to the two.
That ~1.5volt peak voltage could drive an opto LED via a 47ohm resisor.
The opto transistor goes between Arduino pin and ground, with internal pull up on the pin.
Bridge zero-crossings in software, or add a cap across the opto transistor.
Leo..

alex_fagard:
I already have a few acs712 on hand. But they haven't been so reliable with such a small amount of current. Perhaps it is just the one's I've got (cheap off Amazon).

If anyone has any experience, or product recommendations with this sort of thing it would be much appreciated!

If you need the actual reading, I have used an INA219 ( clone) quite reliably on anywhere between 0 and 30mA.
Would go higher, just my application.

I assumed (wrong), seeing ACS712 in post#0, that OP wants to measure mains power.
Can't use an INAxxx for that.

If posters would read the "how to post" sticky, and posted accordingly, then there would be a lot less of our time wasted.
Leo..

Ideally, I need to reliably measure a really small amount of AC current approximately 50-70mA.

What is the rms AC source voltage?

jremington:
What is the rms AC source voltage?

The solenoid operates off 120v mains (US).

Wawa:
I assumed (wrong), seeing ACS712 in post#0, that OP wants to measure mains power.
Can't use an INAxxx for that.

If posters would read the "how to post" sticky, and posted accordingly, then there would be a lot less of our time wasted.
Leo..

Either measuring or just simply detecting is fine as I said originally. I just happened to have some ACS modules on hand but as I said, detecting less than 100ma wasn't happening reliably.

TomGeorge:
Hi,
Why not use an optocoupler across the valve solenoid?
A small bridge rectifier between the solenoid coil and the opto to provide DC feed.

The advantage would be the Arduino would be isolated form the inductive circuit of the solenoid control circuit.

Tom... :slight_smile:

That in conjunction with Steve's diagram as well as Wawa's tips gives me a great starting point! Thanks guys :wink:

Draw/post a hand-written circuit diagram of the proposed circuit.
Then I (we) can check if you did understand the concept.
Leo..

The wire will have a changing field that would be stronger if coiled, more turns make a stronger field. A good linear Hall sensor could measure that. You would have to gather samples up to 9 per ms, at mains 50 or 60 Hz the sine wave peaks could be known and the controller will never touch that AC.

Wawa:
Draw/post a hand-written circuit diagram of the proposed circuit.
Then I (we) can check if you did understand the concept.
Leo..

Thank you for your offer. Here is what I've got:

Schematic_irrigationstation_Sheet-1_20191002021215.png

Schematic_irrigationstation_Sheet-1_20191002021215.png

So you did go for voltage detection, not current detection.

R2 can be removed. Use internal pull up on the pin instead.

pinMode(detectorPin, INPUT_PULLUP);

Leo..

Wawa:
So you did go for voltage detection, not current detection.

R2 can be removed. Use internal pull up on the pin instead.

pinMode(detectorPin, INPUT_PULLUP);

Leo..

I mean, at the end of the day it seemed easier. And while knowing the current is nice, it is always the same in my application, and really serves no purpose from a user perspective. Thanks for the tips!

It's not about knowing the current (which you don't with an opto).
As said, current measurements also detects if the solenoid is faulty.
But that might not be important in this case.

390k (R1) could be too high. Start with 100k, and see if the Arduino pin gets LOW.
Leo..

Here is the final circuit I used:

Please note, your frontend doesn't have to be this complex. It can also be just use two resistors - one on the live and one on the neutral of 100k each, or you can have a frontend similar to what Wawa described using diodes however using that method your circuit would have to be in series with either the neutral or live wires.

The Schmidt trigger buffer is entirely optional but I found it does a really great job of smoothing the output and making zero-crossings easily detectable.

Using capacitors instead of resistors is a good idea: saves dealing with the heat.

Do make sure you have appropriately rated capacitors, preferably X rated safety capacitors.

alex_fagard:
I need to reliably measure a really small amount of AC current approximately 50-70mA.

alex_fagard:
Here is the final circuit I used:

Then you failed your requirements.
Leo..

Wawa:
Then you failed your requirements.
Leo..

Nope. This was just in response to where the thread went with straight line detection. As you are aware given that you were active in my other post, I've got both line detection and ac current detection. However, I added the circuit for the current part as well here (anyone interested, the code is available in the linked post).

I use the line detection to determine if current even needs to be measured at low currents given that the current sensor output varies a bit when no load is present.

wvmarle:
Using capacitors instead of resistors is a good idea: saves dealing with the heat.

Do make sure you have appropriately rated capacitors, preferably X rated safety capacitors.

I've got 230 volt caps, but the whole circuit is protected by a ptc and a tvs so it should be fine. Even if one cap fails, there is redundancy in this setup.

alex_fagard:
However, I added the circuit for the current part as well here...

That's what I mean.
I don't see a current detector in post#14, only a voltage detector.
I am aware of your other (cross-)post where you also use a current detector.
Leo..