Source: https://mokxi.com/servo-simulator

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.

Start building free or see the servo part

- 455 parts on the bench
- 43 boards running now
- 1.00x real time, on every board

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.

Servo with Arduino, step by step Servo with an ESP32 Sixteen servos on a PCA9685 What PWM is

## Questions

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.

Online circuit simulator Breadboard simulator ESP32 simulator Op-amp simulator Logic gate simulator LED circuit simulator LCD simulator OLED simulator NeoPixel simulator 7 segment display simulator LED matrix simulator Stepper motor simulator Motor driver simulator Ultrasonic sensor simulator Rectifier simulator Digital circuit simulator Potentiometer simulator PWM simulator Relay simulator Shift register simulator DHT11 simulator RFID simulator Accelerometer simulator RGB LED simulator Buzzer simulator MOSFET simulator Circuit simulator for kids Flip-flop simulator Multiplexer simulator Full adder simulator I2C simulator UART simulator Thermistor simulator PIR sensor simulator Oscilloscope simulator Multimeter simulator DC motor simulator Traffic light simulator Diode simulator Capacitor simulator Series and parallel circuit simulator Wheatstone bridge simulator Voltage regulator simulator Soil moisture sensor simulator Zener diode simulator Solar panel simulator AC circuit simulator Thevenin simulator Decoder simulator Encoder simulator PID simulator Robot arm simulator Load cell simulator IR sensor simulator LM35 simulator HC-05 Bluetooth simulator nRF24L01 simulator

## Make a servo move

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

Start building free Open the editor
