Sie sind auf Seite 1von 19

Xevro

Users guide Arduino Simulator 1.4

2016

Users guide
Arduino simulator 1.4

Made by Marc Van Den Berge and Louis DHont (Xevro)

Warning: the computer must by connect to a Arduino UNO.

Xevro

Users guide Arduino Simulator 1.4

2016

1. Introduction

The Arduino UNO Simulator is made for quick testing of small projects. there is still further
developed in order to obtain the widest possible I/O functions. The Arduino Simulator is designed to
test a program quickly with the Arduino UNO without really having connections to external I/O
(buttons, potentiometers, display, power, ...).
Almost all of the I/O is present on the simulator so that we can test all of your programs on the
monitor screen.
To be use the simulator we need 2 programs.
The JAVA program
- The Arduino simulation program
The Arduino software
For the Java program, we need Java download on our PC or laptop, you can find the download link
on the website of Xevro.

Xevro

Users guide Arduino Simulator 1.4

2016

2. Arduino software
For we start with using the Arduino simulation program we need the Arduino software, it is also free available
on the website: http://arduino.cc/en/Main/Software












Because we work with a serial connection through the USB port of your PC or laptop, we also have a
USB driver that we can pick up the following websites:
For a 32bit processor use the RXTXcomm.jar and the rxtxSerial.dll


These two files need to stand on a specific place:

Example Java version 7 on a (86):


Xevro

Users guide Arduino Simulator 1.4

2016

3. Installing of the rxtxSeriall.dll and the RXTXcomm.jar


Attention:

If the rxtxSeriall.dll" are not set on the right place than will the simulator not
start.

Program Files

1. Install of the rxtxSeriall.dll (32 bit)

The rxtxSeriall.dll need to set under this address: C:\programFiles\Java\jre1.8.1_101\bin\


Always install on the highest version of Java.
2. Install of the RXTXcomm.jar

The RXTXcomm.jar need to set under this address:


C:\ProgramFiles\Java\jre1.8.0._101\lib\ext\

Attention: if there are 2 versions of the jre1.8.1_91 or_101 on your pc, then you need

to set the rxtxSeriall.dll (32 bit) always on the highest version.
In this case: C:\Program Files (x86)\Java\jre1.8.1_101\bin\

If we want to run the setup Arduino Simulator, you need to install the simulator in the folder
C:\ProgramFiles\ArduinoSimulator" because all documents referring to this folder.




Xevro

Users guide Arduino Simulator 1.4

4. Working serial message


Everything goes through serial communication (USB) between the Arduino UNO and the PC.
The BaudRate and COM port of the Arduino UNO and the simulator should be identical, if not then there
can no connection to be established between the two.
To be able to send and receive the data we have, we need to make a type of protocol or structure
design so that the PC and Arduino UNO know how to handle it all.

Examples Structure serial message between the Arduino UNO and Arduino Simulator (java)

1.

2.

3.

4.

5.

Receive digital input 1. (I0013)


Forehead: I00
Data: "0000" or "1111"
End of message: LF

Send digital output 1. (O0013)
Forehead: O00
Data: "0000" of "1111"
End of message: LF

Send Analog PWM output 1. (P035,6,9,10,11)
Forehead: P03
Data: 0 - 1023
End of message: LF
Receive Analog input 1. (A005)
Forehead: A00
Data: 0 - 1023
End of message: LF

Send Analog output Servo.


Forehead: S12
Data: 0 - 1023
End of message: LF

6. Sending Frequency Tone. (TF8)
Forehead: TF8
Data: 0 - 99999
(Hz)
End of message: LF

7. Sending Tone duration. (TT8)
Forehead: TT8
Data: 0 - 99999
(ms)
End of message: LF

8. Sending text. (txt)

LCD 2 rows
Forehead: txt
Data: 0 - 31
(char)
End of message: LF

9. Sending text. (tx1)

LCD top row
Forehead: tx1
Data: 0 -15
(char)
End of message: LF

10. Sending text. (tx2)

LCD lower row
Forehead: tx2

2016

Xevro

Users guide Arduino Simulator 1.4

2016

Data: 0 - 15
(char)
End of message: LF


Example with button 1:
If one of the "push 1" button on the screen will get this message to serial Arduino UNO as follows:
" I001111 " this means that the input 0 to "1" state, I00 is the first input as we work in the program input from 0
to 13.

Keep in mind so that " 0", the first input in the program.

Xevro

Users guide Arduino Simulator 1.4

2016

The Arduino program works with instructions that the I/O read and write this we must now convert to serial
communication means that we have to write these new instructions.

We do not want too much change the real instructions we have our new instructions given the same text but
instead a small initial letter, we have chosen to take this as a capital.
Example:

digitalWrite(12, HIGH);
become DigitalWrite(12, HIGH);

=> Serial message to the PC:

