The first simulators were text-based tools that simulated analog circuits at lowest level by solving physical equations, better known as SPICE. Next came graphical interfaces built on top of SPICE, but the basic principle stayed unchanged: you describe your circuit in an abstract way and the simulator outputs a set of analog voltages and currents (eventually plotted in a graph). For a professional electrical engineer this is exactly what is required, but for a beginner/student it’s hard to understand these programs or interpret the results.
The Autodesk Circuits simulator does a lot more than that while the SPICE simulation is seamlessly hidden behind an actual circuit that the user builds. This is done by picking realistic components and composing them on a virtual breadboard, just like in a real life lab. Simultaneously an abstract, engineering schematic is drawn for your circuit in our environment.
“An LED will actually light up instead of seeing an abstract waveform on the screen.”
When the user starts simulation, an LED will actually light up or start blinking on the screen in real-time. This is in contrast to an abstract, plotted waveform of current flowing through the diode. If you wanted to investigate the current flowing at that point in the circuit, add a virtual multi-meter to show instantaneous current, just like a measurement in the real world.
If you want to simulate components like a switch in SPICE, the user needs to run a simulation for every state (pressed or not) and afterwards the result is graphically plotted as a function of these states. In our fully-interactive simulator, the user simply presses the switch with a mouse and immediately observes the changed behavior of the circuit.
So Autodesk Circuits can simulate your physical circuit in any aspect: electrical behaviour + interaction.
When more and more complex electronic parts were created with thousands of transistors; a full analog simulation would take too long. This led to the development of higher-level, event-based simulators. Rather than describing your device as an analog circuit, you describe the digital behaviour of different signals inside it. To describe that behaviour electrical engineers use hardware description languages like VHDL and Verilog. There already exist multiple tools that can simulate a circuit of different digital devices, but again the output is often a graph of signal values, which is rather abstract.
In Autodesk Circuits, the user can combine digital devices, for example a Johnson decade counter, with analog components like resistors and LEDs. This allows a visualization of the signal values at the ports of digital devices and can be combined with interactive analog components like switches.
Autodesk Circuits also has digital models for much more complex devices like microcontrollers (MCU). The Arduino is a very popular open-source microcontroller platform that is available in the simulator. Users can program the MCU by writing C++ code in the onboard code editor or just by copying their existing sketches. The simulator compiles user code together with the necessary Arduino libraries into a hex file (a binary file containing the raw processor instructions) and executes these instructions exactly like the real Arduino hardware would. Again Autodesk Circuits allows for the observation of the different pins in real time with a multimeter or LED.
With this simulation tool it’s possible to simulate analog sensors like potentiometers, LDRs, photodiodes, temperature and tilt sensors connected to an Arduino. You can use the ADC of the microcontroller to read voltages and process these values in the system as blinking LEDs for status, a motor turning in a control system, or simply printing the values to a built-in serial monitor.
This is also an excellent tool to learn more about communication protocols like UART, SPI, I2C or IR protocols. For example connect two Arduinos to each other and let them communicate using an I2C bus. Write a program that drives the I2C peripheral of the MCU or use an existing library for this. When starting the simulation you can observe the waveforms on the I2C lines with the virtual scope. It will show exactly the same waveforms as a real scope would, but without the need of costly oscilloscope lab equipment. Also note that when you forget the pull-up resistors for I2C or connect the wrong terminals, your circuits will not work, just as in the real world.
Programming microcontrollers can be complicated because the programming has to be exact and you need to know how the MCU will react on it. For this it’s extremely useful to observe the MCU executing code step-by-step. This brings us to the most exciting and latest feature of the Autodesk Circuits simulator: the debugger.
The new features allow for breakpoints at any line in code. When the simulator reaches the breakpoint, instead of executing the instruction corresponding to that line, it now pauses the whole simulation. At that moment you can readout every variable in scope and literally look inside the microcontroller’s memory. The debugger will also decode this memory according to the declared variable type and will show a human-readable value. This can help a lot in understanding your own or someone else’s code or in tracing possible mistakes.
“Place a breakpoint in your library and pause the simulator in the middle of a I2C sequence.”
Currently there already exist cycle-accurate MCU simulators with the debugger tool, but all of them can only simulate a single MCU without any connected electronics. To debug a program that uses the ADC to readout a voltage, you manually have to toggle the corresponding bits in the microcontroller’s memory. If you want to debug a program that handles a certain communication protocol, you have to write a stimuli file that defines a bit sequence for the corresponding pins. All of this is rather advanced and difficult to understand for beginners. With the Autodesk Circuits simulator it’s intuitive to modify inputs to the microcontroller with the interactive circuit around it and directly debug the program with that input.
Another existing option to debug a physical microcontroller together with a circuit is a hardware in-circuit debugger. This system needs an external device connected between the computer and the real MCU. This hardware debugger pauses the microcontroller at certain points and asks it to send a snapshot of its memory. Although you can pause the microcontroller in this way, the user can never pause the real electronics (e.g. a charging capacitor) around it. In Autodesk Circuits the simulator stops the MCU and electronics all together so every variable can be observed with every voltage or current at a given time.
The flexibility of our system makes the Autodesk Circuits simulator excellent to develop complex microcontroller programs with a lot of external component interaction. Take for example the previous section showcasing the build of an I2C circuit. You could place a breakpoint in the interrupt service routine for the I2C module, when the time stops at that point, you can read out all the variables and the signal values in the middle of an I2C bit sequence!
5. Continuous improvements
The Autodesk Circuits simulator is constantly being improved. We plan to have an extensive part library that mirrors the real world adding components all the time. New features are also being added to allow for better understanding of electronics or debugging.
A feature that we are creating for a future update is a time warp of the simulation. This can be useful to understand the process of dimming an LED via PWM (pulse width modulation). Autodesk Circuits will be capable of showing the simulation in slow motion so you can actually see an LED blinking, and also show how it appears dimmed when a time-warp slider is dragged to full speed.
We are also going to further improve the usability of the debugger. In the future the user will have a nice overview of all breakpoints where they can toggle each breakpoint individually. There will have a structured list of all local and global variables with their values and a better overview of the MCU registers and other internals. This will make it the best tool to understand the running MCU to the bottom.
You will also be able to split more complex code into different files and tabs. Ever wondered what the digitalWrite function of the Arduino API actually does? In the future you will be able to step into this function with the debugger.
If anyone has good suggestions of features to add to our simulator, don’t hesitate to contact us.
So what makes this the best simulator in the world? It’s 123D Circuit’s combination of a cycle-accurate and debuggable microcontroller environment with analog electronics that can be simulated real-time with interactive components. All of this is implemented in a very easy-to-use in-browser interface. This makes it an excellent and accessible tool for everyone that wants to learn or design electronics. You can be a making a product, trying to learn simple electronics or modifying someone else’s code or circuit. Try it out yourself at circuits.io/lab!