Simulate PIC and Arduino/AVR Designs with no Cloud

I’ve always appreciated simulation tools. Sure, there’s no substitute for actually building a circuit but it sure is handy if you can fix a lot of easy problems before you start soldering and making PCBs. I’ve done quite a few posts on LTSpice and I’m also a big fan of the Falstad simulator in the browser. However, both of those don’t do a lot for you if a microcontroller is a major part of your design. I recently found an open source project called Simulide that has a few issues but does a credible job of mixed simulation. It allows you to simulate analog circuits, LCDs, stepper and servo motors and can include programmable PIC or AVR (including Arduino) processors in your simulation.

The software is available for Windows or Linux and the AVR/Arduino emulation is built in. For the PIC on Linux, you need an external software simulator that you can easily install. This is provided with the Windows version. You can see one of several videos available about an older release of the tool below. There is also a window that can compile your Arduino code and even debug it, although that almost always crashed for me after a few minutes of working. As you can see in the image above, though, it is capable of running some pretty serious Arduino code as long as you aren’t debugging.

Looks and sounds exciting, right? It is, but be sure to save often. Under Linux, it seems to crash pretty frequently even if you aren’t debugging. It also suffers from other minor issues like sometimes forgetting how to move components. Saving, closing the application, and reopening it seems to fix that. Plus, we assume they will squash bugs as they are reported. One of my major hangs was solved by removing the default (old) Arduino IDE and making sure the most recent was on the path. But the crashing was frequent and seemed more or less random. It seemed that I most often had crashes on Linux with occasional freezes but on Windows it would freeze but not totally crash.

Basic Operation

The basic operation is pretty much what you’d expect. The window is broadly divided into three panes. The leftmost pane shows, by default, a palette of components. You can use the vertical tab strip on the left to also pick a memory viewer, a property inspector, or a file explorer.

The central pane is where you can draw your circuit and it looks like a yellow piece of engineering paper with a grid. Along the top are file buttons that do things like save and load files.

You’ll see a similar row of buttons above the rightmost pane. This is a code editor and debugging window that can interface with the Arduino IDE. It looks like it can also interface with GCBasic for the PIC, although I didn’t try that.

You drag components from the left onto the circuit. Wiring isn’t a distinct operation. You just let the mouse float over the connection until the cursor makes a cross. Click and then drag to the connection point and click again. Sometimes the program forgets to make the cross cursor and then I’ve had to save and restart.

Most of the components are just what you think they are. There are some fun ones including a keypad, an LED matrix, text and graphic LCDs, and even stepper and servo motors. You’ll also find several logic functions, 7400-series ICs, and there are annotation tools like text and boxes at the very bottom. You can right click on a category and hide components you never want to see.

At the top, you can add a voltmeter, an ammeter, or an oscilloscope to your circuit. The oscilloscope isn’t that useful because it is small. What you really want to do is use a probe. This just shows the voltage at some point but you can right click on it and add the probe to the plotter which appears at the bottom of the screen. This is a much more useful scope option.

There are a few quirks with the components. The voltage source has a push button that defaults to off. You have to remember to turn it on or things won’t work well. The potentiometers were particularly frustrating. The videos of older versions show a nice little potentiometer knob and that appears on my Windows laptop, too. On Linux the potentiometer (and the oscilloscope controls) look like a little tiny joystick and it is very difficult to set a value. It is easier to right click and select properties and adjust the value there. Just note that the value won’t change until you leave the field.

Microcontroller Features

If that’s all there was to it, you’d be better off using any of a number of simulators that we’ve talked about before. But the big draw here is being able to plop a microcontroller down in your circuit. The system provides PIC and AVR CPUs that are supported by the simulator code it uses. There’s also four variants of Arduinos: the Uno, Nano, Duemilanove, and the Leonardo.

You can use the built-in Arduino IDE — just make sure you have the real Arduino software on your path and it is a recent version. Also, unlike the real IDE, it appears you must save your file before a download or debug will notice the changes. In other words, if you make a change and download, you’ll compile the code before the change if you didn’t save the file first. You don’t have to use the built-in IDE. You can simply right click on the processor and upload a hex file. Recent Arduino IDEs have an option to export a hex file, and that works with no problem.

When you have a CPU in your design, you can right click it and open a serial monitor port which shows virtual serial output at the bottom of the screen and lets you provide input.

The debugging mode is simple but works until it crashes. Even without debugging, there is an option to the left of the screen to watch memory locations and registers inside the CPU.

