Arduino ACS712 Current Sensor Tutorial Using Visual Programming

by RonFrtek in Circuits > Arduino

121 Views, 1 Favorites, 0 Comments

Arduino ACS712 Current Sensor Tutorial Using Visual Programming

Arduino ACS712 Current Sensor Using Visual Programming

In this tutorial, we'll explore how to use the ACS712 Current Sensor with Visuino and Arduino to measure both AC and DC currents and display the readings in Amps on an OLED screen. The ACS712 is a Hall-effect-based sensor that provides accurate current measurements, making it ideal for various applications such as motor control and power monitoring.

Watch the video!

What You Will Need

41d2a5e783c8434cbc1aceadc3680520_grobo.jpg
arduino.jpg
oled.jpg
F5OFEUQJJ4ZYFKY.LARGE.jpg
breadboard.png
bulb.jpg
power-supply.png
  1. ACS712 sensor
  2. Arduino board (or any other board)
  3. Power Supply
  4. OLED Display
  5. Breadboard
  6. Some load like a light bulb or DC motor
  7. Jumper wires
  8. Visuino program: Download Visuino


Understanding the ACS712 Sensor

The ACS712 sensor comes in three variants, each designed for different current ranges:

  1. ACS712-05B: ±5A with a sensitivity of 185 mV/A
  2. ACS712-20A: ±20A with a sensitivity of 100 mV/A
  3. ACS712-30A: ±30A with a sensitivity of 66 mV/A

Choose the appropriate sensor based on the expected current in your application.

The Circuit

2025-03-04_13-18-45.png
  1. Connect OLED Display pin [SCL] to Arduino pin [SCL]
  2. Connect OLED Display pin [SDA] to Arduino pin [SDA]
  3. Connect OLED Display pin [VCC] to Arduino pin [5v]
  4. Connect OLED Display pin [GND] to Arduino pin [GND]


  1. Connect ACS712 pin [VCC] to the [5V] pin on the Arduino.
  2. Connect ACS712 pin [GND] to the [GND] pin on the Arduino.
  3. Connect ACS712 pin [Out] to the [A0] analog input pin on the Arduino.

Start Visuino, and Select the Arduino Board Type

select-board-uno.jpg
Visuino-Select-Board-UNO.jpg

Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2

In Visuino Add, Set & Connect Components

2025-03-04_15-58-23.png
2025-03-04_15-59-08.png
2025-03-04_15-59-52.png
2025-03-04_14-25-58.png
2025-03-04_16-01-09.png
2025-03-04_16-09-20.png
2025-03-04_16-01-40.png
2025-03-04_16-08-00.png
2025-03-04_16-08-31.png
2025-03-04_14-03-03.png
acs-oled.png
  1. Add "ACS712 Current Meter" component
  2. Add "OLED I2C" component
  3. Add "Start" component
  4. Add "Average Analog Period" component


  1. Double click on the "DisplayOLED1" component and in the Elements window drag "Text Field" to the left side and in the properties window set "Size" to 3
  2. Close the Elements window


  1. Select "CurrentMeter1" and in the properties window set the type of your sensor by selecting "Range (A)" in this example we are using 20 (ACS712-20A)
  2. Double click on the "CurrentMeter1" and in the Operations window drag "Calibrate Period" to the left side and in the properties window set "Period (uS)" to 3000000, This means that on the start the sensor will calibrate it self for 3s
  3. Close the Operations window


  1. Connect Arduino Analog 0 pin [Out] to "CurrentMeter1" pin [In]
  2. Connect "Start1" pin [Out] to "CurrentMeter1" > "Calibrate Period1" pin [Start]
  3. Connect "CurrentMeter1" pin [Out] to "AveragePeriod1" pin [In]
  4. Connect "AveragePeriod1" pin [Out] to "DisplayOLED1" > "Text Field1" pin [In]
  5. Connect "DisplayOLED1" pin [I2C] to Arduino pin [I2C]



Generate, Compile, and Upload the Arduino Code

Visuino-Compile-UNO.jpg

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Play

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable, you can download it and open it in Visuino: https://www.visuino.com

Downloads