Augmented Reality Tutorial No. 5: Interaction using Arduino and Ultrasonic Sensor

Augmented Reality Sensor

In this Augmented Reality Sensor tutorial the scale of the 3D cube is changed in Augmented Reality environment using data acquired from an ultrasonic sensor distance measurements. This is a basic interaction with virtual content.

Download # Arduino Code (*.ino file)

Download # Processing Code (*.pde file)

Download # Hiro Marker (*.pdf file)

(Processing software itself is available to download here)

Download # Newest nyar4psg 2.0.0 library for Augmented Reality (*.rar file)

NOTE: Extract library and put nyar4psg folder to Processing libraries location as you can see in example here: “C:\Users\EdgarasArt\Documents\Processing\libraries”. If there are no libraries folder in Processing folder (in My Documents) – create it!

Upload Arduino code directly to your Microcontroller from website
If you want to integrate Arduino IDE into your website (as above) sign up here: codebender

Tags: , , , , , ,

14 Responses

  1. Good night!

    You’ve done a great job. Well, I want to do this in a school project. If I have some doubts, could I ask you? Where could I send you my doubts?

    Thank you so much.

  2. GLException: method “glclearDepthf” not available
    I am getting this exception. Please suggest how to resolve this problem. Thank you in advance.

    • Sorry, haven’t stumbled upon this error, but did you use Processing 2.2.1? If not, I would suggest to use this version, not the newest.

  3. Hey man great work but I keep getting
    java.lang.AssetionError
    Used proccessing 3 and 2.2.1
    When I click “Run” I have a grey window and that error .

      • does this help man ?

        java.lang.RuntimeException: java.lang.AssertionError
        at com.jogamp.common.util.awt.AWTEDTExecutor.invoke(AWTEDTExecutor.java:58)
        at jogamp.opengl.awt.AWTThreadingPlugin.invokeOnOpenGLThread(AWTThreadingPlugin.java:103)
        at jogamp.opengl.ThreadingImpl.invokeOnOpenGLThread(ThreadingImpl.java:206)
        at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:172)
        at javax.media.opengl.Threading.invoke(Threading.java:191)
        at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:541)
        at processing.opengl.PJOGL.requestDraw(PJOGL.java:688)
        at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:1651)
        at processing.core.PApplet.run(PApplet.java:2256)
        at java.lang.Thread.run(Unknown Source)
        Caused by: java.lang.AssertionError
        at jp.nyatla.nyar4psg.PImageRaster.wrapBuffer(Unknown Source)
        at jp.nyatla.nyar4psg.MultiMarker$PImageSensor.update(Unknown Source)
        at jp.nyatla.nyar4psg.MultiMarker.detectWithoutLoadPixels(Unknown Source)
        at jp.nyatla.nyar4psg.MultiMarker.detect(Unknown Source)
        at AR5_CodeForProcessing.draw(AR5_CodeForProcessing.java:70)
        at processing.core.PApplet.handleDraw(PApplet.java:2386)
        at processing.opengl.PJOGL$PGLListener.display(PJOGL.java:862)
        at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:665)
        at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:649)
        at javax.media.opengl.awt.GLCanvas$10.run(GLCanvas.java:1289)
        at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1119)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:994)
        at javax.media.opengl.awt.GLCanvas$11.run(GLCanvas.java:1300)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$200(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

          • cant that be because of missing jre or something like that ? i have the same problem here, i didnt touch the code except to put resolution 640×480 and it gives me the same error and it runs the window but no camera :/ any ideas ?

  4. I’m using arduino uno, but i connected the same ports, 2,3 5v and ground and i can get reading on the arduino ide just fine so i think thats not the problem

    • How many ports do you have in the device manager? Which one from the top is arduino port (the first one, second one etc.)?

Leave a Reply