Source: https://mokxi.com/robot-arm-simulator

Simulator

# A robot arm simulator with four servos and two joysticks

Mokxi is a free online robot arm simulator that runs in your browser, with nothing to install and no account needed. A four-servo desktop arm, the MeArm kind from the kits, on four pins of an Arduino Uno, steered by two thumb joysticks with the Servo library. Hold a stick over and its joint keeps moving; let go and it stays put, and the side view draws the arm in the pose its servos hold.

Start building free or drive the arm from a PCA9685

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

Hold the button

The left stick turns the base and tilts the shoulder, the right one tilts the elbow and works the claw. Drag a stick and hold it, or click the circuit to open it in the editor.

## What you can do here

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

- Drive the base, shoulder, elbow and claw from two joysticks
- Watch the arm’s pose drawn from its four servo angles
- Read every joint’s angle on the serial monitor as it moves
- Change the joint limits, the speed or the dead band in the sketch
- Program a pick-and-place sequence in place of the sticks
- Move the servos onto a PCA9685 and free the Uno’s pins

## What the running circuit shows

Hold a stick, and the joint keeps going.

The arm starts with its base, shoulder and elbow at 90 degrees and its claw at 70. Each joint is an SG90 on the Servo library’s window, so 90 degrees is a 1472 microsecond pulse on pin 3 and the claw’s 70 is a 1264 microsecond pulse on pin 9.

The sticks are rate controls, the way the kit sketches do it. Push the left stick all the way to one side and the base moves 3 degrees each pass of the loop, and with the loop’s 20 ms delay and the four servo pulses a pass takes about 27 ms: it reaches 180 degrees, a 2400 microsecond pulse, about 0.8 seconds after you push. Push it a little over half way and it moves 1 degree a pass and takes about 2.5 seconds. Let go and the stick springs back to the middle, and the joint stays where it is. A dead band of 60 counts either side of the middle stops a stick that does not center perfectly from creeping the arm: a nudge of 55 counts moves nothing.

The sketch keeps each joint inside limits so the arm does not fold into its own base: the shoulder and elbow stop at 40 and 160 degrees, and the claw shuts at 20 and opens to 120. Push the right stick one way and the claw closes to 20; the other way and it opens to 120. The serial monitor prints all four angles whenever one moves.

## How the arm is modeled

Four hobby servos and a drawing of the linkage.

Each joint is the same model as the hobby servo: it reads the pulse width on its pin, 544 to 2400 microseconds for 0 to 180 degrees on the Servo library’s window, and turns toward it at 600 degrees a second; below 4 V it does not move. The side view draws the upper arm and the forearm from the shoulder and elbow angles, and a dial shows the base’s turn from above. The arm has its own 5 V supply with its ground joined to the Uno’s, which is how a real one has to be wired.

What it leaves out: the current, so the brown-out that makes a real arm twitch on a USB-powered Uno cannot happen here, though four SG90s moving at once can pull more than an amp. Also the linkage’s own limits, since a real arm can jam its forearm into its upper arm, and anything the claw picks up. There is no inverse kinematics built in: the angles are whatever your sketch writes.

The same arm on a PCA9685 servo driver The servo simulator A joystick on an Arduino Robotics lesson plans

## 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.

Can I program a robot arm without the hardware?

Yes. Write the sketch for the Uno, drive the four joints with the Servo library, and watch the arm move in the side view. The same code runs on a real four-servo arm wired to the same pins.

Why does my real robot arm twitch or reset the Arduino?

Usually power. Four SG90s moving together can pull more than an amp, more than an Uno’s 5 V pin gives from USB, so the board browns out. Give the servos their own 5 V supply and join the grounds, as this circuit does.

Does it do inverse kinematics?

Not for you. The arm goes where its four angles put it, and the side view draws that. Work the angles out in the sketch, as you would for a real arm, and the drawing shows whether you got them right.

## 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 Servo 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 Load cell simulator IR sensor simulator LM35 simulator HC-05 Bluetooth simulator nRF24L01 simulator

## Move a robot arm

Open the circuit, drag a joystick and watch the arm follow. Nothing to install, and no account needed.

Start building free Open the editor
