ACS712 – The current sensor module

ACS712 chip

The ACS712 module is an economical solution for measuring current in your DIY circuits. As a maker, you may need to keep track of the current of a circuit. In that case you will like this component. The sensor will detect the amount of current and deliver a voltage output proportional to the captured current. Moreover, as it is already integrated in a module, it makes the connection much easier, with connection plugs and everything you need to use it without adding too many extra components.

The applications of this device are many as you can see, even if you have different intensities in the circuit, as you can select the different versions of ACS712 that exist. For example, the ACS712-05A, ACS712-20A, ACS712-30A, etc., for current ranges of 5A, 20A and 30A, respectively.

Hall Effect

Hall effect
Wikipedia

The ACS712 works thanks to the Hall effect. It can measure magnetic fields and currents, as is the case here. When a current flows through the Hall sensor, and approaches a magnetic field that flows in a vertical direction to the sensor, it will then create an outgoing voltage proportional to the product of the magnetic field strength and the current. Therefore, knowing the magnetic field you can measure the current value in the conductor or coil.

The applications of the Hall effect are many, from metal detectors, current measurements, magnetic field measurements, as a non-contact signal transmitter, metal thickness measurement, etc.

Characteristics of the ACS712

acs712 Module

 

The ACS712 module is very simple, based on the Hall effect, and has a very simple pinout. On one side you see three pins and on the other side a connection plug with for two lines from which you want to measure the current of the circuit. The three pins is where the power supply is connected. As shown in the picture above, from left to right, you have Vcc, the output in the middle where it is measured, and the GND more to the right.

Depending on the model you can measure one or other current in amps, with three versions of ACS712 basic:

  • ACS712ELCTR-05B-T: that reaches -5 and 5A of maximum tolerated intensity. With a sensitivity of 185mV/A.
  • ACS712ELCTR-20A-T: in this case it goes from -20 to 20A, with a sensitivity of 100mV/A.
  • ACS712ELCTR-30A-T: is increased to a range of -30 to 30A, with a sensitivity of 66mV/A.

Once you know that, you must take into account that the output gives you a voltage or voltage of 2.5v if the applied current is 0A. From then on, depending on whether it is negative or positive, it will go up or down from that voltage. A straight line can be drawn in a graph putting in ordinate and abscissa axis the voltage and the current, being the slope inclination the sensitivity of each one of these modules.

Therefore, if we know that it is 2.5 volts, you can apply the formula V =SI + 2.5. Where S is the slope that equals the sensitivity. Clearing this to have it as a function of the intensity, we can say that I = V-2.5/Sensitivity. That is, the voltage minus 2.5 and divided by the sensitivity. This you have to take into account and then calibrate the Arduino microcontroller when you program it.

Pinout, datasheet and where to buy

For your connection with Arduino, is super simple due to the pinout, just connect the GND pin of your Arduino UNO board with the GND of the ACS712 module, the 5v pin of Arduino with the Vcc of the module, and the central (output) with one of the Arduino inputs, for example, the A0. And that would be the complete circuit, unless you connect the circuit that provides the current you want to measure on the green tab.

Remember that you can get it from different brands, and I advise you to see their datasheet to learn more about the particular characteristics that particular ACS712 module may have, although they are usually quite similar in all manufacturers. If you want to see an example, here is a href=”https://www.sparkfun.com/datasheets/BreakoutBoards/0712.pdf” target=”_blank” rel=”noopener noreferrer”>datasheet by Allegro.

Say also that you can buy it in any specialized store, or in many big online sellers like Amazon, with prices from 2 to 11 euros depending on the model, for example:

An example of application with Arduino

test probes

The simplest and most recommended example to start using this element is to connect the ACS712 to your Arduino board and then generate a simple code for Arduino IDE to make current measurements. Install some test probes from a non-working polymer or , and you will have an easy ammeter to touch the probes to a circuit and determine what current it is working at. If you do not want to buy or have probes, you can use two wires protected with a good insulator and that resist the intensity you intend to measure.

Take the appropriate precautions, if you work with high intensities use insulating elements or you can suffer serious damage if you suffer an electric shock. Always work with caution… Look at the characteristics of your module and do not exceed the current values for which it is prepared or it will be damaged. Do not exceed the maximum current at which the probes or cables you have chosen can work.

The code for your Arduino IDE sketch is that simple:


//Example of code to measure intensities for an ACS712 of 5A
float Sensitivity=0.185; //Sensitivity in Volts/Amp for sensor 5A to 185mV/A

void setup() {
  
  Serial.begin(9600);
}

void loop() {
  
  float voltageSensor= analogRead(A0)*(5.0 / 1023.0); //For sensor reading
  float I=(voltageSensor-2.5)/Sensitivity; //Formula to obtain the current or intensity measured with the tips connected to the ACS712 module
  Serial.print("The intensity in Amps is: ");
  Serial.println(I,3);
  delay(200);
}

Considerations

You can also modify the formulas so that the measurement data is in submultiples of amps, such as mA, if that is more suitable for your project’s utility. You can also modify the delay to make the measurements more consecutive or longer, as you need to control it. You can even apply filters within the code for the measurements, calibrate it, etc.

More things to consider is that if you can know the voltage and the current, you could generate formulas in the sketch code to calculate other parameters, like the resistance with Ohm’s law, you could also determine the power in watts (w) knowing these parameters, etc. You know that the limit is your imagination… well, and the limitations of the technology you use.

You know that if you want to learn more about how to program Arduino, you have a free introductory PDF manual to download here.

Leave a Comment

*

*