Simulator

A current sensor simulator: an ACS712 measuring a motor

Mokxi is a free online ACS712 current sensor simulator that runs in your browser, with nothing to install and no account needed. An ACS712 5 A board in the lead of a 6 V gear motor, its output on A0 of an Arduino Uno and the current on an LCD. Hold the button and the motor starts: the reading jumps to an amp for an instant, then settles at 150 mA.

  • 505parts on the bench
  • 45boards running now
  • 1.00xreal time, on every board
Arduino Uno: an ACS712 on a motor’s supplylive0.000 s 0.00x
Hold the button
Click the circuit to open it in the editor, then hold the push button to run the motor. The serial monitor prints the current and the peak it caught.

What you can do here

In the circuit above, or in the editor it opens.

  • Measure a motor’s current without the motor’s supply touching the Arduino
  • Catch the start-up surge of a motor, about an amp
  • See the output rest at half the supply with no current
  • Turn volts into amps: 185 mV per amp on the 5 A board
  • See why one ADC count is 26 mA, and what that does to small readings
  • Compare the reading with the sensor’s own current readout

What the running circuit shows

A zero at 2.5 V, a surge and a steady draw.

The motor’s loop is a 6 V bench supply, a push button, the sensor and the motor. None of it connects to the Uno; the ACS712 measures the magnetic field the current makes and puts out a voltage. With no current that voltage is half the supply, 2.50 V, so the first thing the sketch does is read it and print “Midpoint: 511”. Every later reading is measured from there.

With the button up the sketch still prints 11 to 14 mA. That is not current; it is the sensor’s noise. Hold the button and the line becomes “mA: 163 peak: 1004”: for an instant the stalled motor drew an amp, then it spun up and settled at 0.150 A, with A0 at 2.528 V. A motor’s start-up current is several times its running current, and this is the circuit that shows it to you.

The printed 163 mA against a true 150 mA is the honest part. One count of the Uno’s converter is 4.9 mV, and at 185 mV per amp that is 26 mA, so this board cannot tell 150 mA from 165. For small currents, an INA219 is the better sensor.

How the ACS712 is modeled

The datasheet’s line, and its noise.

The output is half the supply plus 185 mV for every amp through the 5 A board, positive or negative, with the noise a real one has. The current path is a real conductor in the circuit, so the sensor reads whatever flows, AC or DC.

What it leaves out: the sensor’s response to nearby magnets and wires, and drift with temperature. On a real bench keep the board away from the motor itself, whose magnets it will happily measure.

How it works

Three steps from a blank tab to a running circuit.

  1. Open the editor

    It runs in your browser tab. Nothing to install, and you need no account to start.

    Your first project
  2. Wire it and write the code

    Drag parts onto a breadboard, run each wire from pin to pin, and write the sketch beside it.

    Wiring
  3. Press Run

    Your sketch compiles in the tab and runs on a model of the chip, with the Serial Monitor beside it.

    Run and serial
Reviews

What makers say about Mokxi.

“The AI checker helps check and correct my circuits, and it has way more components than Tinkercad. As a student I really appreciate the tool.”

ChloeEngineering student

“I’d been looking for a real online electronic simulator that was intuitive and complete when I found Mokxi. I was able to quickly import a Fritzing file and my Arduino sketch and start testing. Mokxi has all of the makings for the best online Arduino simulator I have been able to find!”

JayModel builderFeatured in his DioramaOS post

“I’m using Mokxi to develop and simulate an STM32-based four-wheel-drive robot car before building the actual hardware. It allows me to experiment with DC motor control, PWM, RPM measurement using photointerrupters, and different acceleration, braking, and reversing strategies, helping me understand and refine the system before implementing it in real life.”

NusretRobot car builder, Hamburg

Share your story

FAQ

Questions, answered.

Is it free?

Yes. The circuit on this page, every part in it and the editor it opens in are on the free plan, with no card.

Do I need an account?

No. The circuit runs the moment the page does, and the editor opens without one. A free account is only for saving a project to the cloud and sharing it by link.

How do I convert an ACS712 reading to amps?

Subtract the zero reading, the count with no current, then multiply by 4.9 mV per count and divide by the sensitivity: 185 mV per amp for the 5 A board. In this circuit the zero is a count of 511.

Why does my ACS712 show current when nothing is connected?

Noise, and a zero that is not quite where the sketch assumes. Measure the zero at start-up with no current flowing, as this sketch does, and average many readings. A few tens of milliamps of jitter on the 5 A board is normal.

Can an ACS712 measure small currents?

Not well. On a 5 V Uno one count is about 26 mA with the 5 A board, so anything under 100 mA is mostly noise. Use an INA219 for that range.

More simulators

Each one opens on a circuit that is already running.

Catch a motor’s surge

Open the circuit, hold the button and read the peak. Nothing to install, and no account needed.