Arduino > Flash range sensor experiment

I’ve been playing around with the Arduino microcontroller recently and this is my first experiment. It’s a prototype for a future artwork that essentially acts as a primitive touchscreen device. I’ve used 2 PING))) Ultrasonic Range Sensors positioned at the top of my monitor. These measure the distance of any object placed in front of them. The Arduino board collects this data and passes it on to Flash via SerProxy.

Click here to see the video on Vimeo
Click here to see the video on YouTube

For this project I used a modified version of David Cuartielles’ Arduino sketch and SerProxy as a Serial-to-Network Proxy Server. Here is my serproxy.cfg code.


# Config file for serproxy
# See serproxy's README file for documentation

# Transform newlines coming from the serial port into nils
# true (e.g. if using Flash) or false
newlines_to_nils=true

# Comm ports used
comm_ports=3

# Default settings
comm_baud=9600
comm_databits=8
comm_stopbits=1
comm_parity=none

# Idle time out in seconds
timeout=300

# Port 3 settings (ttyS2)
net_port3=5333

I spent quite a lot of time trying to use Firmata, and AS3Glue but found that Firmata didn’t work with the PING Range Sensor. I’m fairly sure that AS3Glue requires the Board to be running Firmata so, as mentioned above, I settled for Arduino code from David Cuartielles. I wrote my own Actionscript to deal with the incoming data using the Socket and ByteArray classes. You can find an early rough version of this code here.

UPDATE:
Images of the setup can now be seen here.

13 Responses to “Arduino > Flash range sensor experiment”


  1. 1 Alex June 7, 2008 at 8:53 am

    Hi James,
    that looks great! Easy and cheap to build. I have two questions, how precise is it? And do you have to use three sensors to cover the whole screen?
    Cheers,
    Alex

  2. 2 jamesalliban June 8, 2008 at 10:21 pm

    Thanks very much.

    The range sensor is not overly accurate. There was a bit of a difference between the two. If I place a book 20cm under them both, one will read 20cm and the other 24cm. With regards to your second question, I’m hoping to eventually have about 10 sensors and the screen will be replaced by a projection on a wall. I will also be looking into using triangulation to find the position of the user’s hand. This will hopefully require only 3 sensors.

  3. 3 ilya July 7, 2008 at 3:42 am

    wow nice!
    Love the particles too :)
    it would be col if youd change the particles styles, and im sure you can.
    still, cool

  4. 4 Kristofer Forsell October 26, 2008 at 2:09 pm

    Very nice!
    I thought I ought to let you know that you code has been a great help for a school project at Hyper Island. You can have a look here at a short project brief.

    Many thanks for sharing your wisdom.

  5. 5 jamesalliban October 27, 2008 at 11:10 am

    Glad to have been of help. Good luck with the project.

  6. 6 Ribeiro Santos November 25, 2008 at 6:08 pm

    Hi,

    Great job! I have just one question: how do you detect you have touched the “button”?

    Thanks for sharing your project,
    Ribeiro Santos

  7. 7 jamesalliban November 26, 2008 at 2:55 pm

    Thanks Ribeiro. I specified distances for each range sensors. If the distance between the sensor and an object (in this case my finger) is between, say, 15 and 20 cm, this registers as a button press.

  8. 8 kumar buddha November 27, 2008 at 3:42 pm

    hi

    Great and nice job…… can u suggent me how to do this in flash?

    if posible…

    regards
    kumar buddha

  9. 9 jamesalliban November 28, 2008 at 11:27 am

    There are links to the code required to build this in the post. You can find the info here – http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1211534244/3

  10. 10 richard November 29, 2008 at 4:15 pm

    hey james

    i have 2 pings as well but am having problems, i have adapted some code and can get the data from 1 ping through arduino into the software i am using, but when i adapted it for two sensors i seemed to have some problems, such as even if i set different delay times for the low high low pulses for each sensor, when i compile the code both the pings flash at the same time and are very erratic for instance when i move my hand back and fourth the act light seems to go faster and slower and sometimes just go crazy and i get scarred for the life of my duino, do you know how to solve this problem? any help would be greatly appreciated.

    cheers,

    rich

  11. 11 jamesalliban December 3, 2008 at 10:42 pm

    Hi Richard. As promised, I’ve just blogged images of the setup. Hope it helps.

  12. 12 Settor33 October 11, 2009 at 2:27 am

    Thanks a lotI consider this site a very good one for me to face the interview questions ahead of me. ,

  13. 13 jamesalliban October 13, 2009 at 10:19 am

    Glad to have helped. Good luck with the interview.


Leave a Reply








Tweets