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
    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(
        at jogamp.opengl.awt.AWTThreadingPlugin.invokeOnOpenGLThread(
        at jogamp.opengl.ThreadingImpl.invokeOnOpenGLThread(
        at processing.opengl.PJOGL.requestDraw(
        at processing.opengl.PGraphicsOpenGL.requestDraw(
        at 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(
        at processing.core.PApplet.handleDraw(
        at processing.opengl.PJOGL$PGLListener.display(
        at jogamp.opengl.GLDrawableHelper.displayImpl(
        at jogamp.opengl.GLDrawableHelper.display(
        at jogamp.opengl.GLDrawableHelper.invokeGLImpl(
        at jogamp.opengl.GLDrawableHelper.invokeGL(
        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$ Source)
        at java.awt.EventQueue$ Source)
        at Method)
        at$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 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.)?