ACS712 sensor testing

Dear all.
I am trying to build simple application. My project goes like this way. I wanted to measure current through device. If current exceed 1A it should trip the relay and protect the same device.
for building this application i have gone with below models
Arduino UNO:

ACS712

relay module

relay control voltage 5v , coil voltage 24v, contact voltage 240vAC,10A

I have found some connection diagram from website which i have attached below.

  1. How to make connection diagram with Relay and load.
    2)I have DC electronic load for testing.IS possible to use and if current exceed 1A like constant current mode can we test it ??

How to measure current exactly here.??As explained below.
https://learn.sparkfun.com/tutorials/how-to-use-a-multimeter/measuring-current

Connection.jpg

My advise, Arduino for reading current measures is a good choise, but for protection issues I don't recommend it.

Protection is more reliable on hardware implementation, they don't deal with software issues, If your Arduino get stuck in the code it may not protect well.

I'd use a common thermal magnetic breaker (these are protecting your home circuits) http://www.bulbscanada.com/image/cache/data/Breaker/QO140-500x500.jpg rated for 1 A, or you can use a SSR relay attached to logic gates with compare output, which compare the current with a setpoint.

We can use watchdog time to avoid hanging right. Even i prefer these kind of stuff. But My project cost should be low so i am prefering these kind of solution. Please let me know protection device i need to build it succefully.

What is your failure-clearing time requirement?

This my application
Load is connected to ACS712 module via relay module. Intailly it is under normally closed operation . Once current exceeds 1A. relay got trip device being protected.

Future development: If relay got trip send SMS on mobile for failure.

@ present i am concentrating on How to build circuit with relay module.
response time might 5s.

i have attached my circuit i wanted to how can i connect measure and relay here with device to be protected. below circuit is right or wrong

Here is my code. Let me know what things need to be changed. I am getting same output as without load connected.

int Sensor_Value;
float voltage;
float ARDUINO_ANALOG_SCALING = 0.00488758;
float Actual_voltage;
float Current_Sensor_Value;
void setup()
{
  Serial.begin(9600);
  pinMode(A0, INPUT) ;
  
}

void loop()
{
 Get_CS_Value(); 
 Serial.println("........................");
  delay(1000);
}

float Get_CS_Value()
{
  
Sensor_Value=analogRead(A0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  voltage = Sensor_Value * ARDUINO_ANALOG_SCALING;
  Actual_voltage=voltage-2.5;
   Serial.print("voltage_output is :");
  Serial.println(Actual_voltage);  
  Current_Sensor_Value=Actual_voltage*10;
  Serial.print("current sensor value is:");
  Serial.println(Current_Sensor_Value);
  return(Current_Sensor_Value);
  
}

Connection.jpg

Look up polyfuse in the wiki

Mark

If your using the ACS712 low current module try using this sketch for testing:

const byte unusedAnaPins[] = {
  A1, A2, A3, A4, A5
};

const byte unusedDigPins[] = {
  2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
};

float offSet = 2.44009; // ACS712 low current board unloaded output voltage

void setup() {
  for (byte i = 0; i < 5; i++) {
    pinMode(unusedAnaPins[i], INPUT_PULLUP);
  }

  for (byte i = 0; i < 11; i++) {
    pinMode(unusedDigPins[i], INPUT_PULLUP);
  }
  Serial.begin(9600);
}

void loop() {
  float sample2SolCrnt = 0.0;
  float solar_crnt = 0.0; // Solar panel current variable
  float solarCrntVal = 0.0; // Current callibration variable
  for (int i = 0; i < 1000; i++)
  {
    sample2SolCrnt += analogRead(A0);
    delay(1);
  }
  sample2SolCrnt = sample2SolCrnt / 1000;
  solar_crnt = sample2SolCrnt / 1023.0 * 4.995117 + 0.002441;
  solarCrntVal = solar_crnt - offSet; // Subtract offset voltage here
  Serial.print("A = ");
  if (solarCrntVal > -.015 && solarCrntVal < .015) {
    Serial.println("0.00");
  }
  else {
    Serial.println(solarCrntVal * -1, 2); // Multiply by -1 to inverse reading
  }
  delay(500);
}

DON'T CROSSPOST!. You have been given good answers in your other thread.

Mark

void setup() {
Serial.begin(9600);
}
void loop()
{
CS_Output();
delay(1000);
}
void CS_Output()
{
  float average = 0;
  for(int i = 0; i < 1000; i++) {
    average = average + (.0264 * analogRead(A0) -13.51) / 1000;
    delay(1);
  }
  average=average+0.16;
  Serial.println(average);  
}

Here code i downloaded one of the website. But i didnt understand this part of code.can some one explain me.

 average = average + (.0264 * analogRead(A0) -13.51) / 1000;

I have attached my output window. Sensor reading from Serial monitor 0.42 But if i measure in dc electronic load 0.38A similarly in 0.39A in multimeter. Can some tell me how can i calibrate the values to get close to value . I know the accuracy 5%
for above . can we still reduce it.

My current setup as show in below diagram. I have 2 fans

1)http://www.mouser.in/ProductDetail/ADDA/AD0612HX-A71GL-LF/?qs=hTx6WCxFMbgcZc/FmemT9A==
2)http://www.mouser.in/ProductDetail/ADDA/AD0812XB-A73GL-LF/?qs=PieNiMrGZlqvWjV0xsttzA==

slno                   fans               Actual_dc load      Before_conversion    after_ conversion
1                    AD0612HX                        0.15A                      0.09a                                  0.15A
2                    ADO812XB                       0.40A                       0.25A                                  0.32A
3                  WHEN COMBINE             0.52A                         0.35A                                   0.41A

MY_CODE

void CS_Output()
{
  float average = 0;
  for(int i = 0; i < 1000; i++) {
    average = average + (.0264 * analogRead(A0) -13.51) / 1000;
    delay(1);
  }
  Serial.print("before calibration:");
  Serial.println(average);
  average=average+0.07;
    Serial.print("after calibration:");
  Serial.println(average);  
}

how to keep the correction factor value. so i can get approximate values.