Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to start the development of some basic Arduino projects but I don't own an Arduino board yet. Is there a way I can write my code and emulate/test it using a desktop computer so after my board arrives I just have to upload and run my project on it?

share|improve this question
    
I’m interested too, did you find one that plays well with the Arduino IDE? that is, detected by the IDE as if it was a board, with all its functionality. – rraallvv Apr 11 at 16:32

12 Answers 12

up vote 65 down vote accepted

There are a whole slew of Arduino simulators out there, many free, and some paid products as well.

  • The CodeBlocks Arduino development environment includes a free Arduino simulator, still under development but functional.
  • Simuino simulates the Arduino Uno and Mega pins - not a pretty-looking realistic simulator, but it works.
  • The Python based Arduino Simulator is another option, that plays well with the official IDE
  • Virtronics Simulator for Arduino looks promising, but I don't see why I would pay $14.99 for it, when I could buy one or more actual Arduino clones for that price

Many other Arduino simulators are out there if you search, and new ones are being announced, even crowdfunded, all the time.

share|improve this answer
5  
as a note, those are not emulators but simulators, the most important difference is that it does not run the code on a AVR virtual machine (like what qemu does), but binds the Arduino functions to native code. So basically they won't be able to run native AVR stuff and register/timer behavior will not be the same as on real AVR hardware. See the difference well explained in that answer. It is, though, theoretically possible to emulate Arduino Due code with qemu. – zmo Mar 13 '14 at 19:33
2  
You "don't see why [one] would pay $14.99 for it, when [one] could buy one or more actual Arduino clones for that price"? I can tell you why: because the hardware doesn't have a built-in debugger with the features that can be provided by a simulator. – R. Martinho Fernandes Jul 16 '14 at 22:16
5  
The Arduino Simulator piqued my interest, but unfortunately appears to have no files related to it on the sourceforge site. Am I missing something, or has it become deprecated since you wrote your answer? – Greenonline Feb 21 '15 at 17:46
    
As noted in above comment, there are no files in the arduino simulator source forge site. Is there a website for it or is there another simulator that works well in mac, with official IDE? – gordanvij Mar 27 at 15:28
    
Simuino is terrible, unprofessional and useless. They have no clue how to code. Arduino Simulator has no releases. CodeBlocks is Windows only. Simulator for Arduino isn't open-source. – Barry Apr 25 at 2:03

I like to use 123dcircuits.io for this.

It's cloud based and has some nice features including PCB design and collaboration.

IMO the Arduino simulation and capability is impressive and intuitive.

share|improve this answer
2  
It is very nice and clean and basic functionality is really impressive, easy to use and powerful. However many common parts (including LCD and temperature sensors) are not supported yet. I doubt you can test anything but very basic designs at this stage. I hope this will get better over time. – Suma Aug 7 '14 at 14:07
    
I gave it a quick try and found it very impressive for a free product. I don't know its limitations in terms of simulation realism, but the editor is very friendly and just placing a led into the proper slot automagically created code with the correct pin and a blinking loop! – heltonbiker Mar 26 '15 at 20:20
    
even my choice would be 123d but my only complain about this site is they don't add new components. It would be really great if they can have some new components on their list – KD. Oct 7 '15 at 13:41

Plenty of options exist in the world of electronics simulators, but 123D Circuits Electronics Lab is probably the most versatile one out there.

  • You can compose your circuit on a virtual breadboard which looks just like real.
  • You can actually watch a LED blinking or press a button during real-time simulation rather than struggling with abstract waveforms.
  • You can combine digital devices like a 555 timer or shift registers with (interactive) analog components like resistors and LEDs.
  • You can program an Arduino and simulate the microcontroller together with your analog circuit around it.
  • You can debug an Arduino: when the simulator reaches your breakpoint, the simulation is paused and you can easily check every variable in your code and every voltage or current in your circuit.
  • You can use and observe different communication protocols like UART, I2C and SPI.
  • You can pause the simulation in the middle of an I2C sequence by putting a breakpoint in the driver code (e.g. interrupt service routine for I2C events)
  • It's FREE!

enter image description here

This is an example circuit that has with an IR Remote and an LCD Screen.

Disclaimer: We are the makers of 123D Circuits

share|improve this answer
    
How does it play with the Arduino IDE? would it be available to flash, debug, etc? – rraallvv Apr 11 at 14:14

Yes you can, try using Proteus ISIS for simulating your code...
For full emulation of Arduino, there is shareware program called VBB, I tried it too and it was nice. You can find it here

share|improve this answer

You can use Yenka (free for home use) to simulate Arduino, PIX, PIXACE and other boards with digital, analog and serial I/O. It provides a lot of components and sample projects.

Screenshot:

Yenka Arduino simulation

share|improve this answer
    
Can it be programed, debugged from the Arduino IDE? – rraallvv Apr 11 at 14:17

Be aware that no simulator will reproduce real-life situations. There have been plenty of posts on the Arduino forum about problems with code or electronics, which turn out to be something subtle, such as:

  • Timing issues
  • Race conditions (related/dependent events not always happening in the same order)
  • Voltage levels, eg. floating input pins
  • Driving motors which drop the Arduino voltage enough that it resets
  • Not having decoupling capacitors
  • Input pins being in an "undefined" state (eg. 2.5V on a pin where 2 or less V is LOW and 3V or more is HIGH)
  • Problems with interrupt handlers, such as variables not being declared volatile
  • Voltage spikes due to not having flyback diodes on motors
  • The processor resetting once more than 10 LEDs are turned on because the current draw exceeds the amount the hardware can supply
  • Interrupt handlers taking 10 µS to process an interrupt when only 9 µS is available.

