Fads to Obsessions and Beyond...




Free domain for life, exceptional technical support, website transfer

ACS-712 Current Sensor

An Allegro ACS712 Hall Effect-based linear current sensor is interfaced with a PIC18F248 microcontroller to test measuring bi-directional current flow. The ACS712 is produced as a SOIC package, so a breakout board version (sourced from eBay chinese supplier) was used rather than the actual IC in isolation.

Further, the eBay breakout board version (with breadboard ready headers, LED power indicator and free shipping) costs approximately one-third the cost of just the ACS712 chip from a "western" source (Mouser, Digikey, RS Components etc). But, you "get what you pay for" and the observed sensitivity of the breakout board version was only 135mV/A compared to the datasheet of 185mV/A ± 5mV/A.


Many projects require the measurement (or perhaps more generally the "sensing") of current for either circuit control (e.g., battery charging, power supply, i.e., making decisions based upon measured current) or circuit protection (e.g., fault condition has occurred and power needs to be shunted/isolated). Measurement of current can be categorised as either by direct methods or indirect methods (1).

Direct methods include current sensing resistors and inductor DC resistance. The use of a "sense resistor" for current measurement is well known having the advantages of simplicity and linearity. Using inductor DC resistance is disadvantaged due to high temperature coefficient of resistivity of the component material and generally not used.

Indirect methods rely upon magnetic induction using current transformers, Rogowski Coils or Hall-Effect Devices. A major advantage of indirect methods is the isolation of the measurement components from the line voltage. Current transformers (Rogowski Coils are air-core designs rather than having a high permeability core such as laminated steel) require an AC or switched DC current in order to produce a current measurement. This is obviously a limitation in a "straight" DC circuit application (and current transformers are relatively expensive in the DIY setting).

Another indirect method relies upon the Hall Effect, the production of a voltage difference across an electrical conductor, transverse to an electric current in the conductor and a magnetic field perpendicular to the current (2). The advantage of Hall effect devices is that they are capable of measuring large currents with low power dissipation. However, the literature reports there are numerous drawbacks that can limit their use, including non-linear temperature drift requiring compensation, limited bandwidth, low range current detection requires a large offset voltage that can lead to error, susceptibility to external magnetic fields, and high cost.

The Allegro ACS712 Hall Effect-based linear current sensor appears to have overcome such disadvantages being available in a SOIC package for a few dollars even in single quantities. The eBay breakout board version (with breadboard ready headers, LED power indicator and free shipping) at $2/item costs approximately one-third the cost of just the ACS712 chip from a "western" source (Mouser, Digikey, RS Components etc). This makes the ACS712 competitive in the DIY situation with a precision shunt resistor, but providing the advantage of isolation from the measured current and the following benefits (as listed in the datasheet):

    • 66 to 185 mV/A output sensitivity
    • 5.0 V, single supply operation
    • 2.1 kVRMS minimum isolation voltage
    • Ratiometric output from supply voltage
    • 5 μs output rise time in response to step input current; 80 kHz bandwidth
    • Output voltage proportional to AC or DC currents
    • Low-noise analog signal path; Factory-trimmed for accuracy

The ACS712 is produced in a number of versions (x5A, x20A, x30A) which are optimised for accuracy for a set current range (i.e., 5A, 20A and 30A). The breakout board used for the evaulation was a "x05B" version for an optimised accuracy range of -5A to +5A with a sensitivity of 180-190 mV/A.

The Circuit Details and Schematic Diagrams Sections provide information about physical connection of the ACS712 to a circuit to enable current measurement either manually using a DMM (this is more just to test the actual IC and breakout board) and with a PIC18F248 microcontroller.

The Testing/Experimental Results Section discusses the various steps used in testing the ACS712 and examining the utility of the component compared to just using a shunt resistor.


The circuit consists largely of the usual minimum requirements for a PIC (PIC18F248 dealt with here) that is, power supply, oscillator (external crystal oscillator - 40MHz) and in-circuit serial programming (ICSP). A voltage reference is formed by the TL431 programmable shunt regulator diode.

The majority of the circuit is based upon the DIY PIC Development Board.

Circuit Operation

