Simulator

A servo simulator you can steer by hand

Mokxi is a free online servo motor simulator that runs in your browser, with nothing to install and no account needed. An Arduino Uno reads a slide potentiometer and sends a servo the matching pulse fifty times a second. Drag the fader and the horn walks after it, at the speed a real SG90 turns.

  • 505parts on the bench
  • 45boards running now
  • 1.00xreal time, on every board
Arduino Uno: servo faderlive0.000 s 0.00x
Click to open it in the editor
Drag the fader’s knob and watch the horn follow, or click anything else to open it in the editor.

What you can do here

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

  • Drag the fader and watch the horn turn from 0 to 180 degrees
  • Read every angle the sketch sends in the serial monitor
  • Change the pulse widths, the range or the turning speed in the properties panel
  • Switch the servo to continuous rotation and drive it as a wheel
  • Run the same idea on an ESP32 with ESP32Servo
  • Edit the Arduino code and press Run again

What the running circuit shows

A pulse width in, an angle out.

A servo does not take PWM the way an LED does. It takes a pulse every 20 ms, and the width of that pulse is the angle: 544 microseconds is one end of its travel and 2400 is the other, the Arduino Servo library’s numbers. The sketch reads the fader on A0, maps 0 to 1023 onto 0 to 180 degrees and prints each new angle.

In the engine the fader at the bottom gives 0 degrees and at the top gives 180, and the serial monitor says “fader 1023 -> 180 degrees”. Pull the fader from the top to the bottom and the horn does not jump: it turns at 600 degrees a second, the tenth of a second per 60 degrees an SG90’s datasheet gives, so it is still on its way about 150 ms later and gets to 0 within half a second.

The servo part

Every number a real servo has, in the properties panel.

The minimum and maximum pulse, the range in degrees (180 by default, up to 360) and the turning speed are all properties, so a servo that wants 1000 to 2000 microseconds, or a 270 degree one, is a change of two numbers. In continuous mode the same part is a continuous-rotation servo: a 1500 microsecond pulse stops it, and narrower or wider pulses turn it one way or the other up to its rated rpm. There is an MG996R in the parts bin too, and a PCA9685 board for driving sixteen at once.

What it leaves out: the horn has no load on it and the servo draws no stall current, so a project that browns out a real Uno when the servo starts will run here. On a real bench, give a servo its own 5 V supply once it carries any load, and join the grounds.

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.

Does it use the real Servo library?

The sketch on this page uses Mokxi’s small servo helper, which makes the pulse the same way. Sketches you write with #include <Servo.h> and myservo.write() compile in the editor too.

Can I simulate a continuous rotation servo?

Yes. Set the servo’s mode to continuous in the properties panel. A 1500 microsecond pulse stops it, and the further the pulse is from that, the faster it turns, up to its rpm setting.

Can I control a servo with an ESP32?

Yes. The ESP32 boards run ESP32Servo, and the ESP32 servo tutorial has a circuit ready to open.

More simulators

Each one opens on a circuit that is already running.

Make a servo move

Open the circuit, drag the fader and press Run. Nothing to install, and no account needed.