O121111

In the Arduino UNO next I/O instructions are adapted:


Using instructions, the first letter is now a case of removing the tip:

Instructions Arduino

Instructions Simulator

digitalWrite(x,y);

DigitalWrite(x,y);

attention: capital letter

digitalRead(x);

DigitalRead(x);

attention: capital letter

analogWrite(x,y);

AnalogWrite(x,y);

attention: capital letter

analogRead(x);

AnalogRead(x);

attention: capital letter

myservo.write(x);

myservowrite(x);

attention: the . remove

Serial.print(x);

Serialprint(x);

attention: the . remove

tone(x,y ,z);

Tone(x,y ,z);

attention: capital letter

noTone (x);

NoTone(x);

attention: capital letter

lcd.setCursor(x,y);

lcdsetCursor(x,y);

attention: the . remove

lcd.print(long x);

lcdLprint(x);

attention: the . remove

lcd.print(x);

lcdprint("x");

attention: the . remove

lcd.autoscroll();

lcdautoscroll();

attention: the . remove

lcd.noAutoscroll();

lcdnoAutoscroll();

attention: the . remove

lcd.clear();

lcdclear();

attention: the . remove

lcd.display();

lcddisplay();

attention: the . remove

lcd.noDisplay();

lcdnoDisplay();

attention: the . remove

lcd.blink();

lcdblink();

attention: the . remove

lcd.noBlink();

lcdnoBlink();

attention: the . remove

lcd.write(x);

lcdwrite(x);

attention: the . remove

lcd.rightToLeft();

lcdrightToLeft();

attention: the . remove

lcd.leftToRight();

lcdleftToRight();

attention: the . remove

lcd.home();

lcdhome();

attention: the . remove

Xevro

Users guide Arduino Simulator 1.4

lcd.cursor();

attention: the . remove

lcdscrollDisplayLeft();

attention: the . remove

lcdscrollDisplayRight();

attention: the . Remove

lcdcursor();

lcd.scrollDisplayRight(); =

lcd.scrollDisplayLeft();

2016

So we can just replace Arduino instructions into the simulator instruction and our newly written program
(Arduino sketch) testing with the simulator on the PC.
Afterwards, if the program is tested, one can Simulator instructions substituted back into the original
instructions of Arduino, leaving the real I/O Arduino UNO is functioning again. (Instruction turns orange).

attention:

Remember to adjust the 'Void Setup to initialize the real I/O!!



Example: pinMode (0, OUTPUT);

pinMode (1, INPUT);

To understand better performance are elaborated numerous examples.

In each sketch are the instructions changed, only the in and outputs connect on the screen.
Dont forget to select the Com-port! (Blink)

The coupling it inputs - and outputs can be found in the Arduino software.







With Restore you can store the settings for later:

Xevro

Users guide Arduino Simulator 1.4

2016

5. Preforming the Arduino UNO program



A new sketch (xxxxx.ino)

a. The Simulator UNO-program (. ino) and the Simulator library SimulatorProgram.h can found
under Help:

b.

a.

Start the Arduino UNO programming code application



Now you can set your own code into the arduino, if its upload in the arduino you can test it with
the Simulator.

Attention: The library SimulatorProgram.h stand by the Simulator.


Uploading of a new program to the Arduino UNO

Start the Arduino application

Open the sketch


Arduino UNO connecting with the pc:


Select board Arduino UNO
Select the serial port
Upload the program into the Arduino UNO



Opmerking: The BaudRate on the simulator is 9600.

Xevro

Users guide Arduino Simulator 1.4

2016

6. Configure the COM port



6.1 Set the BaudRate
The BaudRate is by default set to 9600.





6.2 Set the Com port
First you need to select the COM port of the USB port that is used by the Arduino. You can see which COM port
it is. (selected COM port turns red).

Before the selection

After the selection

Attention:
-

At start-up, we also see the state of the simulator at the bottom of the COM port:

Once you have selected the correct COM port changes to this text:

If you choose the wrong COM port or there is no Arduino connected than you get this message:






Xevro

Users guide Arduino Simulator 1.4

7. Use the digital I/O


7.1 Digital Inputs


-

The Arduino UNO has 14 digital I/O pins we can configure this pins into inputs or outputs I/O.
This pins get symbolic images as D0 to D13 and the text change red if its select.

We have 8 buttons, this buttons can set to one of the inputs D0 D13, After the
selection change the color green.

7.2 Buttons
-

When you keep pressing it send a 1 to the Arduino


No pressing send an 0 to the Arduino
With this button


There are text boxes to set a little information.

7.3 Leds
-

We have 14 leds, each led coupled to one output D0 D13.


After each selected led turns the combobox green.
There is a text box for comments.
If you click on the led you change the color of the led. Available colors: Red,
Green, Blue and Yellow.