A "wall wart" power supply was chosen rather than constructing a dedicated DC power supply dropping/converting from an AC wall socket. Surplus chargers from laptops are readily available (in this case supplying 16-24V with 65W max) which provide not only a safer option (compared to construction from a suitable transformer, rectifier, connection to AC etc) but also a much more economical option (generally zero cost for a surplus charger, compared to ten's of dollars for a suitable transformer, let alone cost of ancillary circuitry, PCB etc).

The surplus laptop charger requires a suitable socket connection and a voltage regulator, in this case a LM317T, to provide the regulated 5V generally required by PIC microcontrollers. The power supply circuit is given in the Schematics Section. The LM317T circuit is the standard design direct from the datasheet, with input and output capacitors to provide smoothing and the resistor/potentiometer to provide selection of output voltage.

The ACS712 produces a voltage (nominally 185mV/A ± 5mV/A) which is read using the onboard ADC (10-bit) provided by the PIC18F248. The voltage produced by the ACS712 is centered on Vcc/2 to enable bi-directional current sensing i.e., "zero" current flow is indicated by a voltage of 2.5V with 5V supply to the ACS712. The ACS712 (x05B version) has a nominal measurement range of ± 5A which means a nominal voltage output (Vout on pin 7) of 1.575V to 3.425V. A TL431 programmable shunt regulator diode is used to provide a 5V reference for the PIC ADC module.

A MAX232 is used to enable RS-232 communication between the PIC microcontroller and an attached PC, in order to display the measured voltage (and hence desired circuit current) from the ACS712.


Software/Firmware

The firmware enables connection of the PIC18F248 with a PIC via RS-232 and periodic reading of the voltage on the ACS712 Pin 7 via the onboard ADC. The firmware is the same as described and detailed in the PIC analog to digital converter (ADC) page.


Note: Image loading can be slow depending on server load.

  • ACS712 SchematicACS712 Schematic

    Silver Membership registration gives access to full resolution schematic diagrams.

    ACS712 Schematic

This project did not require a PCB.

The construction was done using prototyping board. See the photographs and schematic diagram sections.

Qty Schematic Part-Reference Value Notes
Resistors
3R1-R310K1/4W, 10% 
1R41501/4W, 10% 
Capacitors
2C1,C222pFCeramic 
1C30.33uF 
1C40.1uF 
5C6-C101uF 
Diodes
1D11N-4001 
Integrated Circuits
1U1PIC18F248PIC microcontroller  datasheet
1U27805Linear Voltage Regulator  datasheet
1U3MAX232ERS232 Driver/Receiver datasheet
1U4TL431Programmable Voltage Reg. Diode datasheet
1U5ACS712Current Sensor (05B version) datasheet
Miscellaeous
1J1CONN-H55-pin connector for ICSP
1SW1SW-SPDT 
1X110MHzCrystal Oscillator
Description Downloads
ACS712 - Bill of Materials Text File Download

Testing of the ACS712 breakout board consisted of a number of stages. Initially, dummy loads where connected to produce currents of known magnitude with the output of the ACS712 Vout pin monitored with a digital multimeter. I have a DIY electronic dummy load which made applying known currents easy. If this is not available, simply use a suitable load resistor (and varying the applied voltage and or resistor value to develop the desired current value).

The ACS712 produces a voltage proportional to measured current which is nominally 185mV/A ± 5mV/A. The voltage produced by the ACS712 is centered on Vcc/2 to enable bi-directional current sensing i.e., "zero" current flow is indicated by a voltage of 2.5V with 5V supply to the ACS712. The ACS712 (x05B version) has a nominal measurement range of ± 5A which means a nominal voltage output (Vout on pin 7) of 1.575V to 3.425V.

However, it was found with the eBay breakout board version that observed voltage output from the ACS712 was only 135mV/A. The output voltage in reference to input current was measured on two discrete items of the ACS712 breakout boards that were purchased, in order to check if the low sensitivity was isolated to a particular board. However, the same results showing significantly decreased sensitivity compared to that stipulated in the datasheet were found. Hence, a potential reason why the breakout board versions (which include breadboard ready headers, LED power indicator and free shipping) cost approximately one-third the cost of just the ACS712 chip from a "western" source (Mouser, Digikey, RS Components etc). No doubt you "get what you pay for".

The effect of varying the supply voltage of the ACS712 (Vcc) was examined, since the "zero" current point is centered at Vcc/2 to enable bi-directional current sensing. Hence, drift and or variation in ACS712 Vcc will produce a measurement error. The ratiometric output from the supply voltage resulted in an observed 135mV/A at various levels of Vcc (ACS712 has an absolute maximum Vcc of 8V with recommended 4.5 - 5.5V). However, as expected, the output "zero" current point was highly dependent on supply voltage Vcc (although if Vcc did not vary the "zero" current point was also stable).

Despite the negative results obtained by measuring ACS712 output with a multimeter (i.e. the low sensitivity of the breakout board compared to the datasheet), the ACS712 was still interfaced to the PIC18F248 ADC to check the results. The multimeter used has limited resolution and perhaps was not capable of adequately monitoring the expected relatively small voltage changes.

The same results were observed using the PIC18F248 ADC to measure ACS712 output versus applied current (i.e., only 135mV/A compared to the datasheet value of 185mV/A ± 5mV/A.

Conclusion

The ACS712 is potentially advantageous for current measurements as the component has a 2.1 kVRMS minimum isolation voltage with a simple direct output voltage proportional to bi-directional current flow/magnitude.

However, the limited sensitivity (185mV/A ± 5mV/A) restricts the potential usefulness compared to other similar IC's (see MAX471 current sensor). Particularly, in the case of the ebay breakout board version which in the case of the items tested did not meet the datasheet specification i.e., possibly production rejects which explains the cheap pricing (there is a photograph of the ACS721 IC on the breakout board in the Photographs Section). Additional hardware/circuitry could be used to scale the output voltage range of the ACS712 to better utilise the measurement range of the PIC18F248 ADC, however, this negates the potential low cost/simple use advantages of the ACS712.

As an update note, the Allegro ACS723 05AB (SOIC 8-pin package $4.50/each from RS-Online at time of writing) is now available. This current sensor has the same advantages of the ACS721 (isolation etc) but a sensitivity of 400mV/A (for the 05AB version, ± 5A).


As a general precauation double check polarity of power connections etc before powering up the IC. The ACS721 has a power supply requirement of DC 4.5-5.5V (absolute max 8V).

Since the "zero" current point is centered at Vcc/2 to enable bi-directional current sensing, drift and or variation in the ACS712 Vcc will produce a measurement error. It is essential to have a stable supply voltage to the ACS721.


No video's loaded for this project.

Comments/Questions

No comments yet.

Add Comment/Question

Only Logged-In Members can add comments

"If we could sell our experiences for what they cost us, we'd all be millionaires".

Please donate any amount to help with hosting this web site.

If you subscribe (only $2/annum) you can view the site without advertisements and get emails abouts updates etc.

X

Sorry!

Only logged-in users with correct Membership Level can download.


Membership starts at only $2, so join now!