Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey 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
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

How to measure current using Arduino and ACS712 current sensor

By EG Projects September 21, 2023

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

You may also like:


  • What are the top tools for developing embedded software?

  • What is the Modbus protocol and how does it work?

  • What is a Robot Operating System (ROS)?

  • What is FreeRTOS?

  • What is LiDAR and how does it work?
  • Getting Started With Arduino With Simple LED Blinking Code Circuit Setup On Breadboard
    Getting started with Arduino – (Part 1/49)

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

Next Article

← Previous Article
Next Article →

Comments

  1. [email protected] says

    May 4, 2023 at 7:38 am

    Would it be practical/possible to use something like:
    https://www.digikey.com/en/products/detail/seeed-technology-co.,-ltd/101990065/5487441
    to sense the current without having to tap into the circuit? This also would seem to decrease the chance of some electrical anomaly damaging your Arduino?

    Log in to Reply
    • Bijal Parikh says

      July 23, 2024 at 3:27 am

      Hi, Thanks for visiting engineersgarage.com. If you have any technical questions or need more information please visit our forums https://www.edaboard.com/ or https://www.electro-tech-online.com/. You can read more articles on http://www.engineersgarage.com
      Have a great day

      Log in to Reply

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



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

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!


RSS EDABOARD.com Discussions

  • How to start a startup in VLSI
  • UART Basic Before Writing Code
  • Single ended measuring ports and balanced antenna
  • Thermal modelling of repetitive power pulse
  • PFAS-Free Die Attach Paste

RSS Electro-Tech-Online.com Discussions

  • Fun with AI and swordfish basic
  • Simple LED Analog Clock Idea
  • Microinverters and storeage batteries?
  • PIC KIT 3 not able to program dsPIC
  • Is AI making embedded software developers more productive?

Featured – LoRa/LoRaWan Series

  • What is the LoRaWAN network and how does it work?
  • Understanding LoRa architecture: nodes, gateways, and servers
  • Revolutionizing RF: LoRa applications and advantages
  • How to build a LoRa gateway using Raspberry Pi
  • How LoRa enables long-range communication
  • How communication works between two LoRa end-node devices

Recent Articles

  • How to design a weather station using ESP8266
  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 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

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey 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
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe