Arduino Amperemeter ACS758 on existing machine

Hello, im trying to measure the ampere of a 90kw 160A Motor with an ACS758 ECB 200B.
Currently there is an analog amperemeter (MI 48 200A ESAN). I used the wires from the analog amperemeter and connected them to my ACS758, then followed this tutorial for the code: (https://www.youtube.com/watch?v=SiHfjzcqnU4)
This is the code I used:

/*
 * 
 * Arduino Sketch for Allegro ACS758 Current Sensor (Advanced)
 * this sensor can measure current at range of up to 200A
 * It operates with 3.3 or 5V
 * Please watch video instruction and explanation for this code.
 * 
 * Written by Ahmad Shamshiri on Saturday May 27,2018 at 13:19 at Ajax, Ontario, Canada
 * for Robojax.com
 * View the video instruction at
 * This code has been downloaded from Robojax.com
 */
#define VIN A0 // define the Arduino pin A0 as voltage input (V in)
const float VCC   = 5.0;// supply voltage 5V or 3.3V. If using PCB, set to 5V only.
const int model = 6;   // enter the model (see below)

float cutOffLimit = 1.00;// reading cutt off current. 1.00 is 1 Amper

/*
          "ACS758LCB-050B",// for model use 0
          "ACS758LCB-050U",// for model use 1
          "ACS758LCB-100B",// for model use 2
          "ACS758LCB-100U",// for model use 3
          "ACS758KCB-150B",// for model use 4
          "ACS758KCB-150U",// for model use 5
          "ACS758ECB-200B",// for model use 6
          "ACS758ECB-200U"// for model use  7   
sensitivity array is holding the sensitivy of the  ACS758
current sensors. Do not change.          
*/
float sensitivity[] ={
          40.0,// for ACS758LCB-050B
          60.0,// for ACS758LCB-050U
          20.0,// for ACS758LCB-100B
          40.0,// for ACS758LCB-100U
          13.3,// for ACS758KCB-150B
          16.7,// for ACS758KCB-150U
          10.0,// for ACS758ECB-200B
          20.0,// for ACS758ECB-200U     
         }; 

/*         
 *   quiescent Output voltage is factor for VCC that appears at output       
 *   when the current is zero. 
 *   for Bidirectional sensor it is 0.5 x VCC
 *   for Unidirectional sensor it is 0.12 x VCC
 *   for model ACS758LCB-050B, the B at the end represents Bidirectional (polarity doesn't matter)
 *   for model ACS758LCB-100U, the U at the end represents Unidirectional (polarity must match)
 *    Do not change.
 */
float quiescent_Output_voltage [] ={
          0.5,// for ACS758LCB-050B
          0.12,// for ACS758LCB-050U
          0.5,// for ACS758LCB-100B
          0.12,// for ACS758LCB-100U
          0.5,// for ACS758KCB-150B
          0.12,// for ACS758KCB-150U
          0.5,// for ACS758ECB-200B
          0.12,// for ACS758ECB-200U            
          };
const float FACTOR = sensitivity[model]/1000;// set sensitivity for selected model
const float QOV =   quiescent_Output_voltage [model] * VCC;// set quiescent Output voltage for selected model
float voltage;// internal variable for voltage
float cutOff = FACTOR/cutOffLimit;// convert current cut off to mV

void setup() {
    //Robojax.com ACS758 Current Sensor 
    Serial.begin(9600);// initialize serial monitor
    Serial.println("Robojax Tutorial");
    Serial.println("ACS758 Current Sensor");
}

void loop() {
  //Robojax.com ACS758 Current Sensor 
  float voltage_raw =   (5.0 / 1023.0)* analogRead(VIN);// Read the voltage from sensor
  voltage =  voltage_raw - QOV + 0.007 ;// 0.007 is a value to make voltage zero when there is no current
  float current = voltage / FACTOR;
  if(abs(voltage) > cutOff ){
    Serial.print("V: ");
    Serial.print(voltage,3);// print voltage with 3 decimal places
    Serial.print("V, I: ");
    Serial.print(current,2); // print the current with 2 decimal places
    Serial.println("A");
  }else{
    Serial.println("No Current");
  }
  delay(500);
}
 
  
Arduino Code for Allegro ACS758 Current Sensor (Basic)
This is basic code to measure current using Allegro ACS758 Current Sensor . See video for details.


  

/*
 * Arduino Sketch for Allegro ACS758 Current Sensor (Basic Simple)
 * this sensor can measure current at range of up to 200A
 * It operates with 3.3 or 5V (the module works with 5V, sensor can work with 3.3 or 5V)
 * Please watch video instruction and explanation for this code.
 * 
 * Written by Ahmad Shamshiri on Saturday May 26,2018 at 19:05 at Ajax, Ontario, Canada
 * for Robojax.com
 * View the video instruction at https://youtu.be/SiHfjzcqnU4
 * This code has been downloaded from Robojax.com
 */
#define VIN A0
const float vcc    = 5.00;// supply voltage 5V or 3.3V
const float factor = 0.02;// 20mV/A is the factor

float voltage;

void setup() {
    //Robojax.com ACS758 Current Sensor 
    Serial.begin(9600);
    Serial.println("Robojax Tutorial");
    Serial.println("ACS758 Current Tester");
    Serial.println("Basic Simple Code");
}

void loop() {
  //Robojax.com ACS758 Current Sensor 
  voltage =   (5.0 / 1023.0)* analogRead(VIN);// Read the voltage from sensor
  voltage =  voltage - (vcc * 0.5) + 0.007 ;// 0.007 is a value to make voltage zero when there is no current
  float current = voltage / factor;
  Serial.print("V: ");
  Serial.print(voltage,3);
  Serial.print("V, I: ");
  Serial.print(current,2); Serial.println("A");
  delay(500);
}

But the output stays on "no current" even when I power the motor on. I dont have a PCB for my ACS758, I connected everything directly on the Sensor.

Has someone an idea where the problem could be? Or is there another option to measure the ampere with my arduino?

Here is a pic of the circuit diagram of my machine. The PA6.1 is the analog Amperemeter which I would like to replace with my arduino

How?

Arduino 5v - ACS758 VCC
Arduino GND - ACS758 GND
Arduino A0 - ACS758 OUT

ACS758 IP+ - one wire from the analog Amperemeter
ACS759 IP- - the other wire

I see two issues:

  1. Looks like the ammeter is connected to a current transformer, so the the current will be much much less than 200A

  2. Your program will only work for DC not AC

ACS758 will measure AC current. My main question is how it's connected. I still don't know if it's inline with the existing sensor or connected in parallel (which obviously won't work).

