Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
      • Power Electronics & Programmable Power
  • Women in Engineering

How to measure current using Arduino and ACS712 current sensor

By EG Projects

In this tutorial, I am going to measure DC current using Acs712 Hall Effect-Based Linear Current Sensor and arduino uno. Acs712 can measure current precisely and accurately if properly managed. I have gone through various blogs on internet about interfacing acs712 current sensor with arduino and other microcontrollers. I found that all of them are measuring current with formulas(derived for acs712 current sensor) which are not precise. So i decided to write a tutorial on acs712 current sensor and put forward a practical example with circuit and code. In this tutorial i will define the best method and precise formula generation for measuring dc current with acs712 current sensor. I will define each and every step of code and circuit thoroughly and deeply with logic. Project code is open source and you can download and modify it according to your needs.
Acs712 current sensor can measure both direct and alternating current. For this post/tutorial/project I am going to measure only dc current. Formula which i derived and explained in the tutorial is only for direct current measurement. You can not use the below formula to measure alternating current with acs712 hall effect current sensor. 

About Acs712

ACS712 is a Hall Effect-Based Linear Current Sensor it can measure both DC(Direct Current) and AC(Alternating Current). The sensor chip is made by Allegro www.allegromicro.com. Pin out and Pin description of the chip is below. 

Picture

IP+ & IP-
Connect the sensor in series to the system whose current you want to measure. Cut the circuit wire and connect one end of wire to IP+ and other to IP-. Recall the high school lectures, current can be measured only in series. So don’t connect the sensor in parallel You may damage it by connecting it in parallel.   
VIout
Viout is the voltage out pin. ACS712 outputs an analog signal in correspond to any variation across the IP+ and IP- pins or in other words it outputs analog voltage on VIOUT pin if their is any variation in the current.

Quiescent output voltage (VIOUT(Q)). The output of the device when the primary current is zero. For a uni-polar supply voltage,it nominally remains at VCC ⁄ 2. Thus, VCC = 5 V translates into VIOUT(Q) = 2.5 V. Variation in VIOUT(Q) can be attributed to the resolution of the Acs712. If the Acs712 is working on 5v(Vcc=5v) and their is no current flowing from input the Viout will be 2.5v. 2.5v is the base voltage at input of 5v, now any change in the input current will bring change in the output voltage. Viout decreases when current start flowing through the acs712 pins.

Acs712 is available in market in three ratings.

  • ACS712ELCTR-05B-T
  • ACS712ELCTR-20A-T
  • ACS712ELCTR-30A-T

Picture

  • ACS712ELCTR-05B-T can measure 5 to -5 Ampere current. Where 185mV change in Output voltage from initial state represents 1-Ampere change in Input current. 
  • ACS712ELCTR-20A-T can measure 20 to -20 Ampere current. Where 100mV change in Output voltage from initial state represents 1-Ampere change in Input current. 
  • ACS712ELCTR-30A-T can measure 30 to -30 Ampere current. Where 66mV change in Output voltage from initial state represents 1-Ampere change in Input current. 

​

Acs712 Dc current measurement formula

Current = (AcsOffset – (Arduino measured analog reading)) / Sensitivity

  • AcsOffset is normal voltage output at Viout pin when no current is flowing through the circuit.
  • Arduino measured analog reading is the analog signal value read and converted to actual voltage from the analog channel to which acs712 output is connected.
  • Sensitivity is Acs712 change in current representing 1 Ampere. For all the acs712 versions it is given in the above picture.

Arduino acs712 current sensor

Reassembled acs712 current sensor boards are available in market. They are easy to install in circuit and connections are pretty straight forward. They have three pins. Two are power pins vcc and gnd. The third one is output pin. A 2 pole connector is also present to insert the wire of device whose current is needed to be measured. A typical arduino acs712 current circuit board looks like the one given below.

Picture

Now i am going to interface the arduino acs712 current sensor with arduino uno. I will interface all the different current rated boards one by one with arduino uno.

ACS712ELCTR-05B-T Interfacing with Arduino Uno

Check out the test that i performed with Acs712-05B -5 to +5 Amperes and arduino uno. Measured current is displayed on the 16×2 lcd. It measures current precisely. Test code and results are summarized in an another post link is below.

Measuring Dc current with arduino using acs712 current sensor and 16×2 lcd

ACS712ELCTR-20A-T Interfacing with Arduino Uno

Project Code

 

Download the project code from the links given at the bottom of the Post.

 

ACS712ELCTR-30A-T Interfacing with Arduino Uno

Arduino direct current measurement – Project circuit diagram

Arduino uno interfacing with acs712 current sensor circuit diagram is given below. The circuit is universal and all the above three codes for different versions of acs712 current sensor can work with the same circuit given below. You just need to insert your acs712 current sensor in circuit and download its corresponding code(given in the post) in arduino uno, rest of the connections are same for all the different acs712 rated current sensors.  

Acs712 with Arduino Uno -Circuit Diagram

Acs712 with Arduino Uno -Circuit Diagram
After making circuit and downloading the code in arduino uno. Open the arduino serial monitor from arduino ide. As soon as you open the arduino serial monitor you will see the measured current value displaying in the arduino ide serial monitor window. If you did’t see any thing in arduino serial monitor check for all the connections. Go through all the possible physical connections. If you see broken alphabets in arduino serial monitor window then set the baud rate of arduino serial monitor window to 9600 bps in order to see the proper data characters and numbers.  

Download Codes


Filed Under: Arduino, Electronic Projects
Tagged With: current sensors
 

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • What AI can bring to PCB manufacturing
  • battery types
    What are the different battery types for specific applications?
  • battery configurations
    Battery configurations (series and parallel) and their protections
  • Choosing Batteries for Robots
  • battery cycles
    How rechargeable batteries, charging, and discharging cycles work
  • battery selection low power design
    What are the battery-selection criteria for low-power design?

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • STMicroelectronics offers multi-connectivity development kit for asset tracking
  • Renesas launches new MPUs for advanced industrial Ethernet communication
  • STMicroelectronics releases TouchGFX 4.20 for advanced graphics
  • Infineon’s new HYPERRAM memory chip doubles bandwidth
  • Vishay receives R&D grant for WATT4FRED project

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Extract spice netlist from Prime Time
  • Is this FET tube static safe?
  • Electrical wire sizing
  • I need help building Yocto (poky) for a specific HW/Target > Licheepi Zero Dock (Allwinner V3S)
  • Input Reference Clock for PLL aside from Crystal Oscillator

RSS Electro-Tech-Online.com Discussions

  • Is there a discord for this forum?
  • Bose SoundTouch 20 - IC identification
  • Help identify a part
  • Capacitor to eliminate speaker hum
  • Digital Display Information
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
      • Power Electronics & Programmable Power
  • Women in Engineering