Arduino "How To's" Index     Delicious.Com Bookmark this on Delicious    StumbleUpon.Com Recommend to StumbleUpon

A free Windows simulation of an Arduino Uno

I'm delighted to say that there is a free simulator of the Arduino Uno out there! Anyone with a Windows computer can "play with" an Arduino. Teachers can show them to pupils, and let pupils play with one. No expense. No "barrier to entry" in the form of mastering the fiddly bits of hooking bits up. No danger of damage to equipment. This splendid, major, contribution to us all comes from Stan Simmons, formerly of the Department of Electrical and Computer Engineering at Queen's University, Kingston, Ontario, Canada.

-

Now... get "excited", but not "all excited". It WILL let you play with switches, sliders, buttons, LEDs, etc. I won't, alas, let you set up an Arduino hosted webserver for environmental data logging or home security!

But for the beginner and educators this is a great opportunity.

Catch your simulator

Go to http://www.sites.google.com/site/unoardusim/. Read what's there, and use the menu at the left (there) to go to the simulator's page.

Once there, do not rely on intuition and experience to do the download. Take note of the advice in the following...

-

... for which a vote of thanks goes to Graham Leach, Visiting Lecturer, Hong Kong Polytechnic University, who posted it in the relevant thread at the Arduino forum... and ended a long "can't download" discussion!

Create a folder where ever it suits you.

Unzip the contents of what you downloaded into that folder.

Double-click on the "" you should find there... and, presto, your simulator will be up and running. (The UnoArduSim.exe file is the program, not a "setup" program. You will have to create your own shortcut for launching it, if you want one.)

Go play!... or struggle on through the rest of this which is neither well written, nor heavily edited. It merely recounts some of my experiences playing with the simulator, and mentions a few things I "stumbled" over. None of them were serious problems.

It works! Hurrah! At last... a simulator for Arduino for those times when the real thing isn't ideal. And free!

Barely-edited bits and pieces....

Once I had the simulator running, I....

"Hooked up" a push button to input 3 by filling in 3 in the edit box in the "Push" box, upper left of the "hardware" half of the screen.

"Hooked up" a piezo element to input 13 by filling in 13 in the edit box in the "Piezo" box, lower left of the "hardware" half of the screen.

(I put the piezo on input 13 because the Arduino often has an LED on that pin, onboard. The one in the simulation does too.)

Discovered two things...

a) The piezo element isn't a self-oscillating buzzer... if you want a buzz, you have to send a train of high/ low/ high/ low... to it. About 10ms cycle will do. If, as I did (see below) you assume it to be self-oscillating, you WILL at least get a "click".

b) The "Push" (button) element is more than just a button, and not necessarily a NO button to ground with a pull up resistor. (And you don't need to enable the internal pull ups.) The radio buttons in the push element box let you take care of everything necessary to connect something which when pushed (put mouse pointer on it, hold down mouse's button) will drive the input high or low, depending on radio button choice. And the input will go to the other state when you release the button. (I don't know of a way to press more than one PUSH button at a time, but there are some toggle switches, called "slide" switches... the red rectangles with white square, and legend "R=1k")

Modified the code as necessary....

(Don't be distracted by the bit at the bottom of the code boilerplate talking about the implicit main(). (If you know a bit about Arduinos and C, the note may interest you.))

Note: You need to "go into editing mode"... use "File|Edit/View" (And then "Adopt" to get out of that.)

Note that instead of tooltips, there is a label in the status bar, bottom of screen, to tell you what the various buttons do, e.g. the "Step Over" button.

(To edit code, use the menu item File|Edit)

(You can't access "Copy" with a right-click... but ctrl-C works)

void beep()
{
  for (int c1=0; c1 < 21; c1++)
   {
      digitalWrite(13,HIGH);
      delay(10);
      digitalWrite(13,LOW);
   }
}

void setup()
{
   count=0;
   pinMode(13,OUTPUT);
}

void loop()
{
   count=count+1;
   if (digitalRead(3)==HIGH)
     {beep();}
   else
     {digitalWrite(13,LOW);}
     delay(100);
}

Gotcha 1...

It won't "just start" after a code edit... you have to click execute again. Not a "flaw", just something to remember.

Gotcah 2...

If there is a syntax error in the code, the message doesn't scream at you... but it is there, lower left... and an error will make "execute" unavailable. The simulator hasn't crashed!

And it Just Worked!

The simulation has a lot to offer...

The features which caught my eye were...

Input...

The normal serial monitor seems to be available... hurrah: This is a much under appreciated tool. (Well, ** I ** don't use it as much as I should do. Maybe you do?)

I've given the serial monitor a SLIGHT test... sadly, the area on the screen for displaying output over that channel is very limited (a small box on the "SFTSER" box... but it is enough to learn a lot about using the serial monitor, do useful debugging, and play with "traditional" programming, but in an Arduino context.)

Output: (most untested by me at this time... I had to write this for you, didn't I?)

The simulator also gives you a "watch" window, something you don't have available to you with a real Arduino!

All in all... a great tool for Arduino teaching!! Or for general teaching, with a look at something "a bit different", without the need for investing all that it would take, in money and time, to give your kids a taste of working with microprocessors.

Please try it! Tell others about it! Tell me what you think!!



   Search this site                 powered by FreeFind
 
Site Map    What's New    Search


Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, Sheepdog Software (tm), download something, and circulate it for me? At least (please) send an 'I liked the parallel port use page, and I'm from (country/ state)' email? (No... I don't do spam.) Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.

Don't forget to check out the programs for controlling the state of the parallel port at my shareware site. There are two free programs there... one for toggling bits, the other for using the computer as a timer via the parallel port.


Here is how you can contact this page's editor.
Click here to go up to general page about electronics by editor of this page.
Click here to go up to general page about electronic projects by editor of this page.
Why does this page have a script that loads a tiny graphic? I have my web traffic monitored for me by eXTReMe tracker. They offer a free tracker. If you want to try it, check out eXTReMe's site. The Google panels and the search panel are also script based.

Valid HTML 4.01 Transitional Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. Mostly passes. There were two "unknown attributes" in Google+ button code, and two further "wrong" things in the Google Translate code. Sigh.


....... P a g e . . . E n d s .....