Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Using hardware post and replies

Return to the Using hardware thread
Login to post to this thread

Using Arduino boards with EJS - Feb 2, 2013 at 11:55AM
Francisco Esquembre
144 Posts

EJS has now new a Model Elements to control Arduino boards.

The best way to learn how to use it is to inspect an examples. See attached zip with an example.

Before you start, you need to download and install Arduino standard software from http://arduino.cc/en/Main/Software. This allows you to install the drivers for your computers AND install in your Arduino board the script StandardFirmata. Both things are a must before using the example attached. You install the script by running the Arduino software and selecting "File->Examples->Firmata->StandardFirmata. Then, click the "Upload" icon (looks like a small right arrow) in the task bar of the Arduino software. This step needs to be done only once (per board).

Now, open the attached Arduino example in the latest EJS and inspect the example (in particular, the Model -> Elements tab).

You need additional hardware for making things work. The boards just act as I/O boards. Whatever software you attach to them makes the real work. But if you are playing with these boards, you know this already.

Good luck!

Paco

Attached File: ejs_Arduino_LedTempServo.zip


Replies to Using Arduino boards with EJS

Re: Using Arduino boards with EJS - Mar 25 2013 8:03PM
Diego Racero
11 Posts

Hi Franciso, I`m now experimenting wiht Arduino Leonardo and I have a question.
In your example you're using linux and the following sentence

arduino.connectSerial("/dev/tty.usbmodem1421")

Should ¡ld I replace It for

arduino.connectSerial("COM6")?

Because I'm using windows and my Arduino board was installed in COM6 and connected through USB port.

Thank in advance for your help.



Re: Re: Using Arduino boards with EJS - Mar 26 2013 3:45AM
Francisco Esquembre
144 Posts

Yes, that should be it. Remember to install the Arduino drivers.
I don't think we have tested the Leonardo board, though...

Paco



Re: Re: Re: Using Arduino boards with EJS - Mar 27 2013 8:48AM
Diego Racero
11 Posts

Paco, thank you for your help. I replaced the line you suggested and It works perfectly well.
I used the temperture example but with some modifications because I´m tryin to perform a remote laboratory turning on and turning off a laser diode and illuminate a difraction slit.
Now I´m moving to work in the Moodle integration.

Surely I´ll be requesting for your help again.

Thank you very much in advance for that.



The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics