0

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?

  • 1
    You don't usually simulate an Arduino. You simulate the types of things you're connecting to it. – Matt Young Jun 18 '15 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. – CharlieHanson Jun 21 '15 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 Jun 21 '15 at 18:06
  • I think Labcenter Proteus is the best option to simulate an Arduino with miscellaneous Digital & Analog circutry so far... – Brethlosze Feb 10 '19 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 Jan 15 at 22:15
2

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.

| improve this answer | |
  • Downvoted for opening your answer by lambasting the user for not knowing stuff. – Nick Johnson Jun 18 '15 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 Jun 18 '15 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. – Nick Johnson Jun 18 '15 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 Jun 18 '15 at 15:34
  • Gets a +1 from me, then. :) – Nick Johnson Jun 18 '15 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.

| improve this answer | |
  • 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 Jun 18 '15 at 22:02
1

See my blog which will explain all steps at http://tutorial4you.weebly.com/blog/arduino-simulation-on-proteus

| improve this answer | |
0

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.

| improve this answer | |

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