RobTillaart/ACS712

Testing version 0.3.0

Closed this issue · 6 comments

Hello Rob,

Sorry something wrong with 0.3.0 as mA_AC_sampling () returns a large
number eg 319445 mA when connected to the ACS712 at zero current.

Test Rig changes to verify results are:
Hardware, Connected A0 to A1.

Software, Added lines of code to display ADC output of A1 and raw valve
at A0
MaxmA = analogRead( A1 );
lcd.setCursor(0, 0);             lcd.print( "Max mA's: " ); lcd.print(
MaxmA );

Test a.
ACS712 connected to A0 and A1 (As normal)
Output A1=513, mA_AC_sampling () output= 319445 mA

Test b.
Disconnected ACS712 form A0 and A1
Connected 10k Variable resistor between 0v and vdd (5v rail) and
adjusted to 1/2 vdd
Connected resistor wiper to A0 and A1  (A1 Reading 511, mA_AC_sampling
() returns 22.62mA)
---------------- This test has no ACS712 noise ---------------------

Test c
wiper of 10k Variable resistor still connected to A0 and A1
But connected ACS712 to A0 and A1 via a 10uF tantalum capacitor, thus
injecting ACS712 noise into A0 and A1
A1 Reading is still 511, but mA_AC_sampling () output is a large
changing values in the region of 255234  mA

Test d.
Disconnecting ACS712 from the 10uf capacitor and values are A1=511,
mA_AC_sampling () returns 26.12mA' ish)

It seems that 0.3.0 is super sensitive to ACS712 noise.

Sorry to be bring of bad news Rob, have a good evening, Ian

Originally posted by @imk2021 in #22 (comment)

@imk2021
Moved the discussion into a new issue .

Analysis tests

Test a.

Output A1=513, mA_AC_sampling () output= 319445 mA

Cannot explain.
Do you see this problem in both the 0.2.8 branch and the 0.3.0 branch ?
If not it would indicate a problem in my merging.

So please compare the 0.2.8 and 0.3.0 libraries - mA_AC_sampling().

  • with zero load
  • with 1000 W load => does the problem also occur with serious load?

Can you measure the mA_peak2peak() with no load?

Test b.

A1 Reading 511, mA_AC_sampling() returns 22.62mA

This is expected as the AC_sampling() samples the noise.

Test c.

A1 Reading 511, mA_AC_sampling () returns 255234 mA

Identical (not understood) cause as test a.

Test d.

A1=511,mA_AC_sampling () returns 26.12mA

As expected.

Noise

It seems that 0.3.0 is super sensitive to ACS712 noise.

I would turn that around, the ACS712 introduces a lot of noise.

  1. from itself (the breakout?)
  2. indirect from power supply

So
How do you power the ACS712?
From Arduino?
Separate power supply? preferred!
Can measure the stability of power


I must find time to setup a test bench and do some tests myself.

@imk2021

Think I found the cause, I reverted _midPoint to be signed int again.
In the code the current = analogRed() - midpoint failed due to signed unsigned mixing.

I have updated the develop branch with the fix.
So please download latest version before testing.

Good evening,

Did you have a nice day with your old mates?
Think there were beautiful stories that brought back lots of memories.
A day to remember!


FYI, how I did the analysis.

I had replaced the analogRead() calls with a simulation so I could quickly test different signals.
That showed me where I went wrong so I could revert the datatype of the midPoint (reference level).

It also showed me a way to implement support for an external ADC like the MCP320X series.
That is an idea for the future.