BetterSPICE 1.0.0 is out, and the source is open. Read the code on GitHub
BetterSPICE 1.0.0 GitHub Download

Guide

Simulate a microcontroller with its analog circuit

BetterSPICE has an MCU part that runs your program in the same simulation as the analog circuit around it. Its pins are real: outputs drive through a resistance, inputs read the actual voltage, and the ADC reads against the actual supply. It does not run compiled firmware. You write the logic in a small pin language.

Checked on 28 November 2026. BetterSPICE 1.0.0. Facts about other tools are linked at the bottom. Where I could not check one, it says "see vendor".

How it works in BetterSPICE

The microcontroller is a part in the library, called the MCU. You write a short program on its Code tab, in a small language made for pins. Name a pin in the code and it appears on the chip. The program runs inside the same simulation as the analog circuit, and its pins behave like real ones (manual chapter 42).

  • Outputs are real drivers. An output drives through 25 Ω with 10 ns edges, from the chip’s own supply pins. With the supply unwired it cannot drive anything. More than 25 mA for 10 µs raises a warning.
  • Inputs read real voltages. They switch below 0.3 and above 0.7 of the actual supply, with hysteresis. A floating input rests at half the supply and warns after 1 ms.
  • The ADC measures the actual pin voltage against the actual supply, so a sagging rail changes the reading, as on a bench.
  • PWM edges are exact, not sampled on a tick, with complementary outputs and dead time for a half bridge.
  • Buses: UART, I²C, SPI and CAN, and a debugger with breakpoints, Step and a variables panel.
  • Packages: pick a variant such as ATmega328P, ATtiny85 or STM32F103C8 to get its pin names, or use the generic part. Arduino-style names (pinMode, digitalWrite, analogRead) work, and you can export an Arduino sketch or an STM32 HAL file as a starting point.

The example MCU blink is the first program from the manual: an LED pin that toggles every 500 ms through a resistor and an LED. Open it in the browser demo, or build it yourself in about five minutes with chapter 42. The microcontroller also works in the full browser app at app.bspicesim.com.

The digital PI buck example in BetterSPICE: the controller program in the inspector while the switch node, the PWM pin and the inductor current run on the scope
A buck converter with no analog control loop. The MCU samples the output 20,000 times a second, runs a PI loop and sets the 100 kHz PWM that holds 12 V down to 5 V.

What it does not do

  • It does not run compiled firmware. The code is a simpler language on purpose. You port the logic of your firmware, not the binary.
  • Some peripherals are not emulated: watchdog, sleep modes, DMA, USB, Ethernet, input capture, and I²C or SPI target mode. UART is fixed at 8N1 and SPI at mode 0. The full list is in chapter 42.25.
  • It is new. Version 1.0.0 came out on 28 November 2026. The desktop downloads open together with the GitHub repository.

Compared with other ways to do it

These tools take different routes, so the choice depends on what you need to prove.

  • BetterSPICE: your control logic, written in its own small language, against real analog behaviour: supply sag, floating pins, loads, edges. No compiled firmware.
  • QSPICE: compiles C++ and Verilog blocks to native code and runs them in the simulation [1]. Good for controller logic written as code. See vendor for how it models pins and peripherals.
  • Proteus: built to run a compiled firmware file on a model of the chip next to the circuit [2]. See vendor for supported chips and prices.
  • SimulIDE: a free, open source simulator for circuits with microcontrollers [3]. See vendor for chips and accuracy.

If you must run the exact binary that ships, a tool that emulates the chip is the right one. If you want to see how the circuit around the chip reacts, and the logic is simple enough to restate, BetterSPICE is built for that. I make it, so check the other pages yourself.

Sources

  1. Qorvo, QSPICE, and Hackster, Qorvo’s QSPICE Is a Free Next-Generation Mixed-Mode SPICE Simulation Tool, read through search on 28 November 2026.
  2. Labcenter Electronics, Proteus: see the maker’s pages for the current feature list.
  3. SimulIDE, simulide.com: see the maker’s pages for the current feature list.
  4. BetterSPICE: manual chapter 42, features.

Proteus, QSPICE, SimulIDE and the chip names above belong to their owners. BetterSPICE is not affiliated with any of them.

Questions people ask

Can I simulate a microcontroller together with its analog circuit?

Yes. In BetterSPICE the MCU part runs a short program against the real pin voltages of the circuit around it: GPIO, ADC, PWM, UART, I2C, SPI and CAN, in the same simulation as the analog parts.

Does it run my compiled firmware?

No. The program is written in BetterSPICE’s own small pin language or Arduino-style names, so you restate your logic. You can export an Arduino sketch or an STM32 HAL file as a starting point.

Can the ADC see a supply that sags?

Yes. The ADC reads the pin voltage at the instant of the read and quantises it against the actual supply, so the reading changes when the rail sags.

Which microcontrollers are available?

A generic MCU, and variants with real package pins such as ATmega328P, ATtiny85 and STM32F103C8. The model is the same simple one. The variant sets the pin names.

Does it work in the browser?

Yes. The full app at app.bspicesim.com includes the microcontroller, and the browser demo has an MCU blink example.

How is this different from QSPICE or Proteus?

QSPICE compiles C++ and Verilog blocks into the simulation, and Proteus is built to run firmware on a chip model. BetterSPICE runs a simpler pin language against real analog behaviour and does not run compiled firmware. See vendor for their details.