This electronic circuit simulator is highly interactive giving the feeling of playing with real components. It's very helpful for experimentation and visualization. Best of all, thanks to the power of HTML5, no plug-ins are required! The original implementation, in Java, belongs to Paul Falstad who kindly gave his permission for me to build this port.
How to use this
When the simulator starts up you will see an animated schematic of a simple LRC circuit. The green colour indicates positive voltage. The grey colour indicates ground. A red colour indicates negative voltage. The moving yellow dots indicate current.
To turn a switch on or off, just click on it. If you move the mouse over any component of the circuit, you will see a short description of that component and its current state in the lower right corner of the window. To modify a component, move the mouse over it, click the right mouse button (or control-click if you have a Mac) and select "Edit". You can also access the edit function by double-clicking on a component.
There are three graphs at the bottom of the window; these act like oscilloscopes, each one showing the voltage and current across a particular component. Voltage is shown in green, and current is shown in yellow. The current may not be visible if the voltage graph is on top of it. The peak value of the voltage in the scope window is also shown. Move the mouse over one of the scope views, and the component it is graphing will be highlighted. To modify or remove a scope, click the right mouse button over it and choose "remove" from the menu. There are also many other scope options in this context menu. To view a component in the scope, click the right mouse button over the component and select "View in Scope".
The "Circuits" menu contains a lot of sample circuits for you to try.
Some circuits, eg Basics->Potentiometer, contain potentiometers or variable voltage sources. These can be adjusted using sliders that are added to the right hand tool bar, or by positioning the mouse pointer over the component and using the scroll wheel.
Here's a video to help you get started.
Drawing and Editing Circuits
You can get a blank circuit by choosing "Blank Circuit" from the "Circuits" menu. You will need to add at least one voltage source to start the simulator.
To add components or a wire choose one of the "Add...." options from the "Draw" menu. Note that common components have keyboard short-cuts to select their add mode. When in add mode the cursor changes to a "+". Click and drag the mouse to add a component.
Components may be moved and resized in the selection mode. When in selection mode the cursor changes to an arrow. Choose "Select/Drag Sel" from the "Draw" menu or press "space", or press "escape" to go in to selection mode. Hovering over a component will highlight it and show information about that component in the info area. Clicking and dragging on a component will move the component. If you click and drag on the square handles or hold down the ctrl key this will resize the component and move the terminals.
Wires only connect at their ends and not in the middle therefore you have to draw each segment of a wire separately. If the simulator spots unconnected points it thinks you intended to connect it will highlight these with a red circle.
Many components have adjustments that can be made using the edit function explained above. For resistors, capacitors and inductors you can conveniently set the value from the E12 range by rolling the mouse wheel when hovering over the component
The File menu allows you to import or export circuit description files. See notes below on browser compatibility.
The Reset button resets the circuit to a reasonable state. If the simulation is paused then hitting the Reset button twice will restart it. The Run/Stop button allows you to pause the simulation. The Simulation Speed slider allows you to adjust the speed of the simulation. If the simulation isn't time-dependent (that is, if there are no capacitors, inductors, or time-dependent voltage sources), then this won't have any effect. The Current Speed slider lets you adjust the speed of the dots, in case the currents are so weak (or strong) that the dots are moving too slowly (or too quickly).
This video demonstrates some of the above points.
Here are some errors you might encounter:
- Voltage source loop with no resistance! - this means one of the voltage sources in your circuit is shorted. Make sure there is some resistance across every voltage source.
- Capacitor loop with no resistance! - it's not allowed to have any current loops containing capacitors but no resistance. For example, capacitors connected in parallel are not allowed; you must put a resistor in series with them. Shorted capacitors are allowed.
- Singular matrix! - this means that your circuit is inconsistent (two different voltage sources connected to each other), or that the voltage at some point is undefined. It might mean that some component's terminals are unconnected; for example, if you create an op-amp but haven't connected anything to it yet, you will get this error.
- Convergence failed! - this means the simulator can't figure out what the state of the circuit should be. Just click Reset and hopefully that should fix it. Your circuit might be too complicated, but this happens sometimes even with the examples.
- Transmission line delay too large! - the transmission line delay is too large compared to the timestep of the simulator, so too much memory would be required. Make the delay smaller.
- Need to ground transmission line! - the bottom two wires of a transmission line must always be grounded in this simulator.
Browser and Computer Requirements
The simulator benefits a lot from having a reasonably fast computer. My Core i5 laptop from 2012 runs most circuits OK so it doesn't need to be the latest and greatest hardware but you'll probably find performance disappointing on older machines.
The capability to load and save files to the local disk requires HTML5 features that are not supported in all browsers. If the application detects the features required are not supported then some of the file options will be unavailable. Currently Chrome and Firefox support all the needed features.
Dropbox integration doesn't fully work on Firefox due to a bug in the browser. On Firefox you can only load shared links and not use the Dropbox browser or saver.
The simulator will run on tablets and even phones if they have a suitable browser and should work OK with touch interfaces.
Simulation != Real Life
Physics simulations are not real life, and don't assume that simulation and reality are identical! This simulation idealizes many components. Wires and component leads have no resistance. Voltage sources are ideal - they will try and supply infinite current if you let them. Capacitors and inductors are 100% efficient. Logic gate inputs draw zero current - not too bad as an approximation for CMOS logic, but not typical of 1980s TTL for example. By all means use this simulator to help visualize circuits, but always test in reality.
Sorry to break it to you folks, but the simulator numerically approximates models of components that are also approximate. Even without allowing for any bugs it is just a rough guide to reality. This simulator may be helpful for visualization, but used the wrong way any simulator can give a false sense of security. Some people don't really grasp this important concept - I've even had one user accuse the simulator of "lying" because he (or she) didn't take account of the component idealizations and didn't understand the actual performance of the components they chose to use. It's a key leaning for all electronic engineers that they must always be fully aware of real-world component (and system) characteristics and how these differ from any particular simulator they use. If you want more precise models of real-world components then the SPICE-based simulators are much more appropriate tools than this one, but even then, you should be aware of deviations from reality. As the great analogue circuit designer Bob Pease said "When a computer tries to simulate an analog circuit, sometimes it does a good job; but when it doesn't, things get very sticky".
One consequence of the use of ideal components is that the simulator doesn't converge on a result for circuits that have no defined behaviour - for example an ideal voltage source short-circuited by an ideal wire. Another situation that can't be simulated under these assumptions is the current distribution between the conductors if two perfect conductors are connected in parallel. When using the simulator you must account for places where real electronics differs from the ideal.
A quite frequently asked question is whether the simulation can be used offline. The TL;DR answer is "no" because the software tools we use don't enable it. Read below for more details.
If you really want to use the simulation offline you have two options:
- Dowload the pure Java version which is still available here. The limiation of this method is that the Java version has not been updated recently and lacks features in the current version.
- Set up a local web server on your computer. Obtain the source code using the link in "For Developers" (below), build, and arrange for the local web server to serve it to your browser. One way to do this is to use the debugging mode in Eclipse. The limitation of this method is that it is not a simple process and probably requires some familiarity with web development and hosting to make it work.
As the intended use of this application is online I do not provide any support for people trying to make use of it offline.
High Frequency Circuits
This simulator simulates the circuit using a series of short time steps. In each step the changes to the voltages and currents in the circuit are calculated based on the component models and the current circuit state. For this process to work the time steps used need to be significantly shorter than the duration of any event of interest in the circuit. Or, if you prefer, the time steps need to be significantly shorter than the period of the highest frequency signal of interest.
By default the simulator uses a 5µs step size. This is OK for audio frequency signals but not for radio frequency signals or fast digital signals. The step size can be changed from the "Other Options..." dialog on the options menu. For comparison, the transmission line example in the application uses a 5ps step size.
The step size shouldn't be confused with the "Simulation Speed" controlled by the slider in the right hand panel. The step size controls how long (in simulated time) each step is. The "Simulation Speed" slider controls how often (in real time) the computer calculates a step.
This application was developed, with permission, from the Java circuit simulator by Paul Falstad. I always found this a great tool to help visualize circuits and loved the interactive nature compared to normal SPICE implementations. However, I never really liked Java in the browser and with recent security problems and consequent changes in security policy by browser vendors it seemed to me that there would be a lot of benefit in having a version that didn't require plug-ins.
To create this version I modified the original Java to run in the Google Web Toolkit (GWT). Most of the user interface was rewritten but the technical parts of the simulation are almost untouched. The total work on this project took just over a month.
Thanks to the kind permission of Paul Falstad the source project for this version of the application is now available on GitHub under a GPLv2 license.
License Suitability for Purpose
The simulator is provided with no support or warranty. Absolutely no guarantee is provided of suitability for any purpose.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
For details of licensing see http://www.gnu.org/licenses/.