BetterSPICE is an open-source circuit simulator working natively on Windows, Linux, and macOS, although a web-based version is also available. The way it works is that you build the circuit in the drag-and-drop user interface, write the code for the microcontroller (if any), and run the firmware inside the circuit against the real pin voltages for GPIO, ADC, DAC, PWM, timers, UART, I2C, SPI, and CAN Bus. So when the power rail sags, it behaves like on real hardware (e.g., ADC readings sag with i