By their nature simulators can't reproduce all of this. Even if they could, would you think to toggle the "insert random noise from motors" option?


As for getting ready for the board to arrive, download the IDE and start programming. You can get libraries installed, code written and free of syntax errors, organize it neatly, and be generally ready for the big day when the hardware is in your hands.


Have fun and enjoy experimenting with your Arduino!

share|improve this answer

Try Simulator for Arduino - it is the best but then we are biased since we are part of the development team. Not everyone wants to pay $14.99 although almost 5k Arduino users have in the last few years. There is a free version of Simulator for Arduino which runs for 30 days or 100 sketch loads and 150 lines max. Try this and then buy if you can afford it and/or if it seems worthwhile. If there is something not right or which could be improved, let us know - everyone else does and has which is why Simulator for Arduino has been 99% built by user ideas and bug reports. Timer interrupt and 7 segment LED display coming in v0.99E

Also, the only other program we have tried which comes close in quality is Proteus but this is a full PCB design studio and looks to be very expensive - ie much more than $15. And we plan to ignore a recent user request to increase the price to $200.

share|improve this answer

Virtualbreadboard has a new VBB4Arduino 'Two Arduino's' edition which includes BOTH a JVM Arduino emulator AND a AVR Instruction set simulator with examples that cover almost all of the Arduino distribution examples and a bunch of peripheral hardware - LCD's, WS2812 Neo LEDS, Motors, Servo's, Logic Analyser and more.

http://www.virtualbreadboard.com

Disclaimer: I am the author of Virtual Breadboard

share|improve this answer

You could e.g. use my simulator. It is especially suitable for PLC-like applications, where multitasking is achieved by cyclic evaluation of interconnected circuit-like objects: Timers, Markers, Latches, Oneshots and Registers. You can use it to simulate your controlled system as well, as becomes clear from the examples in the download. It has modest visualisation capacities, can draw timing charts, and allows you to access and alter c.q. force all variables in real time during a running simulation. Also you can freeze time. When you're satisfied with the behavior of your control it generates the C code to be uploaded to an actual Arduino.

https://pypi.python.org/pypi/SimPyLC

share|improve this answer

I believe this website has a list of both emulators and simulators along with their price and availability.

Update:

Since some users mentioned there are broken links in that website, here's a selection of emulators I found. Note that some descriptions may have been taken from the mentioned link:

  • Emulino: Is an open source linux based software in early development that emulates Arduino-specific MCUs.

  • Emulare: is a general purpose hardware emulator. It aims to provide a central interface to build electronic simulations for embedded software development. At present emulare focuses on the ATMega line of microcontrollers (Arduino UNO has the ATMega processor).

  • SimAVR: is a new AVR simulator for linux, or any platform that uses avr-gcc. The simulator loads ELF files directly, and there is even a way to specify simulation parameters directly in the emulated code using an .elf section. It supports emulation of many ATMega processors and it is mentioned that it's easy to even add new ones.

  • Amtel Studio: This doesn't seem to mention the term emulation, but it is a sophisticated IDE to debug your code for many platforms specially Arduino. Atmel Studio 7 features seamless one-click import of projects created in the Arduino development environment. Your sketch, including any libraries it references, will be imported into Studio 7 as a C++ project. Once imported, you can leverage the full capabilities of Studio 7 to fine-tune and debug your design. Atmel Studio 7 fully supports the powerful embedded debugger on the Arduino Zero board. For other Arduino boards, shield-adapters that expose debug connectors are available, or switch to one of the many available Xplained-Mini/PRO boards to fully leverage the Atmel HW eco-system.

You can still use simulators such as EasyEDA to test your code and in most cases be able to run it on the device. But note that given the nature of electronic components, you may have to provide external resistors, capacitors etc to get the expected results.

share|improve this answer
    
Link only answers not a good thing here because they will be useless when the linked site goes down. Please write a summary and also make sure that your answer adds value and not just repeating the ones we already have. – totymedli Jan 20 at 18:54
    
I agree with @totymedli - if that link goes dead the answer becomes useless. Please summarize, at least, the emulators mentioned and the current price. You can start lines with an asterisk to make bullet points, if that helps. – Nick Gammon Jan 20 at 20:07

We have been using 123D circuits in a high school for this semester. It's a very good product except in the past two weeks, it's been, at times, difficult to get in to their website. My students end up waiting and I couldn't conduct lessons.

Tonight it still won't let me or my students in. We are using Arduino UNO for a robotics class. Because of these difficulties, getting to my files, on 123D circuits, I am now searching for another simulator to consider for the class.

share|improve this answer

Yeah you can. There is lots of Arduino simulation software which will help you program on Arduino without actually having a physical board. This software even provide add ons like various sensors and all. I found it useful.

share|improve this answer
2  
Hi, welcome to Arduino.SE. Your answer is very broad and doesn't really add anything new to the current answers. Could you give examples and more details to your answer, because at its current form it doesn't meet our guidelines. – totymedli Sep 23 '15 at 12:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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