Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Complete Sensor Guide
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • 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
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Tech Terms
    • Webinars & Digital Events
  • Resources
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • White Papers
  • 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 →

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



Tell Us What You Think!! Cancel reply

Log in to leave a comment:

Lost your password?

Don't have an account? Register here

Submit a Guest Post

submit a guest post

EE TECH TOOLBOX

“ee
Tech Toolbox: Wide Bandgap Semiconductors
Moving from silicon to GaN or SiC feels like a whole new ballgame, doesn’t it? It isn’t just about faster switching; it’s about managing the layout parasitics and thermal realities that come with that speed. This month’s Tech Toolbox features a curated eBook that tackles these design hurdles head-on.

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 feed: EDABOARD.com Discussions. EDABOARD.com Discussions.

  • Convert Open Collector comparator to PushPull?
  • Modbus RTU RS485 Communication Issue: CODESYS (SoftPLC) to LE3U-56MT PLC (Read/Write OK on Modscan32, Failing in CODESYS)
  • How to self reset a CD4017 (Johnson counter) ?
  • Need to buy cheap scope
  • Request ultrasonic cleaner schematic

RSS feed: Electro-Tech-Online.com Discussions Electro-Tech-Online.com Discussions

  • Bearing Temp Monitor
  • Relay terminals
  • PIC code for 2.42" I2C OLED Display?
  • Need to control diesel fuel injector using microcontroller
  • Interfacing the NTC with 5V microcontroller

Featured Tutorials

VHDL Series (1-24)

  • VHDL Tutorial 17: Design a JK flip-flop (with preset and clear) using VHDL
    VHDL Tutorial 17: Design a JK flip-flop (with preset and clear) using VHDL
  • VHDL Tutorial 18: Design a T flip-flop (with enable and an active high reset input) using VHDL
    VHDL Tutorial 18: Design a T flip-flop (with enable and an active high reset input) using VHDL
  • VHDL Tutorial – 19: Designing a 4-bit binary counter using VHDL
    VHDL Tutorial – 19: Designing a 4-bit binary counter using VHDL
  • VHDL Tutorial – 20: Designing 4-bit binary-to-gray & gray-to-binary code converters
    VHDL Tutorial – 20: Designing 4-bit binary-to-gray & gray-to-binary code converters
  • VHDL Tutorial – 21: Designing an 8-bit, full-adder circuit using VHDL
    VHDL Tutorial – 21: Designing an 8-bit, full-adder circuit using VHDL
  • VHDL Tutorial – 22: Designing a 1-bit & an 8-bit comparator by using VHDL
    VHDL Tutorial – 22: Designing a 1-bit & an 8-bit comparator by using VHDL
More Tutorials >

Recent Articles

  • Infineon and Enphase link 900 V GaN for SSTs
  • How Wi-Fi 8 improves reliability without increasing peak speeds
  • Siglent adds phase-coherent RF source for MIMO testing
  • Same Sky adds compact MEMS microphones for portable devices
  • Innodisk launches four-camera GMSL2™ starter kit

EE ENGINEERING TRAINING DAYS

engineering
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • 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 © 2026 Arrowfly 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 Arrowfly
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Complete Sensor Guide
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • 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
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Tech Terms
    • Webinars & Digital Events
  • Resources
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • White Papers
  • Guest Post Guidelines
  • Advertise
  • Subscribe