Triangulation with Distance sensors

Discussion in 'The Projects Forum' started by djsfantasi, May 27, 2014.

  1. djsfantasi

    Thread Starter AAC Fanatic!

    Apr 11, 2010
    2,802
    832
    Hello,

    I've made a couple of blinking and moving eyes. First, for my animatronic penguin, then on commission for an LA artist. I've been asked to make eyes that would follow you as you move around them (you can search for my username on instructables.com or check out djsfantasi.com).

    There is an article about using two Ping))) ultrasonic sensors. I was also wondering about using a pair of Sharp IR distance sensors. The theory is to mount them co-linearly and cover one of the transducers. Triggering both together, both would respond to the uncovered transducer. Then, by calculating the different times from the sensors or coding a decision tree based on the different times, one could determine roughly where the person was relative to the center line of the eyes.

    Do you think this is do-able? Currently, I am using an Arduino as my development platform, to gain experience before moving on to PICs.
     
  2. wayneh

    Expert

    Sep 9, 2010
    12,103
    3,038
    Oh my, the difference in time would be the difference from light traveling just inches more or less to the two sensors. That is an extremely short amount of time. I believe in related posts here (on laser ranging), the solution was though to be phase comparison where you look at the shift between two waves rather than a ∆t between pulses.

    In other words, this would be incredibly difficult for anyone, let alone someone with your professed skill level. No offense, I certainly couldn't do it either.
     
  3. djsfantasi

    Thread Starter AAC Fanatic!

    Apr 11, 2010
    2,802
    832
    No offense taken. I was encouraged by the success the author of the Ping))) article had. So perhaps ultrasonic is the better route. I believe that it also offers a greater range, from 2 cm to 3 m.

    My electronics skill level is hobbyist; my coding skills are expert. If it can be done in code, I'll do it.
     
  4. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I think you could do it with a slightly different approach.

    If you used two Sharp GP2 IR sensors (that give a distance reading output) pointing in parallel (same direction) about 10" apart. Then a person standing 1m in front would read 1m distance on both sensors;

    Code ( (Unknown Language)):
    1.  
    2. S1 -------1m------- person
    3. S2 -------1m------- person
    But if the person moves to the side, one sensor misses the person and reads infinity;

    Code ( (Unknown Language)):
    1.  
    2. S1 ----------infinity-------------
    3. S2 -------1m------- person
    4.                     person
    So the code could detect this and keep turning the head so the person is visible to both sensors.

    You still have two minor problems;
    1. Sharp sensors are low range, generally 1.5m max range for the cheap type (unless you want the big expensive 5m versions).
    2. This system only tracks a person after being "acquired". It can't see a person who enters a room to the side of the head, and will only acquire the person after they walk in front of the head.
    :)
     
  5. sirch2

    Well-Known Member

    Jan 21, 2013
    1,008
    351
    Have you thought about using a Kinect sensor? I doubt that you are going to be able to use a Kinect easily with an Arduino or PIC though
     
  6. djsfantasi

    Thread Starter AAC Fanatic!

    Apr 11, 2010
    2,802
    832
    RB,

    Unfortunately, the application will not involve a head or turning base so the sensors will remain in a straight line. However, in your example if both sensors report a person or report infinity then the eyes will face forward. Otherwise, they would turn away from the single sensor reporting infinity. (This is simplified. Actually if both report infinity, the eyes would be closed)

    Does this approach seem reasonable?

    I just priced the 5m versions and they are comparable to the ultrasonic sensors. As I would need three Ping))) sensors or two GP2Y0K710 sensors… - Yikes!
     
  7. wayneh

    Expert

    Sep 9, 2010
    12,103
    3,038
    Any way to "cheat"? For instance, use floor sensors. Or IR sensors in the wall behind the observer? Just trying to think outside the box.
     
  8. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    You said you are good at code. Why not use a cheap camera module, and decode a few lines of data from it? Most are I2C data output now.

    You don't need to get the entire field, just read a few horiz lines with maybe 20 samples per line. A person in front of the camera (and slightly to the right) would look like this in your data array;

    Code ( (Unknown Language)):
    1.  
    2. ....................
    3. ....................
    4. ............##......
    5. ...........####.....
    6. ...........####.....
    7. ...........####.....
    8. ...........###......
    9. ...........###......
    10.  
    :)
     
  9. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    A camera may not work if there's poor contrast between the human figures and the background. It would depend on the lighting.

    But I just saw this item on the Sparkfun website:
    https://www.sparkfun.com/products/12907

    It's the chip that's used in optical mice, and it has the ability to act as a low-resolution camera. Maybe it's possible to correlate the outputs of two of them, and get stereo vision.
     
  10. djsfantasi

    Thread Starter AAC Fanatic!

    Apr 11, 2010
    2,802
    832
    Good ideas gents. Will research further.
     
  11. sirch2

    Well-Known Member

    Jan 21, 2013
    1,008
    351
    I got one of those optical mouse chips to play with. The difficult part is getting the optics right, the sensor is at the bottom of a small hole and it works ok at very close range but focusing an image on to from a distance may be a challenge unless you are good at optics.
     
    djsfantasi likes this.
  12. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    The optical mouse sensor is only something like 18x18 pixels.

    You can get a $4 camera module from ebay comes with working optics for a room focal distance and you can decode as much (or as little) pixel resolution as you choose.

    There are some source code examples on the net using a cheap AVR micro to step the camera at a slower frame rate and decode the pixel data in real time using the micro's inbuilt ADC (reads pixel brightness).
     
    djsfantasi likes this.
Loading...