The Utilizing Hall Effect-Based Current Sensor ACS712 for TRUE RMS Current Measurement in Power Electronic Systems

Current measurement in power electronic systems is a necessary part of the measurement process. There are different ways for current measurement like using current transformers or using the Rogowski coils which are not precise enough in many applications and not suitable for use in power electronic measurement systems. For that reason, the Hall effect-based sensor can be used as a very precise alternative with minimum external components. Presented in this paper is utilizing the Hall effect current sensor ACS712 for current measurement with a microcontroller system. The measurement with the Hall effect sensor is described with an appropriate comparison of the measurement values on a microcontroller system and multimeter and high precision power analyzer Chauvin Arnoux 8335.


Introduction
ALL effect current sensors are a very important type of devices in electrical measurement in general. The working principle of current sensors is based on the conversion of a physical quantity into an electrical one. Current transformers, magnetoresistance, and Hall effect sensors are the most common current sensors [1]. Magnetic devices, which assist in the measurement of current, are current transformers. The operating frequency of current transformers in electrical circuits is typically 50 to 60 Hz but they can work also from 25Hz to 400Hz. For high precision measurement transformation accuracy is 0.1% or better. With current transformers it is possible to measure the current levels from less than an amp to thousands of amperes or more. For general indication or overload, detection accuracy is several percent. [2].
Linear magnetic field transducers based either on the intrinsic magnetoresistance of the ferromagnetic material (sensors based on the spontaneous resistance anisotropy in 3d ferromagnetic alloys are also called anisotropic magnetoresistance (AMR) sensors) are magnetoresistive (MR) sensors. Another name for magnetoresistive sensors is ferromagnetic/non-magnetic heterostructures. This includes giant magnetoresistance multilayers, spin valves, and tunneling magnetoresistance devices [3].
The phenomenon of charge flow deflection in the metal plate that is placed in the magnetic field is known as the Hall effect. The current flow causes the voltage difference between the plate side called Hall potential. The sensor which is designed by using the Hall effect principle to detect the magnetic object is a Hall effect sensor. Eq. 1 shows that the magnetic field B which is placed perpendicular to the metal plate (conductor or semiconductor) will give deflection force F (Lorentz force): where the force is found to be the right side. The Lorentz force of the charge is given by the following equation 2: Lorentz force causes the charge deflection in the vertical direction with charge velocity direction and magnetic field direction. Because of that, on the plate side which is parallel to the current direction, a different voltage will occur. All the Hall effect devices are activated by a magnetic field. In the current sensor application which includes Hall effect sensors, a magnetic field is generated by electric current and it represents the Hall effect [4]. The phenomena of the Hall effect in the metal plate due to the presence of the magnetic field are shown in Fig.1.  [4] H For measuring the potential difference -voltage, between two sides of the plate, a voltmeter can be used. The Hall voltage can be presented as V H given by the formula 3: Where: -I is the flowing current; -B is the magnetic induction; q is the charge; n present the number of charge carriers per unit volume; d is the sensor's thickness; Thus, the effect that is seen is the Hall Effect. So, if the magnetic field is stronger, more electrons will be accumulated. That means if the current is higher, more electrons can be deflected. With the increase in the number of electrons that can be deflected, the potential difference between the two sides of the plate will be greater. Based on this it follows that the Hall voltage is in direct proportion to the electric current and the applied magnetic field [5].
The introduction of the paper has presented an explanation and basic working principle of the Hall effect sensor. Further, the text will present the application of the Hall effect-based sensor ACS712 in a microcontroller system with experimental results in laboratory and current measurement using Chauvin Arnoux power analyzer 8335.

Hall-effect current sensor ACS712
Hall effect sensor ACS712 manufactured by Allegro consists of a precise, low-offset, linear Hall sensor circuit with a copper conduction path which is located near the surface of the chip. The magnetic field which is generated by flowing current through this copper conduction path is sensed by the integrated Hall IC and also converted into a proportional voltage. The accuracy of the device is optimized through the proximity of the magnetic signal to the Hall transducer. The internal resistance of this copper conductor is a typical 1.2 mΩ. The sensor is packed in a small, surface mount SOIC8 package. The output rise time in response to step input current is 5 μs. ACS712 typical application circuit is shown in Fig.2. [6].  [6] This sensor can be used for measuring direct current (DC) and alternate current (AC). It has a low noise level and low error which is 1,5% to TA = 25°C, and 4% to -40°C until 85°C [7].
This research used a version of the ACS712 current sensor which can measure 30A current. This type of sensor has a sensitivity of 66mV/A. Mean Total Output Error as a function of the Ambient Temperature and Output Voltage as a function of the Sensed Current are shown in Figures 3 and 4, respectively [8].

True RMS current measurement
Measuring the RMS or Root Mean Square values of the signal is one of the fundamental measurements of the magnitude of AC signal values. RMS voltage or current measurement is done by utilizing RMS converters. In an ideal case, the RMS converter could measure the RMS value of the input signal independently of the signal amplitude, frequency, or wave shape. For AC to DC and DC to AC conversion the power electronic switching devices are most often used. With the true RMS measurement of electrical system parameters, it is possible to read the true magnitude of current and voltage. This method of measurement is very helpful for precise loss estimation. Measuring instruments for measurement of AC electrical values can be classified as rectifying and average type, analog-computing type, thermal type, and computational type, which are based on a sampling technique. The Rectifyand-average measurement gives an increasing error as the input departs from sinusoidal and it is enough precisely for sine-wave signals only. Bandwidth limitations are typical for the analog computing type of measurement. The thermal type of the measuring provides high precision, high bandwidth rate, and high design complexity with cost constraints. The most widely used digital sampling technique-based measurement is digitizing using an AD converter. Calculation of the RMS value of the signal is done by using a DSP processor or microcontroller. Depending on the A/D Converter precision and sampling rate it will depend on achievable accuracy for any given bandwidth.
Normally, DSP processors and a high-speed A/D Converter with high precision are used for True RMS measurement which is done by using the digital sampling technique. Because of using a unipolar A/D Converter and the bipolar input signal, it is necessary to shift the reference level of the bipolar input for DC offset which is equal (Vref/2).
This voltage shifting provides that the bipolar input signal changes its value about the reference level which is Vref/2 instead of ground level. This configuration provides that the peak-to-peak value of the input signal is confined in the ground to the Vref value. The DC offset is subtracted from the input signal after digitization. For this method an accurate DC level shifter circuit is necessary. A small variation in the DC offset gives an error in the measurement. With this technique, it is possible to reduce the effective precision of the A/D Converter. The peak-to-peak variation of the input signal is from Ground to Vcc [9]. The true RMS current calculation in the recommended method is based on equation 3: RMS measurement is not reliable, because in electrical circuits there is a noise in the sine wave signal (caused by various motors, switches, devices, cheap power supplies, etc.), and thus there is a distortion of the sine wave signal, and ultimately leads to large measurement errors.
True RMS current measurement is a very useful method for current measuring in systems that are non-sinusoidal shapes of signals, typical in power electronic systems in which we have thyristor and triac regulation or similar types of components and circuitry. True RMS measurement is necessary for motor drives with variable speed, electronic ballasts, personal computers, HVAC, and solid-state devices [9].

