[SOLVED] ACS723 different zero points when adjacent relay is on/off

I have an ACS723 connected to a 12bit MCP3221 with some logic level translation and a 5v reference powering all of the devices. This was largely inspired by Wawa on the forums here.

The ACS723 is positioned next to a relay (not the greatest I know but the only place I could fit it), and is in series with the common terminal of the relay. Currently, I am using the ACS to measure DC voltage for testing purposes (the actual use-case is AC voltage).

I am able to get accurate current measurements with this configuration that is within ~2% of what my multi-meter says so I am happy enough.

The weird this is with no load connected and the relay OFF then my raw adc value from the acs is 2500mV +/- 3, with no load and the relay ON then my value is 2588mV +/- 3. Now this really isn't an issue for me as the use-case is either designed to interrupt or connect power but not both (e.g. NC or NO will be used per application) so I can easily just set the zero point for that particular config.

I was really just wondering if this was due to the proximity of the relay to the acs causing consistent interference? The only thing that led me to believe otherwise was that wouldn't said interference cause a lot of noise in the readings if that were the case? because I am getting either consistently 2588 or 2500 +/- 2-3mV.

OR if there is some other quirk in my circuitry? Note: the aforementioned reference does not power the relay and I am not picking up any concerning transients on the power rails when the relay switches on.

If anyone could suggest things I might be overlooking, or potential explanations that would be great!

Attached is a PDF of all the schematics that went in to this board, and here is a public link to the board on easyeda.

Schematic_irrigationstation_20191101010506.pdf (158 KB)

So what ?
Why do you care ?
The no load case is "X-Don't Care".
Just ignore it.
You probably forgot to account for that case when you designed it. Something is either 'open' or not grounded in that case .
It's microcontroller . Tell it to ignore that case
and forget it.
Connect the dots (LITERALLY. Get a pen and draw lines to connect everything and follow the lines and apply Ohm's Law.)
Ohm's Law should apply 100% of the time, mot just when you have a load. If you put the current sensor IN SERIES with the RELAY COMMON and then TURN OFF the relay, what is the circuit path for the sensor ? (WHAT EXACTLY is it measuring ?)
(nothing ?)
In any properly designed current sensor application ,
ALL of the data is VALID, even with no load.
If you plot it you can see the current go to zero.
The sensor is measuring something. Find what it is
measuring . Get a meter and measure voltage drops (old school) Ignore the sensor readings
and get a sheet of printer paper and a DMM and a pot of coffee and don't go to sleep until you have measured and recorded voltage drops everywhere.
You have to get off your ____ and roll up your sleeves if you want to find it. If all that sounds like too much work then just ignore it and forget it.
In all likelyhood you're not going to find it on the forum. (I'm assuming you read the sensor dstadheet)
When all's said and done you'll probably find thst all you need is a shorting resistor when there's
no load so the current is zero.
I didn't see any comment to the effect that the
circuit works correctly when you need it to work.
All I see is complaints about how messed up it is when you don't need it to work. (as if that were
worth losing any sleep over)

raschemmel:
So what ?
Why do you care ?
The no load case is "X-Don't Care".
Just ignore it.
You probably forgot to account for that case when you designed it. Something is either 'open' or not grounded in that case .
It's microcontroller . Tell it to ignore that case
and forget it.
Connect the dots (LITERALLY. Get a pen and draw lines to connect everything and follow the lines and apply Ohm's Law.)
Ohm's Law should apply 100% of the time, mot just when you have a load. If you put the current sensor IN SERIES with the RELAY COMMON and then TURN OFF the relay, what is the circuit path for the sensor ? (WHAT EXACTLY is it measuring ?)
(nothing ?)
In any properly designed current sensor application ,
ALL of the data is VALID, even with no load.
If you plot it you can see the current go to zero.
The sensor is measuring something. Find what it is
measuring . Get a meter and measure voltage drops (old school) Ignore the sensor readings
and get a sheet of printer paper and a DMM and a pot of coffee and don't go to sleep until you have measured and recorded voltage drops everywhere.
You have to get off your ____ and roll up your sleeves if you want to find it. If all that sounds like too much work then just ignore it and forget it.
In all likelyhood you're not going to find it on the forum. (I'm assuming you read the sensor dstadheet)
When all's said and done you'll probably find thst all you need is a shorting resistor when there's
no load so the current is zero.
I didn't see any comment to the effect that the
circuit works correctly when you need it to work.
All I see is complaints about how messed up it is when you don't need it to work. (as if that were
worth losing any sleep over)

It matters in the sense that the zero current reading is used as a calibration step. And, as you pointed out, and as I said in my post, this can be easily adjusted for in software so I am not too concerned but curious.

As I mentioned in my post the circuit does work when it needs to work at least for DC current (3rd paragraph).

If you are curious about the circuit path I've attached a picture (white shows the normal path COM->NC) and as you can also see the path COM->NO is pretty much the same. The attachments in the first post might give a better idea.

In any case you are right, I probably have to do some more troubleshooting. The sensor is indeed measuring something constant and without much variability but I was looking for a nudge in the right direction to troubleshoot this.

circuit.png

There must be some voltage difference between VCC of the ACS and VDD of the MCP,
and/or some voltage difference between ground of the ACS and MCP.

Zero is not relevant for measuring AC.
All that matters is the difference between min and max A/D values of the peaks (peak/peak).
Leo..

Wawa:
There must be some voltage difference between VCC of the ACS and VDD of the MCP,
and/or some voltage difference between ground of the ACS and MCP.

Zero is not relevant for measuring AC.
All that matters is the difference between min and max A/D values of the peaks (peak/peak).
Leo..

With regards to your first point, I am failing to understand how the relay state is influencing either of the sensors VCC or VDD. If there was a difference in ground between the two, then wouldn't the "error" persist across relay states?

