Arduino UNO R3 Compatible using CH340T
 

  10.00JD                   Add to cart

Current Sensor Module 5 A 

   10.00 JD                 Add to cart

Current Sensor ACS712

 Sensing current flow in certain path of your circuit is a requirment for many application such as power mesurment and monitoring, over current protection, battery charging level and more.

the simplest way to mesure a current in certain load is to place a small resistor paralle to the load, most case between the load and ground, and depending on the voltage across this resistor we could tell the flowing current.

ACS712 chip providesprecise way of sensing AC and DC currents based on Hall-effect. The pin diagram of ACS712 device and its typical application circuit is shown below. ACS712 provides low power loss and eliminates the risk of damaging the current monitoring circuit due to the high voltage on the conduction side. The electrical isolation between the conduction current and the sensor circuit also minimizes the safety concerns while dealing with high voltage systems.                          

The ACS712 device comes in three ranges, the range of±5A (ACS712-05B), ±20A (ACS712-20B), and ±30A (ACS712-30A). The ACS712-05B can measure current up to ±5A (means two ways       current flow mesuring) and has output sensitivity of 185mV/A (at +5V power supply), this means for every 1A increase in the current through the sensor , the sensor output voltage rises by 185 mV.The plot below shows Voltage vs Input Current characteristics of the ACS712-05B sensor powered with a 5.0V. Note that when there no current thrugh the sensor, the output is Vcc/2 = 2.5V.

 

Connection

For your current sensor, if you got reversed polarity readings, reverse the load connction or change the code belwo frome 

current = (AnalogValue - 512) *264; 
to
current = (512 - AnalogValue) *264;


 

Code

This code is for 5A range, consider the calculations for other ranges.

In the digital scale , with 10 bits ADC resoulution and 5 Volts refrence the calculation described in the code are based on the following info:

  •  5 volts are converted by the ADC module to 1023 count.
  •  To transfer the sensor analog resolution to digital one we use this simple calculation:

       (0.185V / 5 V) x 1023 =  37.888, this mean w have 1 Amps every 37.888 digital count from the ADC output.

  • so we need to take the ADC output every time and divide it by 37.88 which is the same if we multiplied by 0.0264 (The result of 1/37.88)
  • For more accurate readings we took a sample of 100 reading every time.

 

//elektrojo.com
 
int AnalogValue=0;
float current =0.00;
 void setup()
 {
  Serial.begin(9600);
  pinMode (A0,INPUT); 

 void loop()
{
   AnalogValue=0;  
  for(int i=0;i<100;i++)
{
   AnalogValue=AnalogValue + analogRead(A0); 
  delay(10);
  }   
AnalogValue = AnalogValue/100;   
current = (AnalogValue-512) *264;
current =current / 10 ;
   Serial.print("Current= ");
   Serial.print(current);
  Serial.println(" A ");
}