Obsolete Values

These are current sensors : ammeters

They cannot be ammeters as I understand them. This is what I call an ammeter:
image
An ammeter does not normally have 5 connections.

Who is the manufacturer, what is the type and part number?

It’s just a schema but these are ACS712 power factor

I’m using that in reality :

image

From the ACS712 data sheet:
“Fully Integrated, Hall Effect-Based Linear Current Sensor IC”
That is exactly what I said you needed.

Also from the data sheet - I am guessing that you are using the 20 A version:

Output voltage is 100 mV / A, and the output voltage at zero current is 2.5 V.
Therefore, my sketch was not correct - you must first subtract 511 (approximately - this might be different for each unit) from the number you read:

double I1 = (analogRead(A0) - décalé1) * étalonnage1;

That means:
décalé1 ≈ 511
and
étalonnage ≈ 0.0489

Sorry ,but what does this number mean ?

And i’m wondering if it communicate with emoncms local server with the new sketch ( if yes , how ?)

I’ve used the sketch that you’ve advised and i’ve got that kind of results :

The output from your ACS712 is 2.5 V at 0 A, 0 V @ -20 A and 5 V at + 20 A
The numbers that analogRead( ) gives you are 0 at 0 V, 511 at 2.5 V and 1023 at 5 V, and those translate to 0 at -20 A, 511 at 0 A and 1023 at +20 A.

Therefore, to read zero, you must subtract 2.5 V or the number 511. If your ACS712 does not give you exactly 2.5 V (or your Arduino input does not read exactly 511 when the input is 2.500 V), then ‘511’ will be incorrect, and you must adjust it.

It communicates exactly the same way, like your old sketch. I did not change that part.

Until I know the real current that those numbers correspond to, I cannot know what is happening.

Here is what you do:
With zero current, adjust the number “511” for offset (décalé) until the number on emonCMS is zero.
Set a current that you know (measure with a multimeter if possible) and adjust the calibration (étalonnage) until the number on emonCMS is the correct power.

I’m thinking about creating more than one variable “decale” for each input cause their value are not the same at beginning(and adjust those variable until i have 0 on each input) .What do you think ?

Yes, that will be good. It is almost certain that the number that you require will be different for each ACS712.

I was testing what you’ve told me but i’m wondering on something :

The AnalogRead(Pin) in the code reads the Voltage on my Pin right ? What i want to calculate is a Current (I1) in this line : double I1 = (analogRead(A0) - décalé1) * étalonnage1;

I’m not sure understanding all you’ve told me : i was trying to modify my decale’s values but i could not reach a number close to 0 for my power.The only thing i’ve thought about is if i want to have 0 for my power , i need to have 0 for my current and for that i need to have analogRead(Pin) = décaléX (X is 1,2,3 or 4 for my inputs)

The thing is that i didn’t succeed to do that if I am right.

Thanks for your help :wink:

When you have zero current, and everything else is perfect, your ACS712 should be giving you 2.500 V. analogRead(A0) should therefore have the value 511 or 512, that is exactly mid-way between 0 ( =0 V ) and 1023 ( = 5 V ).

Therefore, you should be able to subtract 511 ( or 512 ) and get zero, representing the actual current.

What number does analogRead(A0) return? (I know it might vary by a few either way - that is ‘noise’.) Is it a long way from 511?

I’ve got this when i use decale = 511 .

Here are the value for the A0 when i print AnalogRead(A0) for example:
image

Thanks for replying

OK, so what do you get for (analogRead(A0) - décalé1) when décalé1 = 498?

(If you had copied and pasted those values rather than posting a screenshot, I could have copied them into a spreadsheet and calculated the average - because that average value is what you should put in décalé1.)

Sorry that was A3 that i’ve printed and when i use decale4 (for A3)= 498 , i have this kind of serie of values :

7
6
8
9
7
8
7
7
7
6
7
7
9
6
6
7
6
7
8
8
7
8
8
6
8
7
6
7
8
6

Adjust the value of the appropriate decale until you read zero or as close as possible to zero for (analogRead(An) - décalén).

I’ve done that but in emoncms i have value so high(i’ve (analogRead(A n ) - décalé n ) very close to 0 for each An) , i don’t know why :

Do not look at EmonCMS until we finish adjusting the values in your Arduino.

Now print the value of I1, measure the current flowing when charging the bike, and adjust étalonnage1 so that you get the correct value for I1. Do not change décalé.

I simulate the bike with my dc power supply , i’ll do what you’re saying thanks.

@Atelier21 - Is there anything connected to the IP in and IP out terminals of the ACS712s when you are testing for a zero value? You should calibrate for zero before wiring to the bikes if there is any chance of batteries trying to balance (through the common supply rails) or a charger/indicator/meter/LED or any electrical circuit activity at all, even if you expect it to be asleep or off.

Also, you might want to try another power supply to the Arduino, they are notorious for poor ADC readings when powered via USB. Ideally try a bigger PSU, but you might be able to just try powering the Arduino via 5v direct from the Pi GPIO to the 5V rail of the Nano (plus a ground too).

Do you get the same readings when connected to the Pi as when connected to your PC and viewed via the Arduino IDE? If not, this might be because of differences in the USB voltages and/or noise in your Pi’s environment.

Hi , the IP- output of the ACS712 is connected directly on the batteries and the IP+ input is connected to “the bike inputs”

My power supply is a DC power supply which can provide 0-10A and 0-30V

I’m not sure understanding ?

So there could be some current passing through the sensors when everything is off because all the bike batteries are connected in parallel ,via the ACS712 sensors.

Calibrate your zero points with nothing connected to IP in or IP out. Once it is set to zero and tested as zero, then add your connections. If it is no longer zero once connected, it is because current is detected.

But the Arduino is using USB designed for 500mA, the Pi can supply up to 1.2A via a USB but the voltage regulation on the Arduino’s USB is minimal, there are many reports of Arduino’s ADC’s not working well when powered via USB. It doesn’t matter how big or stable your power supply is if you are then going through the Arduino’s USB port.

If you connect your Arduino to the PC/IDE do you get the same “not zero” values as when you connect the Arduino to the Pi?