1

QUCS is the only open source software which offers simulation (and designing PCB layout [in future]) of electrical circuits. But the problem with QUCS is that it is under development and many important features are not yet available in it.

I want to simulate Arduino Uno board in it for my circuit. Does anyone know how to simulate Arduino or any other micro-controller in it?

P.S. Also any other open source software for simulation and PCB designing?

5
  • 1
    You don't usually simulate an Arduino. You simulate the types of things you're connecting to it.
    – Matt Young
    Commented Jun 18, 2015 at 12:19
  • Oshonsoft have a great AVR simulator. You will be hard-pushed to find an open source Arduino board simulator - especially as the board is nothing more than a crystal, power supply and user-friendly connectors. Hence the need for something that simulates the microcontroller at the specific board's core. The Oshonsoft simulator has almost everything you need to test code, and includes a full list of all registers and their values, viewable instruction by instruction. It's not free, but (in my view) the best you can get for your money. Commented Jun 21, 2015 at 11:51
  • 1
    If open source is a strict requirement than you can look at KiCAD for PCB design. You probably won't find a single piece of software that does both simulation and PCB design well.
    – user588
    Commented Jun 21, 2015 at 18:06
  • I think Labcenter Proteus is the best option to simulate an Arduino with miscellaneous Digital & Analog circutry so far...
    – Brethlosze
    Commented Feb 10, 2019 at 5:41
  • I'm confused this (wrong) answer is not corrected. KiCAD is mature open source EDA, with circuit simulator (SPICE) and pretty decent library of components - so you are not limited to passive circuits.
    – hardyVeles
    Commented Jan 15, 2020 at 22:15

5 Answers 5

3

Simulating a microcontroller's program is common, but not as part of a circuit, unless you're into Systems on Chips.

Model the micro interfaces and simulate the peripherals separately

Analog systems cannot be modelled accurately by hand calculations alone, therefore simulation is often a necessary step (on top of that, real circuits might behave differently from the model). Non-programmable digital systems are deterministic in their behaviour, but only if the interfaces are correct - tight specifications on impedances and such often mean simulation is required here as well. Generally speaking, for both simulation becomes a must when the system is not dead simple. Microcontrollers on the other hand are sufficiently deterministic not to require any simulation: they do what they're told, except in very very very rare cases (single event upsets from radiation for example). Now, what they're told might allow glitches to happen, but that's a different story*. Therefore, usually the analog, or digital circuits around a microcontroller would be given equivalent interfaces based on the microcontroller's behaviour and physical specifications, and simulated separately.

*: As the code becomes more and more complex, it gets more and more difficult to follow what the microcontroller might do. Unexpected glitches may arise from e.g. concurrent access (though I can't say this is common in the micro realm), or insufficient resources (that is why dynamic allocation [malloc,new] are highly discouraged, so that the resources allocation is known at compilation time) etc. That's usually why tests are required, and step-by-step debugging is used as a means to locate any error that arises. But inherently, microcontrollers are highly predictable and except in certain cases, it is not worth it to go through simulation (do not mix up simulations and tests, tests are always required!).

Advantages of microcontroller simulators

However, microcontrollers simulators do exist. They are particularly helpful to watch what happens inside the microcontroller when the code executes step by step: call stack, watches on variables, interrupt vectors etc. This can also be done on the actual hardware using in circuit debuggers, but simulators are cheaper and are also good to save on EEPROM erase/write cycles and to avoid damaging your micro if you are afraid that the devices around it might be incorrectly configured (some controllers are very expensive, especially if they are qualified for medical, military or aerospace applications). I have seen such ICD's and simulators for Microchip PICs (MPLABX), but there must be equivalents for AVR (the micro which is on the Arduino's), or perhaps even integrated in an arduino-friendly environment (though I doubt it). You might want to take a look here.

If you've got deep pockets: mixed signal simulators

Finally, there are mixed signal simulators which allow you to simulate analog, programmable and non-programmable digital circuits alike; one component will have an analog SPICE model, another a VHDL model, and ADC/DAC blocks will be added automatically by the simulator between those devices depending on the logic input/output technology you specify. Those are extremely expensive (the one I used is Cadence Virtuoso), you don't want to do that unless you're doing an integrated circuit or something critical.

P.S: DesignSpark PCB v3 has LTspice in it. Never tried that feature in there though, I used to use LTspice directly.

Note that your opening "QUCS is the only open source software [...]" is wrong. There are plenty of simulators out there which are open source. I agree QUCS is a very user-friendly one though.

5
  • Downvoted for opening your answer by lambasting the user for not knowing stuff. Commented Jun 18, 2015 at 14:34
  • True, I could have worded that better and not start with this. I am not judging what the author knows though: I just couldn't leave the author say such things as if they were a fact whereas a quick look online could have shown the opposite. People are reading. I have modified my answer to make it more like a note.
    – Mister Mystère
    Commented Jun 18, 2015 at 15:28
  • Fair enough then. I'm not sure I agree that "Microcontrollers on the other hand are sufficiently deterministic not to require any simulation", though - programs are deterministic, but we still test them. Commented Jun 18, 2015 at 15:30
  • Good point. There comes a time when determinism alone is not enough to ensure a program works properly: generally when it becomes complex (or if there may be synchronisation issues), or hogs lots of the controller's resources etc. I'm editing my answer to make it clearer.
    – Mister Mystère
    Commented Jun 18, 2015 at 15:34
  • Gets a +1 from me, then. :) Commented Jun 18, 2015 at 15:37
3

You can use 123d.circuits.io for simulation and PCB design for Arduino circuits.

See this one for example.

More generally, a previous answer states that Microcontroller based circuits are not simulated. Maybe that's true when prototyping costs are low (though I doubt it), but in an SoC or complex embedded system, microcontrollers certainly are simulated as part of the overall system.

Sometimes as a highlevel model such as a symbolic simulator or sometimes as a part of the overall mixed-signal simulation environment in which the digital part is usually simulated at RT level.

1
  • Either you haven't read my answer entirely, or my answer is not clear enough. There is a progression in it: first section is "for usual DIY projects", the second "when projects get bigger", the third "when requirements are tight and integration is extreme". 123D reminds me of fritzing, I didn't know it did Arduino simulation as well as schematic to wiring; interesting. I hated fritzing, but definitely interesting for those who like it. +1.
    – Mister Mystère
    Commented Jun 18, 2015 at 22:02
2

How to simulate Arduino? What is the best Arduino simulator?

Following are the main features of the Wokwi Arduino simulator:

  • It is free :)
  • Supports multiple file projects
  • Supports most of the famous Arduino libraries
  • Whatever compiles on the Arduino IDE will compile on the simulator
  • Supported by all browsers
  • Compiles with latest Arduino IDE
  • Supports FastLED and many other peripherals
  • No download or installation needed
  • Easy to share the code and project with just a single click
  • Smart - Code Autocompletion, Code auto-formatting are supported
  • Provides standard library demo examples
  • Project can be compiled on RUN on Mobile browsers as well
  • Tries to be closer to real circuits – Example – Button bounce like in real hardware
  • Supports Arduino Mega, Arduino Nano, Arduino UNO, ATtiny85
  • Supports assembly instruction execution
  • Provides LED power and FPS features for FastLED projects
  • Supports a plethora of Arduino peripherals for the project – Ultrasonic sensors, Slide switches, NeoPixel matrix, Potentiometer, Servo motors, SSD1306 OLED displays, temperature and humidity sensors, rotary dialer, membrane keypad and more
  • Serial monitor is supported as well

Website: https://wokwi.com


Here are a few examples

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

1

To add to the list of simulator answers, try out Micro-Cap 12. It was a few thousand dollars originally, but the company has ceased operations now and has provided it for free. Pretty cool.

0

Try this: simulIDE

Google: simulIDE for arduino picture

Supports also: PIC, ATtiny, ATR, Arduino...

Not the answer you're looking for? Browse other questions tagged or ask your own question.