Overall, the Arduino simulation seemed to work quite well. Connecting to the Uno pins was a little challenging at certain scales and I accidentally wired to the wrong pin on more than one occasion. One thing I found odd is that you don’t need to wire the voltage to the Arduino. It is powered on even if you don’t connect it.

Besides the crashing, the other issue I had was with the simulation speed which was rather slow. There’s a meter at the top of the screen that shows how slow the simulation is compared to real-time and mine was very low (10% or so) most of the time. There is a help topic explaining that this depends if you have certain circuit elements and ways to improve the run time, but it wasn’t bad enough that I bothered to explore it.

My first thought was that it would be difficult to handle a circuit with multiple CPUs in it since the debugging and serial monitors are all set up for a single CPU. However, as the video below shows, you can run multiple instances of the program and connect them via a serial port connection. The only issue would be if you had a circuit where both CPUs were interfacing with interrelated circuitry (for example, an op amp summing two signals, one from each CPU).

A Simple Example

As an experiment, I created a simple circuit that uses an Uno. It generates two PWM signals, integrates them with an RC circuit and then either drives a load or drives a load through a bipolar emitter follower. A pot lets you set the PWM percentages which are compliments of each other (that is, when one is at 10% the other is at 90%). Here’s the circuit:

Along with the very simple code:

int v;

const int potpin=0;
const int led0=5;
const int led1=6;