The zero point of the AC sinus wave might not be relevant, but the zero point of the ACS output under 0 load is afaik as it is required to know this to get accurate measurements.

Hi,
Ops schematic.


Is the 723 on the power or load side of the relay switch?
Tom.. :slight_smile:

All that matters is the difference between min and max A/D values of the peaks (peak/peak).

Well, technically speaking with regard to AC, can we not say that:

zero = (max-min)/2

?
FYI,
"of the AC sinus wave "
It's called "Sine Wave", not "Sinus Wave".
"Sinus" is a medical term .
(as in Sinusitus, ( inflamation of the sinus)

Why are you using Instagram instead of uploading the photos directly ?
Instagram doesn't work for me.

alex_fagard:
With regards to your first point, I am failing to understand how the relay state is influencing either of the sensors VCC or VDD. If there was a difference in ground between the two, then wouldn't the "error" persist across relay states?

Circuit board traces are resistors. Tiny values, but still resistors.
The current draw of a 100mA relay can cause a voltdrop across those resistors.
VCC and ground(plane) layout is important.

raschemmel:
zero = (max-min)/2

For AC you find the two peaks, and subtract.
Absolute values are not important with zero current.
512-512 is zero
511-511 is also zero
Pseudo code for a 12-bit A/D.

minValue = 4095; maxValue = 0; // reset
for (int i = 0; i < numSamples; i++) {
  sensorValue = analogRead(sensorPin);
  if (sensorValue > maxValue) maxValue = sensorValue;
  if (sensorValue < minValue) minValue = sensorValue;
}
sensorValue = maxValue - minValue;
current = sensorValue * someFactor;

Leo..

raschemmel:
All that matters is the difference between min and max A/D values of the peaks (peak/peak).

Well, technically speaking with regard to AC, can we not say that:

zero = (max-min)/2

?
FYI,
"of the AC sinus wave "
It's called "Sine Wave", not "Sinus Wave".
"Sinus" is a medical term .
(as in Sinusitus, ( inflamation of the sinus)

Why are you using Instagram instead of uploading the photos directly ?
Instagram doesn't work for me.

Instagram? Huh? Where do you see that? All the photos are uploaded directly.

Could be that the magnetic field from the relay coil is affecting the Hall sensors on the ACS723.

I think what I am going to do to rule that out, as well as what Wawa suggested as a potential voltage drop somewhere in the planes is - I have a board that is currently unpopulated, I'll make it up WITHOUT the relay connected to any of the board traces and connect it to an external power supply. If the problem persists, it is the magnetic field of the relay or something else in the relay causing it, if the problem doesn't persist, I know I made a mistake in the board layout/design and need to do more investigating there.

"current = sensorValue * someFacor;"

Is that supposed to be "someFactor" ?

raschemmel:
"current = sensorValue * someFacor;"

Is that supposed to be "someFactor" ?

Yep, corrected. Sausage-fingers and 10-year old failing keyboard.
Multiplication factor depends on A/D and type of ACS723 chip.
Leo..

The ACS723 doesn't report current polarity(+/-)
?

raschemmel:
The ACS723 doesn't report current polarity(+/-)
?

The AB versions seem to be bi-polar (also for AC), and the AU versions uni-polar.
See datasheet, page2.

"Ratiometric output from supply voltage" means AFAIK that zero current is VCC/2 out (not necessarily 2.5volt).
And mV/Amp is also depending on supply voltage.
Giving an absolute/fixed mV/A sensitivity (table on page2) is just wrong.

alex_fagard:
The weird this is with no load connected and the relay OFF then my raw adc value from the acs is 2500mV +/- 3, with no load and the relay ON then my value is 2588mV +/- 3.

This expression is essentially also wrong. Should work with A/D values.
They don't change with supply variations.
Leo..

It's a simple split range with 2.5 V to 5 V representing positive current and 2.5 V to 0 V representing negative current with Vcc/2 being
the 0 point and 0 V out being the negative current
peak ?

Almost correct.
The output range is not 0-5volt but 10-90% of VCC (0.5volt to 4.5volt on a 5.0volt supply).
Leo..

Hi,
Because the current sensor is radiometric any change in its 5V supply will be reflected in the "mid range" zero current voltage output, independent of the load.
The sensor may need thicker tracks to supply current to it, or a separate 5V regulator of its own.
The supply tracks may be part of a daisy chain supply, that has current going to other peripherals flowing through it as well as the sensor supply current.
Just my thoughts..

Tom... :slight_smile:

TomGeorge:
Hi,
Because the current sensor is radiometric any change in its 5V supply will be reflected in the "mid range" zero current voltage output, independent of the load.
The sensor may need thicker tracks to supply current to it, or a separate 5V regulator of its own.
The supply tracks may be part of a daisy chain supply, that has current going to other peripherals flowing through it as well as the sensor supply current.
Just my thoughts..

Tom... :slight_smile:

See schematic/board layout in #1 post but to summarize: the sensor only requires 14mA and the track traces are .5m - more than enough. Only the ACS, MCP, and logic converters are powered by the 30mA max reference 5v supply. In total, the reference can supply more than enough current. GNDs tied together with the main 5v power supply (issue might be here) as it is one giant ground plane. To summarize, the 12v input to the reference, SCL, SDA, and GND are the only "external" traces to this section of the board. I have confirmed that, atleast, the reference power supply does not have any noticeable fluctuations when the relay is powered on.

TomGeorge:
Hi,
Ops schematic.


Is the 723 on the power or load side of the relay switch?
Tom.. :slight_smile:

It interrupts the common, so power-side. The net ports of the relay that match up with the ACS is visible on the 2nd page of the schematics.