Week 1 - Current Sensor (I): Implementing the circuit

Week 1


Figure 1: Current Sensors

We made some minor adjustments to the code as the sensitivity setting varies with different model. We have used the AMPloc AMP25 for testing purposes, and the code we came up with is as shown below:

/* current sensor testing code */
#include 
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

const int analogIn = A0;
int mVperAmp = 37; // ACS712 - use 100 for 20A Module and 66 for 30A Module, AMPLOC - use 37 for 25A and 23 for 50A
int RawValue= 0;
int ACSoffset = 2500; 
double Voltage = 0.0;
double Amps = 0.0;

void setup()
{ 
 Serial.begin(9600);
 lcd.begin(16,2);
}
  
void loop()
{
 RawValue = analogRead(A0);
 Voltage = (RawValue / 1023.0) * 5000; // Gets you mV
 Amps = ((Voltage - ACSoffset) / mVperAmp);

 if ( (Voltage > 2520) || (Voltage < amps=");
     lcd.print(Amps,3);
     delay (2000);
 }
 else 
 {
     lcd.clear();
     lcd.setCursor (3,0);
     Serial.println(" aw="" delay="" input="" lcd.println="" mv=");
     lcd.print(Voltage,3);
     lcd.setCursor (0,1);
     lcd.print(" no="" o="" pre="" serial.print="" t="" value=");
     Serial.println(RawValue);
     Serial.print("mV = ");
Serial.println(Voltage,3);
     Serial.print("Amps = ");
     Serial.println(Amps,3);

     lcd.clear();
     lcd.print("\t mV = ");
     lcd.print(Voltage,3);
     lcd.setCursor (0,1);
     lcd.print("\t Amps = ");
     lcd.print(Amps,3);
     delay (2000);
 }
 else 
 {
     lcd.clear();
     lcd.setCursor (3,0);
     Serial.println("No input!");
     lcd.println("No input!");
     delay (1000);
 }
}

This code allows us to read the current value passing through the sensor and display it on the LCD screen that we attached in the circuit. If the voltage values are less than 2.5V with a low current reading, the LCD will display "No input!". This is done to mitigate the "noise" values.

After verifying that the current sensor circuit is working, we proceeded to try to get a current
reading of 10 Amps. We had some problems using the power supply as were not familiar with it, so we have sought help from Mr.Leong, which he had kindly taught us how to use the power supply. We adjusted the power supply to allow 1 Amps to pass through a wire which we connect in short circuit. An additional clamp meter is also used to verify the output current from the supply.



Figure 2: Short circuit connection with Power supply 

We have decided to use a reading of 10A for testing, however, as we were only able to get an  output current of up to 3A from the power supply. To solve this problem, we loop the wire around the sensor. With each loop, the current sensed is magnified once. With 1A in the wire, we would need to loop the wire 10 times around the sensor to achieve a 10A reading.


Figure 3: Looping of wire through the AMP25


The circuit that we had set up is as shown below. The LCD screen will show value changes

from the current measured with little delay. The Voltage value is also displayed in the top column.



Figure 4: Display of  Current and Voltage value in the LCD
The video below will show the demonstration of our current sensor circuit.
Testing of the Amploc current sensor

Calculations and Tested Values

Analog inputs to the Arduino such as temperature, current, humidity sensors, are relayed in the form of voltage up to 5V, or 5000 mV, should be output by the current sensor, to be transmitted to the input of the Arduino. This will be called the Raw Voltage.
Raw Voltage (Tested) = 587 mV
The Arduino then splits the voltage sensed into 1024 (0 - 1023) different bits, with a total of 5V at 1023 bit. To find the current, the Calculated Voltage needs to be found first, this is done by dividing the Raw Voltage by 1023, before multiplying it by 5000 mV.
Calculated Voltage = [(Raw Voltage / 1023) * 5000]
OR
[Calculated Voltage = [(37 * 10) + 2500 = 2870 mV] (With sensitivity of 37 mV/A)
Calculated Voltage (Tested) = [(587 / 1023) * 5000 = 2869 mV]

By theory, when there is no current sensed (0A), the Raw Voltage should be 2500 mV, which is called the Offset Value. Hence, to find the current sensed in the form of voltage, a value of 2500 is deducted from the Calculated Voltage. 
Actual Voltage = [Calculated Voltage - 2500]
Actual Voltage (Tested) = [2869 - 2500 = 369 mV]
Finally, to find the current sensed, a simple calculation is done by dividing the actual voltage by the sensitivity. A = (mV / mV/A)
[Current = Actual Voltage / Sensitivity] OR [(2870 - 2500) / 37 = 10A]
[Current (Tested) = 369 / 37 = 9.97 A]  
From the above calculations, we have found out that the sensor is relatively accurate, ranging from , being 0.03A away from theoretical value. We have also tested the sensor to display with the range of 9.7A to 10.1A.
We have demonstrated our current sensor to our supervisor, Mr.Kenny, and the sensor is proven to be accurate to an extent. The current sensor we have used for testing is rated at 25A, but we have found out that it can go beyond that of 25A and up to as high as 40+A.
(It may be able to sense an even higher current values but the power supply is at maximum current output and we have reached the maximum number of loops for the sensor due to physical constraint.)

Comments

Popular posts from this blog

Transmission within the car - HC-05 & HC-06 FC114 (Bluetooth module)

Week 13 - Integration test - PLX-DAQ, Chase vehicle simulation, LoRa interface