My analog ammeter goes up to 200A on the scale when I start the motor. When the motor is running, it shows ~20A on the scale.

I disconnected the existing analog ammeter and connected the ACS758 to that wires instead

I could not find any info on the meter but according to the wiring diagram it still looks like it's connected to a current transformer with a scaling of 200/5A

Assumming this is an AC motor the program won't work because it's only for DC

are you dealing with AC or DC? if AC single or three phase? what voltage?

for measuring single and thee phase AC I have used SCT-013 current clamps
however, they are only rated up to 100amp
not sure if you could change the burden resistor

Edit: what microcontroller are you using?
could you upload a schematic of the circuit?

I only found this one, dont know if its the same. Because the scale on mine goes from 0-200A

MI48C - E.S.A.M. Unicenter srl (esam.biz)

So you think the mistake is in the code? The sensor should be able to measure AC and DC

Yes it can measure AC or DC but your program will only measure DC current.

It should be single AC phase, where I am measuring. The motor runs on 400v.
I use the Arduino Uno R4 Wifi and have only connected that sensor for testing.

Arduino 5v - ACS758 VCC
Arduino GND - ACS758 GND
Arduino A0 - ACS758 OUT

ACS758 IP+ - one wire from the analog Amperemeter
ACS759 IP- - the other wire

My browser says the link is a security risk.

Please post the manual here.

Even though the scale says 200A doesn't mean it's actually measuring 200A, it might have a built in scale factor.

I have tried many different code samples, even just very simple ones but never saw a different output when I turned the motor on.

What does that current transformer 200/5A? Could it be that there are not that much ampere and on my analog ammeter is just the scale different and so the ACS758 200A is too high to notice a different?

MI48C è un indicatore analogico 90° da pannello (formato 48 x 48 mm) adatto a leggere una corrente alternata . MI48C è la soluzione ideale per qualsiasi tipologia d’impianto, applicazione o quadro in cui vi sia la necessità di visualizzare con precisione ed affidabilità un segnale in corrente alternata per es. 0…1A -0…5A – 0…10A da TA/5A o /1A ecc. E’ possibile cambiare la scala per adattarla ad ogni tipologia d’impianto. Lo strumento verrà fornito con scala realizzata secondo le vostre necessità di visualizzazione. E’ possibile inoltre applicare segni rossi o di qualsiasi colore sulla scala evidenziando i punti scala desiderati.

Exactly yes.

First you need to determine the actual current passing through PA6.1 ammeter on your wiring diagram.

Next you need a program that can read AC currents and provide you with an RMS value

do you have an oscilloscope to look at the signal on A0?
if not a multimeter to check the voltage ?

if reading AC you probably have to sample for a few cycles and calculate the RMS current

Edit: try a web search for arduino ACS758ECB-200B reading AC

Thank you very much will try that asap!

I dont have an oscilloscope, but i can measure it with the multimeter. will try that thank you!