Practical implementation of ACS712 with microcontroller system
A current sensor that is used for this experiment is a module type on a printed circuit board with two filter capacitors and it is supplied by a 5V power supply from buck regulator MP2315 [10] which is integrated with a microcontroller in the case. In this module two wires for easier connection of different types of electrical loads are soldered. ACS712's current sensor module is shown in Fig.5. The microcontroller system which is used for this research is based on Microchip 8-Bit AVR microcontroller ATMega328P [11] and it is programmed in the MPLAB IDE development environment. The hardware part of the system is designed in Altium Designer. Fig.6 shows a microcontroller system. This device also has an RS232 and CAN Bus interface so it can be connected to a PC or other device which can be done by archiving the data from the sensor.
Microcontroller ATMega328P has a 10-Bit ADC and, for this purpose, it is used for measuring voltage from the current sensor. The sensitivity of the sensor is 66mV/A and it has a linear characteristic. In this case, it is used for measuring AC. Measuring voltage on the sensor must firstly be presented as a digital value by formula 5: Where: -Vsens is the voltage on the output of the current sensor; -Vbin is a binary representation of a voltage on the sensor output -Voffset is a value of the voltage on the sensor output and the input current is 0A. In this case, that voltage is 2.5V. Because the sensitivity of 66mV/A current on the sensor can be calculated as presented by formula 6 : The true RMS value of the current is calculated as shown in formula 7, which is also implemented in a program for the microcontroller. True RMS calculating is implemented in 200 steps.
The mean measurement error is 17.44% and it is calculated by the mean value of error. This value of current measurement with the non-calibrated sensor is useless and calibration was done by multiplying results with a calibration constant of 0.8256 which is calculated from errors. In the next section, the complete measurement is improved so the maximum error is 3.43%, which is enough precision for this type of measurement. Fig.6. presents the connection between sensor ACS712 and the microcontroller. Table 1. presents the results of measurements with non-calibrated sensor ACS712 with the error between measurement of microcontroller system and high precision analyzer Chauvin Arnoux C.A 8335 for checking electrical values of the power network.

Experimental setup
The laboratory work includes using equipment for measuring electrical values and, in this case, it is AC. Connecting of all circuit devices is implemented on the insulation table in compliance with all the security high voltage measurements. Connecting of the devices is done following a connection block diagram. The Block diagram for connecting the measurement system is shown in Fig.7. Measuring is done in 4 steps.
The first step is connecting a load of 2000W to the sensor which is a hot air fan with thyristor regulation. It provides a voltage and current shape which is nonsinusoidal and it consists of the compound and mixed AC signal defined by on and off time of Triac phase regulation.
The second step implies connecting the fluorescent lamp to the sensor with the power of 22W which has integrated inductance so this load also provides a nonsinusoidal shape of current.
The third step includes connecting the heater with a power of 2000W with a low-power AC electromotor fan without temperature thyristor regulation. It contains only the thermal element.
And the final fourth step in the measurement is connecting the computer as a load with its Switch Mode Power Supply (SMPS) charger. The output power of the charger is 80W. To compare the results of the microcontroller measurement system in this work a high precision power and quality analyzer Chavoun Arnoux C.A 8335 is used, which is shown in Fig.8. with a current clamp and UNI-T multimeter. The results of measurement from the microcontroller system are given by using the RS232 serial interface which allows reading current values directly on a computer. Also, the values of the current measurements are presented on the display of the power analyzer so they are available enough for reading and comparing with the values from the microcontroller system as a current clamp. Fig.9. shows a connected instrumentation for this experiment with the ACS712 sensor which is connected using a block diagram.

Experimental results
All results in the process of measurement are given in the tables. There are 4 measurements. The first measurement covers a measurement of current consumption in a hot air fan dryer with a power of 2000W which is controlled by the triac and in this case, the distortion of voltage and current is most visible. With a microcontroller system as a high precision part of the equipment for this experiment the power analyzer Chavouin Arnoux C.A. 8335 and Chavouin Arnoux harmonic and power meter F27 current clamp are used. The results of the measurement are presented in Table 2. and Table 3. The third measurement was performed by using a heater with a power of 2000W as a load, FIRST FA-5568-2, without regulation so in this case, we have a resistive load if we disregard that we have small parasitic resistance and inductance in the circuit. The results of the measurement are given in Table 4. And the fourth measurement is done by using a power supply Fujitsu and a laptop of 80W. The measurement results are shown in Table 5.

Conclusion
This paper presents utilizing the Hall effect sensor ACS712 for the precise current measurement in power electronic systems. Also, this paper has presented the calibration of the sensor by using high precision power analyzer with measurement of the current through the sensor by using different electrical loads. Finally, the measurement error is presented, which is small enough for measurements in the field of power electronics, especially in motor control systems, and frequency regulators.