APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

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

Using hardware

Return to the EJS Modeling forum
Login to post to this thread

Using your WebCam with EJS
Francisco Esquembre
237 Posts

EJS has two twin new View elements that can read the input from your laptop or web camera and display it on a DrawingPanel 3D. Both elements work similarly, if only the one for the local camera requires extra software. The icons for these elements are in the 3D Drawables -> Tools and utils palette and look like a circle with the AR letters inside them.

Using the whole AR (Augmented Reality) system is a bit complicated, and we (the authors of this new element) are planning to write a paper on it. But if you feel adventurous, here are the steps to run the attached example:

1- Download the GStreamer runtime libraries and unzip them to your EJS workspace "export" directory. This should create a gstreamer directory with four subdirectories inside it. You only need to keep the one that corresponds to your operating system (though I keep them all, just in case). The copy I use of these libraries is a 100 MB file you can download from my site at  http://fem.um.es/EjsWiki/uploads/Download/ARsystem/gstreamer.zip

These libraries are needed to run properly the AR view element that uses your local camera.

2.- Download the 500KB data.zip file at http://fem.um.es/EjsWiki/uploads/Download/ARsystem/data.zip

This file has alternative configuration files for your particular camera. The one in the example works well for the buil-in camera for the latest 15'' Retina Mac Book Pro.

The file also has a directory with the patterns that the AR system can recognize. Print the ejs.pdf file in a white piece of paper.

(Begin Update)
3.- Edit the "Port" property of the ARSystem View element to match the camera you want to use.
- On a Mac, Port should be "0" for the built-in camera, "1" for a USB camera.
- On a Windows machine, you can get the exact name for your camera from the "Control panel -> Device administrator -> Image devices". (I am freely translating these names, since my Windows is in Spanish. :-) )
(End Update)

4.- Now, run the EJS example attached, and hold the EJS marker (the one you printed) in front of your laptop camera. The program main panel should show the video from your camera showing you, the EJS marker you hold in your hand, and a red rectangle surrounding the EJS marker.

Phew! That was a long explanation.

Good luck!

Paco

Post edited February 3, 2013 at 11:31 AM EST.

Attached File: ejs_MatchTheMotion.zip


Current Replies - View all
Re: Using your WebCam wit...   (Diego Racero - )
Re: Re: Using your WebCam...   (Francisco Esquembre - )
Re: Re: Re: Using your We...   (Francisco Esquembre - )
Re: Re: Re: Re: Using you...   (Diego Racero - )
Re: Using your WebCam wit...   (Diego Racero - )
Re: Re: Using your WebCam...   (Francisco Esquembre - )
Re: Re: Re: Using your We...   (Diego Racero - )
Re: Re: Re: Using your We...   (Diego Racero - )
Re: Re: Re: Re: Using you...   (Francisco Esquembre - )
Re: Using your WebCam wit...   (jorge almiƱa - )
Using Phidgets boards
Francisco Esquembre
237 Posts

EJS has now new a Model Element to control Phidget boards.

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

Before you inspect the example, you need to download the Phidget drivers from http://www.phidgets.com/docs/Operating_System_Support and install them in your computer. Then. load the attached example and inspect it.

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.

For instance, you need a Phidget 1048 board (4 probe temperature sensor) for the attached example.

Good luck!

Paco

Attached File: ejs_PhidgetTemperatureExample.zip


Using Arduino boards with EJS
Francisco Esquembre
237 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


Current Replies - View all
Re: Using Arduino boards ...   (Diego Racero - )
Re: Re: Using Arduino boa...   (Francisco Esquembre - )
Re: Re: Re: Using Arduino...   (Diego Racero - )
Re: Re: Re: Re: Using Ard...   (Daniel Romero - )
Re: Re: Re: Re: Re: Using...   (Francisco Esquembre - )
Re: Re: Re: Re: Re: Re: U...   (Daniel Romero - )
Re: Re: Re: Re: Re: Re: R...   (Francisco Esquembre - )
Re: Re: Re: Re: Re: Re: R...   (Daniel Romero - )
OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book