Which Tools Simulate a Mop Robot's Electronics?
- Intermediate
- Article
- Ages 16+
- 7 min read

Circuit simulation runs a mathematical model of a circuit to see voltages and currents over time before a real board is soldered. For a mop robot it answers questions such as whether the supply sags when the pump and the wheels start together. The common tools build on SPICE: ngspice, the simulator inside KiCad and LTspice.
Contents
- Circuit model
- Run the simulation
- Read the graph
- Adjust the design
What you will learn
- Name the circuit simulation tools and say what each suits.
- Pick the mop-robot circuits worth simulating and the question to ask of each.
- Read a simulation as pass or fail, and know what must be measured again on a real board.
Before you start
Read the article on the simulation layers of a mop robot first, and the basics on voltage and current, the MOSFET and the diode. Other terms are explained where they first appear.
What is circuit simulation and which tools are used?
Circuit simulation runs a model of the circuit in place of the real one. The NASA Systems Engineering Handbook says a model is a mathematical representation of reality and a simulation is the manipulation of a model. For circuits the shared family of tools is SPICE. The Berkeley technical report on SPICE combines nonlinear DC analysis, small-signal analysis and nonlinear transient analysis in one nodal analysis program. Berkeley notes that every electronic chip manufacturer today uses SPICE or one of its derivatives at critical stages of design.
A circuit is described as a netlist, a list of components and the nodes that join them. The ngspice home page says the user enters a circuit as a netlist, and the output is one or more graphs of currents, voltages and other electrical quantities.
- Netlist
- Simulator
- Graphs of current and voltage
The table compares the tools by use. The "Suits" column is this article's remark, not a judgement from the sources.
| Tool | What the source says | Suits |
|---|---|---|
| ngspice | Open source, circuits entered as a netlist, no schematic entry | Running many scenarios from files |
| Simulator in KiCad | KiCad's schematic editor includes simulation using ngspice | Drawing a schematic and simulating the same drawing that will become the board |
| LTspice | ngspice can use PSPICE or LTspice model parameters and netlists | Reusing the vendor's ready-made model libraries |
| Browser tool | Falstad's simulator shows an animated schematic with yellow dots for current | Getting a feel quickly, watching current flow before writing a netlist |
Which mop-robot circuits are worth simulating?
Simulate the circuits whose faults only show when several loads run together. In one illustrative model, six places are worth trying:
| Circuit | Question the simulation answers |
|---|---|
| H-bridge driving a wheel motor | How far does the starting current pull the supply down, and where does the reverse pulse go when it stops? |
| MOSFET switch for the pump | Does the flyback diode keep the turn-off pulse inside the MOSFET's limit? |
| Step-down supply | Does the voltage to the microcontroller stay steady when the load jumps? |
| Battery voltage divider | Does the voltage at the sense pin stay inside the range of the analogue-to-digital converter? |
| Charge path | Does charge current flow the right way when the robot docks and when the contact flickers? |
| Sag when pump and wheels run together | Does the supply fall below the level that resets the microcontroller? |
The first two need explaining. An Adafruit tutorial says that when power to a motor is switched off, a negative voltage spike appears that can damage the microcontroller or the transistor. The same tutorial says a diode across the motor connections protects by shorting out the reverse current from the motor. That is a flyback diode. Simulation shows how large the spike is in your circuit, without burning a MOSFET to find out.
- H-bridge driving the motor
- Wheel motor
- Reverse pulse when it stops
- Flyback diode across the pump
- MOSFET switching the pump
How do you read a simulation result? Supply sag when the pump and wheels run together
The concrete question is whether the supply falls below what the microcontroller tolerates when the pump switches on while both wheels start. There are four steps, and the result is always a pass or fail sentence.
- Write a netlist with a battery source that has internal resistance, two motor loads, the pump load through a MOSFET, a filter capacitor and the microcontroller load.
- Run an operating-point analysis to know the voltage when everything is idle.
- Run a transient analysis, switching the pump and both wheels on together.
- Read the voltage graph at the microcontroller's supply pin and compare it with the limit line.
The two analyses differ. The ngspice manual says that in DC analysis ngspice neglects the time-varying behavior of reactive elements and calculates the DC solution of the circuit. In the same manual a DC sweep is the repeated application of that analysis over a range of levels for the input sources, and transient analysis extends DC analysis to the time domain. A sag happens over time, so it needs transient analysis.
- Required operating limit
- Voltage dipping below the limit (fail)
- Voltage after adding a capacitor (pass)
- Moment the pump and wheels start
The limit comes from the chip's documentation. For the ESP32, the ESP-IDF documentation says the chip has a built-in brownout detector, enabled by default, which can trigger a system reset if the supply voltage goes below a safe level. The exact level comes from the chip's datasheet and the configuration you choose. The model’s criterion must use component operating limits, not only the brownout threshold. Avoiding a reset does not prove the chip and sensors are working correctly; check voltage, current and the specified limits throughout the transient. If the graph touches the limit line, the result is a fail and you change the design: add a capacitor, split the supply or start the pump later than the wheels.
One run is not enough. Battery internal resistance, capacitor tolerance and motor current all vary. The ngspice manual describes Monte Carlo simulation for studying how a circuit depends on statistically varying device parameters. Monte Carlo samples a chosen distribution; it does not guarantee the worst combination appears. In the illustrative model, also run predetermined boundary combinations for battery, loads and capacitors, and accept results only within the tested parameter range.
How far can you trust the model, and what must be measured again?
Trust the model only for the part it describes, then compare it with a real board. ngspice takes model parameters from semiconductor device manufacturers or from semiconductor foundries, so the quality of the result depends on the model you load. Motor and battery models are usually the weakest, because they change with load and age.
The comparison procedure in the illustrative model:
- Run the pump-plus-wheels scenario in simulation and save the graph.
- On the first board, measure the voltage at the supply pin in exactly the same scenario.
- Place the two graphs side by side. If they differ a lot, adjust the battery's internal resistance or the motor model to match the measurement, then rerun the other scenarios.
- Simulated curve
- Curve measured on the real board
- Gap at the dip
Circuit simulation does not replace every test. Component heat, electromagnetic noise emitted and received, and Wi-Fi radio are outside this model; they need measuring on a real prototype.
Real-world example
This is an illustrative scenario, not a measured result. A builder puts a pump and two wheels on one battery. On the first board the microcontroller restarts now and then when the robot starts moving and the pump switches on. They build the netlist of that exact circuit in ngspice, run a transient analysis and see the voltage graph touch the limit line when the pump switches on. After adding a filter capacitor to the netlist, the graph stays above the line. They then measure the board, the two graphs are close, and they conclude the model is usable. When they change to another battery, they measure again and adjust the internal resistance in the model before trusting the new result.
Common misunderstandings
If the simulation passes, the real board will pass. A simulation is right only for what the model describes. The comparison with measurements on the first board cannot be skipped.
One run at nominal values is enough. Tolerance and ageing make results vary, so sweep parameters or run Monte Carlo.
Circuit simulation also checks the firmware. Circuit simulation handles voltage and current. Code running on the microcontroller is checked in another layer.
Frequently asked questions
How do ngspice and KiCad differ?
ngspice is a simulator that takes a netlist and has no schematic entry. KiCad has a schematic editor and uses ngspice to simulate that same schematic, so you do not write the netlist by hand.
Is circuit simulation free?
ngspice is open source, and there are browser tools such as Falstad's. For any other tool, read the vendor's terms before using it.
Do I need the manufacturer's model to simulate?
Yes, if you want results close to the real component. ngspice takes model parameters from manufacturers, and can reuse those written for PSPICE or LTspice.
Summary
- Circuit simulation runs a mathematical model of the circuit with SPICE-family tools such as ngspice, KiCad and LTspice.
- The circuits worth trying are the motor H-bridge, the pump switch with a flyback diode, the step-down supply, the battery divider, the charge path and the sag when pump and wheels run together.
- The result is a pass or fail sentence, then compared with measurements on a real board; heat, electromagnetic noise and radio still need a real prototype.
Terms in this article
English and Vietnamese terms, with the meanings used here. Hover, tap or Tab to a term with a dotted underline for an explanation as you read.
- SPICE
- The family of circuit simulation programs that began at UC Berkeley; a circuit is entered as a netlist and voltages and currents are calculated.
- netlist
- A list of a circuit's components and the nodes that join them, used as the input of a simulator.
- transient analysisphân tích quá độ
- The analysis that extends DC analysis to the time domain, used to see voltages and currents change when a load switches on.
- DC sweepquét một chiều
- Repeating DC analysis over a range of levels of the input sources to see how the response changes.
- flyback diodediode dập
- A diode placed across a motor that shorts out the reverse current when power is cut, protecting the transistor.
- brownoutsụt áp
- A supply voltage that falls below a safe level; the ESP32 brownout detector can reset the chip when this happens.
This article is not marked as viewed
Spotted something wrong or unsafe?
Tell the administrator by email. The message already has the article title and address.
You may also like
AdvancedHow Do You Simulate Robot Motion in a Virtual Home?
Build a virtual home for a small mopping-robot fleet: pick a simulator, add simulated sensors, link ROS 2 and run repeated acceptance runs.
Robotics8 min read
AdvancedHow Do Many Mop Robots Split Zones and Share a Dock?
How a fleet of mop robots splits a floor into zones, assigns one robot to each, queues for a shared dock and hands a zone over after a failure.
Robotics8 min read
IntermediateHow Can a Mop Robot Spot Clutter and Alert a Person?
How a mop robot merges bumps, jams, unreachable cells and still frames into a clutter score per zone, then alerts a person at the right time.
Artificial intelligence7 min read
AdvancedWhat Path Lets a Robot Mop Cover a Whole Room?
How a mop robot covers a whole room: cells around obstacles, back-and-forth passes, a map of cleaned cells, drift correction and blocked cells.
Robotics8 min read
Sources
These sources are written for older readers. If they feel hard, read them with an adult.
- SPICE (Simulation Program with Integrated Circuit Emphasis) — UC Berkeley EECS Technical Report(opens in a new tab)
UC Berkeley EECSTier A: government, standards or research bodiesRead on November 2, 2026
- Don Pederson: Creator of SPICE — EECS at Berkeley(opens in a new tab)
UC Berkeley EECSTier A: government, standards or research bodiesRead on November 2, 2026
- ngspice, the open source Spice circuit simulator(opens in a new tab)
ngspiceTier C: other sourcesRead on November 2, 2026
- ngspice user's manual (HTML)(opens in a new tab)
ngspiceTier C: other sourcesRead on November 2, 2026
- Schematic Editor — KiCad 9.0 documentation(opens in a new tab)
KiCadTier C: other sourcesRead on November 2, 2026
- Falstad circuit simulator(opens in a new tab)
Paul FalstadTier C: other sourcesRead on November 2, 2026
- Adafruit Arduino Lesson 13. DC Motors — Transistors(opens in a new tab)
AdafruitTier C: other sourcesRead on November 2, 2026
- Fatal Errors — ESP32 — ESP-IDF Programming Guide(opens in a new tab)
EspressifTier C: other sourcesRead on November 2, 2026
- 5.3 Product Verification — NASA Systems Engineering Handbook(opens in a new tab)
NASATier A: government, standards or research bodiesRead on November 2, 2026