7.4 Buzzer
-


The buzzer can select to a digital output of D0 D13.
When we send a signal on the output pin we get 1 second sound.
The pitch can be changed with using the slider. (0 - 10KHz)
There is a text box for comments.

2016

Xevro

Users guide Arduino Simulator 1.4

2016

7.5 7 segment Display


-

The display will be automatically connecting to the outputs D0 descriptor D6 (D7 = DP


not used)

Depending on the type of display can be choose common Anode or common


cathode.



8. Use the Analog I/O


The Analog I/O



8.1 Sliders
-

There are currently 3 present sliders that can be separately


coupled to each of the six analog inputs A0A5
(value of 0 <-> 1023)
The analog value can be read on the simulator.
There is a text box for comments.
The combobox change into yellow after selection.



8.2 Sound detector
-

The sound detector may be coupled to one of the 6 analog inputs A0A5 (value of 0 <-> 1023), The combobox
change into yellow after selection.
This detector records no sound just responding to a noise level adjustable with the slider.
Once the recording is started it will be nothing more to serve on the screen because it is continuously listened
to the microphone.
When the noise level is exceeded, the progress bar will show the noise level in percent.
Once detection has addressed this value is (value of 0 <-> 1023) sent to the Arduino, which can also be read on
the simulator.








Xevro

Users guide Arduino Simulator 1.4

2016

9. The analog Outputs


9.1 Slider / Bar


-

There are 2 analogue outputs which first met slider and one filled progress bar
Both of these outputs can be coupled separately to one of each analog output 6 PWM 3, 5, 6, 9, 10 and 11
(value of 0 <-> 1023)
The combobox change into pink after selection.
There is a text box for comments.
The analog output can be read on the simulator.






9.2 Sound generator
-

The sound generator can be coupled to one of the 6 analog outputs PWM 3, 5, 6, 9, 10 and 11
(value of 0 < -> 1023)
The combobox change into pink after selection.
There is a text box for comments.
The analog output of the Arduino can be read on the simulator.





9.3 Servo
-

The servo is automatically connecting to the output D12 after pressing on the button.
There is a text box for comments.
On the big screen we can see the analog output value (servo mode) from the Arduino UNO.








Xevro

Users guide Arduino Simulator 1.4

9.4 LCD display


-

The display is paired automatically connect to the outputs D4-7 and D11,
D12
The display has 2 rows and functions almost like the real display.

Attention:
The difference with the real display is the bottom row starts from right to
left, this one should keep in mind during programming. Its also not possible
to separately control the pixels.

9.5 Tone Melody


-

The Tone Melody will automatically connection to the output D8.


Through the Arduino UNO can send a note to the PC which one can read
the frequency and duration. You can use this for example in order to
create a mini piano by means of the 8 input buttons.

Attention: No double use of I/O possible if this happen then we get this message:















2016

Xevro

Users guide Arduino Simulator 1.4

2016

10. Squarewave generator


The squarewave generator can connect to one of the 6 inputs A0 A5, this inputs (A0 A5) need
to decelared in a digital input.

The squarewave generator can make a squarewave with a frequency of 0,1 to 10Hz.

As soon as you press the button, er come a slider where you can set the frequency of the square
wave.

Attention: The instruction for the squarewave generator is DigitalRead().


Attention:
No double use of I/O possible if this happen then we get this message:

Xevro

Users guide Arduino Simulator 1.4

2016

11. Few things while preparing Arduino program


- Always upload the sketch to the Arduino UNO.
-Because now the simulator is connecting to the COM port, we cannot upload the Arduino program. Requires a
-tool developed 'Disconnect' which closes the COM port of the simulator so that the com port has become
available and you can upload the sketch to the Arduino UNO.
The great advantage of this is that we dont need to shut down whenever we want to upload the sketch simulator.
After downloading the simulator, we connect again with the COM port and we initialize the I/O.

Disconnect COM port



COM port choose

Initialization after connecting

Xevro

Users guide Arduino Simulator 1.4

2016

12. Save and Restore of settings


With "Save" you can save your selected I/O and dictated texts.
the Restore button you can retrieve the settings.
We can save the filename of the extension with *.sav or *.txt.

Save

Restore


Example settings Parking: - 2 buttons, 2 Leds, 1 display, 1 servo, 1 progress bar,

Xevro

Users guide Arduino Simulator 1.4

13. Screen resolution


We have 4 options:
Resolution: 1024 x 768
-

Resolution: 1336 x 768

Resolution: 1920 x 1080

Variable resolution (min: 500, max: 2000)


Input Screen Resolution (attention: when you give a number you need to press
ENTER)

2016

Xevro

Users guide Arduino Simulator 1.4

2016

14. Languages

We can choose the Languages: Dutch or English.

15. Instructions
The instructions stand under: Instructions Arduino UNO Simulator in Help: