Motors
de:volt models three motor types: a brushed DC motor, a hobby servo, and a 4-wire bipolar stepper. Each has a declared electromechanical or behavioural model and reports a live readout such as speed, actual angle, target angle, or step position.
The DC motor and stepper have explicit winding inductance. Drive them with an H-bridge (L293D, TB6612) or provide a suitable flyback path when using bare transistor switches. The servo is a powered actuator macro-model, not an exposed motor winding.
DC Motor
A generic brushed DC motor, modelled as a series R+L winding with a back-EMF source proportional to rotor speed (Vbemf = Ke × ω). Winding current produces torque (Tm = Kt × i), and the rotor follows J × dω/dt = Kt×i − b×ω − loadTorque.
Pinout
| Pin | Label | Description |
|---|---|---|
| m1 | M+ | Positive terminal (drive voltage or H-bridge OUT_A) |
| m2 | M− | Negative terminal (GND or H-bridge OUT_B) |
Defaults
| Parameter | Default | Unit |
|---|---|---|
| windingR | 5 | Ω |
| windingL | 0.002 | H |
| Ke | 0.01 | V/(rad/s) |
| Kt | 0.01 | N·m/A |
| inertia | 1e-5 | kg·m² |
| friction | 1e-5 | N·m·s/rad |
| loadTorque | 0 | N·m |
These can be overridden via the Inspector properties panel.
How it behaves
As the rotor speeds up, back-EMF rises and opposes the supply, so current falls. At standstill (ω = 0) there is no back-EMF. After the winding-current transient, the model’s steady stall current approaches V / windingR; with 5 Ω and 6 V that is 1.2 A. The explicit winding inductance prevents current from jumping instantly to that value.
The simulator reports rotor speed (ω in rad/s) and RPM. loadTorque applies a fixed opposing torque inside this model, but the motor is not mechanically coupled to any other canvas component. Commutation ripple, brush arcing, magnetic saturation, gearbox backlash, bearing friction detail, and heating are omitted.
Drive method
Use an H-bridge for bidirectional control: connect M+ to OUT_A and M− to OUT_B for forward rotation, then reverse the drive signals for reverse. Reversing the terminal polarity reverses the spin direction. A bare transistor switch needs a flyback diode connected anti-parallel across M+/M− to clamp the voltage spike when the transistor turns off.
Example circuit
Arduino D5 ─── IN1 ┐
Arduino D6 ─── IN2 │ [L293D] OUT1 ─── M+
│ OUT2 ─── M− [DC Motor]
5V ──┴── VCC / VSHobby Servo (SG90)
A PWM-controlled rotary position actuator. A HIGH pulse of 1–2 ms commands a target between 0° and 180°. The shaft then moves toward that target at a finite, supply-dependent speed rather than snapping there instantly.
Pinout
| Pin | Label | Description |
|---|---|---|
| sig | Signal | PWM control input |
| vplus | V+ | Power (4.5–6 V, 4.8 V nominal) |
| gnd | GND | Ground |
The connector is polarised: signal first, power centre, GND last. Do not reverse it.
Defaults
| Parameter | Default | Unit |
|---|---|---|
| minPulseMs | 1.0 | ms |
| maxPulseMs | 2.0 | ms |
| minAngle | 0 | ° |
| maxAngle | 180 | ° |
| idleR | 330 | Ω |
| movingCurrent | 0.15 | A at nominal voltage |
| maxSpeedDegPerSecond | 600 | °/s at 4.8 V |
| minimumOperatingVoltage | 4.5 | V |
How it behaves
The signal pin is a genuinely high-impedance physical input. There is no invented 1 MΩ pull-down. The engine’s 1 TΩ floating-node regularisation is numerical only and is not a physical servo load. For non-MCU drivers, the fallback sampler reads HIGH when V(sig) − V(gnd) ≥ 2.0 V. Direct Arduino and RP2040 drivers replay cycle-timestamped pin edges, so a narrow PWM pulse is not rounded to the outer electrical step.
At rest, V+ to GND uses the 330 Ω idle load, roughly 15 mA at 5 V. While the shaft moves, the model uses a 150 mA at 4.8 V teaching load (equivalent to 32 Ω). This moving current is not a stall-current or torque model.
On each pulse the sim measures the HIGH time and maps it to an angle:
targetAngle = minAngle + (pulseMs − minPulseMs) / (maxPulseMs − minPulseMs) × (maxAngle − minAngle)So a 1 ms pulse gives a 0° target, 1.5 ms gives 90°, and 2 ms gives 180°. The target holds between complete pulses. The readout distinguishes target angle from actual shaft angle and velocity. At 4.8 V the default no-load rate is 600°/s; speed scales with solved supply voltage. Below 4.5 V the shaft stops but retains the decoded target.
Drive method
Drive the signal pin with a roughly 50 Hz PWM signal. The Arduino Servo library generates the 1–2 ms pulses for you. In hardware, power V+ from a rail sized for the real servo’s moving and stall current; do not infer that requirement from the simulator’s 150 mA moving-load approximation. For more than one servo, a separate supply is usually safer than the Arduino 5 V pin.
The model omits acceleration, torque and stall behaviour, position error under load, gearbox backlash/compliance, control hunting, gear damage, and heating. It is suitable for PWM decoding, rail sag from a declared moving load, and finite travel timing, not mechanical sizing.
Example circuit
Arduino D9 ─── Signal
5V ─── V+ [Servo SG90]
GND ─── GNDBipolar Stepper Motor (NEMA 17)
A 4-wire bipolar stepper with two independent coils (A and B). Energising the coils in the 4-phase full-step sequence advances the shaft one step at a time. Default: 200 steps/rev (1.8°/step).
Pinout
| Pin | Label | Description |
|---|---|---|
| a1 | A1 | Coil A, A+ |
| a2 | A2 | Coil A, A− |
| b1 | B1 | Coil B, B+ |
| b2 | B2 | Coil B, B− |
Defaults
| Parameter | Default | Unit |
|---|---|---|
| coilR | 10 | Ω |
| coilL | 0.01 | H |
| stepsPerRev | 200 | steps/rev |
How it behaves
Each coil is a series R+L load. Stepping is detected from the sign of the committed coil currents after each solve (±1 mA deadband), giving four phases:
| Phase | Coil A | Coil B |
|---|---|---|
| 0 | A+ | B+ |
| 1 | A− | B+ |
| 2 | A− | B− |
| 3 | A+ | B− |
Advancing one phase (mod 4) moves one step forward; stepping back one phase moves one step back. A non-sequential jump holds position. The simulator reports the accumulated commanded step position. There is no back-EMF, torque, rotor inertia, acceleration limit, resonance, or missed-step behaviour in this model. A counted step therefore does not prove that equivalent hardware would have enough torque to move.
Drive method
Cycle the full-step sequence with an H-bridge. With an L293D, wire OUT1→a1, OUT2→a2, OUT3→b1, OUT4→b2; with a TB6612, AO1→a1, AO2→a2, BO1→b1, BO2→b2. Each phase transition is one step (1.8° for a 200-step motor). Reversing one coil reverses the rotation direction. A discrete bidirectional bridge needs recirculation paths around its switching devices; the L293D/TB6612 provide those paths internally when VM is powered.
Unipolar/ULN2003 5-wire steppers, microstepping, detent torque, magnetic saturation, and winding heating are not modelled.
Example circuit
Arduino D8 ─── IN1 ┐ OUT1 ─── A1 ┐ Coil A
Arduino D9 ─── IN2 │ [L293D] OUT2 ─── A2 ┘
Arduino D10 ── IN3 │ OUT3 ─── B1 ┐ Coil B
Arduino D11 ── IN4 ┘ OUT4 ─── B2 ┘ [Stepper NEMA 17]Reading the results
Select a motor to see the exact model identity plus Included / Not included in the Inspector. Mechanical readouts are state variables from these compact models, not measurements of an attached shaft, gearbox, or load that exists outside the canvas.