void setup() {
Serial.println("Here we go!");

void loop() {
int v=analogRead(potpin)/4;

Note that if the PWM output driving the transistor drops below 0.7V or so, the transistor will shut off. I deliberately didn’t design around that because I wanted to see how the simulator would react. It correctly models this behavior.

There’s really no point to this other than I wanted something that would work out the analog circuit simulation as well as the Arduino. You can download all the files from GitHub, including the hex file if you want to skip the compile step.

If you use the built-in IDE on the right side of the screen, then things are very simple. You just download your code. If you build your own hex file, just right click on the Arduino and you’ll find an option to load a hex file. It appears to remember the hex file, so if you run a simulation again later, you don’t have to repeat that step unless you moved the hex file.

However, the IDE doesn’t remember settings for the plotter, the voltage switches, or the serial terminal. You’ll especially want to be sure the 5V power switch above the transistor is on or that part of the circuit won’t operate correctly. You can right click on the Arduino to open the serial monitor and right click on the probes to bring back the plotter pane.

The red power switch at the top of the window will start your simulation. The screenshots above show close-ups of the plot pane and serial monitor.

Lessons Learned

This could be a really great tool if it would not crash so much. In all fairness, that could have something to do with my PC, but I don’t think that fully accounts for all of them. However, the software is still in pretty early development, so perhaps it will get better. There are a lot of fit and finish problems, too. For example, on my large monitor, many of the fonts were too large for their containers, which isn’t all that unusual.

The user interface seemed a little clunky, especially when you had to manipulate potentiometers and switches. Also, remember you can’t right-click on the controls but must click on the underlying component. In other words, the pot looks like a knob on top of a resistor. Right clicks need to go on the resistor part, not the knob. I also was a little put off that you can’t enter multiplier suffixes directly in component values. That is, you can’t enter a resistor value as 1K. You can enter 1000 or you can enter 1 and then change the units in a separate field to Kohms. But that’s not a big deal. You can get used to all of that if it would quit crashing.

I really wanted the debugging feature to work. While you can debug directly with simuavr or other tools, you can’t easily simulate all your I/O devices like you can with this tool. I’m hoping that becomes more robust in the future. Under Linux it would work for a bit and crash. On Windows, I never got it to work.

As I always say, though, simulation is great, but the real world often leads to surprises that don’t show up in simulation. Still, a simulation can help you clear up a host of problems before you commit to heating up the soldering iron or pulling out the breadboard. Simuide has the potential to be a great tool for simulating the kind of designs we see most on Hackaday.

If you want to explore other simulation options, we’ve talked a lot about LTSpice, including our Circuit VR series. There’s also the excellent browser-based Falstad simulator.

15 thoughts on “Simulate PIC and Arduino/AVR Designs with no Cloud

    1. I agree, but those prices are out of range for most hobbyists. $250 for AVR support is pretty reasonable for a commercial user, but that’s still gonna be way too high for most tinkerers. The other cores are considerably more expensive, as well. Looks very cool and I’ve heard other people say it’s awesome, but it’s more of a tool for semi-professional use.

      1. It would be good for business, if they made it free for hobbyists. That’s what I would do: addict them to my tool set and squeeze the money out of them when they want to sell their design. Microsoft did that with Windows and Office by letting everyone to use the same twenty license codes all around the world…

  1. “I’ve always appreciated simulation tools. Sure, there’s no substitute for actually building a circuit but it sure is handy if you can fix a lot of easy problems before you start soldering and making PCBs.”

    One of these days someone will integrate simulation with a Maxitronix 200-in-One kit.

  2. It would be nice to play with these simulators if they could do more then the basics.
    I’m going to complanabit here.

    It would of been nice if you could use more then 1 mcu.
    It would also would of been really really cool if it had the ESP8266 in it.
    Me I like to use more then one processor in a project because they are so so cheep now. Why not.
    A lot of the time I don’t even use the WiFi on the ESP8266 so I can crank the clock right up there.

    At least there are some out there.
    And I hate any full demo for 30 days. Or no saving.

    And I want it all (FREE)!
    Just kidding.. :-}

  3. FYI: SimulIDE_0.2.8-SR1-Sources.tar.gz builds and runs on LMDE2 64bit (Linux Mint Debian) with a 4K screen, once you install the required dependencies, error messages will let you know what you are missing, otherwise you are out of your depth and should use a distro that the appimage runs OK on. N.B. I have not tested all features.

  4. Nice review.

    Looks like you found a few problems:
    Font size issue and tiny pot is weird, would be nice to know your graphic configuration.
    Looks like you see components too small, perhaps very high dpi screen?
    I will try to reproduce it and find a solution.

    Debugging and simulating at same time not working very well is not strange, debugger is a new feature, is useful for simple cases and is a good practice debug just parts of the code at a time to see if it is working as expected, but crashing should be solved in any case.

    I’m curious about non-debugging crash, i cannot make it crash easily even if i try hard. If you find a case please report it.
    Also: “Sometimes the program forgets to make the cross cursor”. Cannot reproduce this issue.

    About speed, you choosed probably the worst case: microcontroller + bjt in emitter follower configuration. op-amp as voltage follower for example would be much faster, probably real time.
    You could also improve speed in this case by changing some simulation settings.

    Best way to get bugs solved is reporting them:

    Saving state of plotter an serial monitor is a good idea, i will add to feature request.

    Anyway very complete review, and very useful to see what problems users find.


    1. My screen is 4K. I will have to try running it under Xephyr to see if it looks better. I’ll have to try to document where some of the crashes are when I have a few minutes. And yes I deliberately picked a hard case ;-)

      1. You already documented some of the problems in your article and it has been very useful.
        Thanks to your “hard case” i found a big issue about debugging and simulating at same time. I’m working on it right now. I also have to address the screen issue.

        It’s very time consuming locating exactly where some crashes happen, report and then maybe answer questions from developers and so on.
        So i appreciate a lot when someone takes the effort to do it and i understand that there is not many people willing or having the time to do so.
        But this is the only way that a project like this can reach a good level of usability.

  5. Will have to take a look… I’m always fighting with ICE like some William Gibson protagonist though… seems I’m almost never trying to do an all new part design, always some obsolete or high obtanium factor surplus that there’s no model for.

    Discovered the other day, (not the one Eagle is shutting down) which is more or less a store front to get you to buy a kit of the bits, but doesn’t seem too obnoxious for all that.

  6. I think that the best aproach to program the Arduino is to use a Virtual Serial Port. I don’t know if is possible to the simulator create its own COM port to the Arduino IDE connect, but if is not, using COM0COM can solve it. SimulIDE already have a way to open a COM port, but I didn’t tested if is possible to connect to a virtual COM bridge, upload the bootloader firmware to the Arduino and use Arduino IDE to program and open Serial Monitor (SimulIDE’s serial monitor has few options and lack for a configuration to send CR e LF). The advantage of embedded IDE is debugging, but with so many bugs, it might not be worth the effort.

    I use a software called “PICSimLab”, that is very simple. It has some PIC development boards and the Arduino UNO. There are just a few peripheral, and you can’t assembly the circuit like SimulIDE. The main advantage, in my opinion, is the possibility to program the Arduino using Arduino IDE and the COM0COM virtual port.

    I keep following closely the development of both softwares, they are great freeware options and are evolving at full speed.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.