Results 1 to 6 of 6

Thread: Ultrasonic sensor capabilities

  1. #1
    Join Date
    Apr 2012
    Posts
    1

    Default Ultrasonic sensor capabilities

    I have a student who is attempting to build the inverted pendulum robot with the Lego NXT kit. He is trying to use the ultrasonic sensor instead of the gyroscopic sensor, as the gyroscopic sensor costs 50 dollars.

    The result is quite a jerky robot. Can anyone tell me what the maximum sample rate for the ultrasonic sensor happens to be? Also, what is the smallest increment of distance it can see. From what I see online, it looks like 1 cm. So, it can see that something is 4 cm or 5 cm away, but not 4.5 cm.

    Any other advice would be helpful.

  2. #2
    Join Date
    Sep 2009
    Location
    Minnesota
    Posts
    1,087

    Default Re: Ultrasonic sensor capabilities

    Yes, I believe 1 cm is smallest increment of distance for the ultrasonic sensor.
    Also, it can't distinguish distances closer than about 5 cm.

    I think you may be pushing the limits of what the ultrasonic sensor can do.
    You may want to look at doing something similar with the color or light sensor.
    See this project from nxtprograms.com for a self-balancing robot using the color sensor.

  3. #3
    Join Date
    Dec 2011
    Location
    Oregon, USA
    Posts
    1,002

    Default Re: Ultrasonic sensor capabilities

    Quote Originally Posted by cbix View Post
    I have a student who is attempting to build the inverted pendulum robot with the Lego NXT kit. He is trying to use the ultrasonic sensor instead of the gyroscopic sensor, as the gyroscopic sensor costs 50 dollars.

    The result is quite a jerky robot. Can anyone tell me what the maximum sample rate for the ultrasonic sensor happens to be? Also, what is the smallest increment of distance it can see. From what I see online, it looks like 1 cm. So, it can see that something is 4 cm or 5 cm away, but not 4.5 cm.

    Any other advice would be helpful.
    In addition to timdavid's comments (total agreement) I recommend doing some experiments, with the sensor at short distances, and varying the angle between the US beam and the surface it's reflecting from. My experience indicates that at close ranges (under 20 cm), the sensor is very picky about alignment, and what the surface is made from. Factoring these effects into the algorithm for the pendulum robot, that makes for a very dynamic solution.
    FTC Judge: 2010
    FLL Volunteer: 2011-2013
    FLL Mentor: 2011, 2012
    FLL referee: 2012, 2013 (QT-head)
    FRC judge (Chairman's Award): 2014

  4. #4
    Join Date
    Sep 2009
    Location
    Minnesota
    Posts
    1,087

    Default Re: Ultrasonic sensor capabilities

    I ran a simple test to see if I could determine the sampling rate of the ultrasonic sensor.

    I wrote a short program that looped for 10 seconds, while incrementing a variable and taking a reading from the ultrasonic sensor. It iterated 12612 times in 10 seconds, so it appears the maximum sample rate is about 1260 times a second, which is faster than I would have guessed.

    Removing the sensor reading, the simple loop executed about 36000 times in 10 seconds, or about 3600 times a second.

    I also tried the light sensor, and that looped about 18000 times in 10 seconds, or 1800 times per second.
    Last edited by timdavid; 04-20-2012 at 09:45 PM. Reason: correct math

  5. #5
    Join Date
    Sep 2008
    Location
    Minnesota
    Posts
    2,845

    Default Re: Ultrasonic sensor capabilities

    Quote Originally Posted by timdavid View Post
    I ran a simple test to see if I could determine the sampling rate of the ultrasonic sensor.

    I wrote a short program that looped for 10 seconds, while incrementing a variable and taking a reading from the ultrasonic sensor. It iterated 12612 times in 10 seconds, so it appears the maximum sample rate is about 1260 times a second, which is faster than I would have guessed.

    Removing the sensor reading, the simple loop executed about 36000 times in 10 seconds, or about 3600 times a second.

    I also tried the light sensor, and that looped about 18000 times in 10 seconds, or 1800 times per second.
    The number of times you can read the US sensor value is not the same as how often the sensor value is updated.

  6. #6
    Join Date
    Sep 2009
    Location
    Minnesota
    Posts
    1,087

    Default Re: Ultrasonic sensor capabilities

    Quote Originally Posted by Dean Hystad View Post
    The number of times you can read the US sensor value is not the same as how often the sensor value is updated.
    Ah, that makes more sense. The rate I was calculating seemed far too high.

    I haven't found a definite answer on the real specification for the sampling rate.

    Answers in this page suggested "ping" times between 12 and 75 ms, and suggested it is actually configurable in the hardware. I'm not sure if that is a possibility using NXT-G.

    Another page had this interesting information:

    The product’s official specifications are as follows:

    • Detection range: from 0 to 255 cm with a margin of +/- 3 cm
    • Resolution of approximately 6 cm

    The few limitations that have emerged with this ultrasound sensor are:

    • Measurements under 4 cm cannot be made. This is because of the return time needed for the wave;
    • Measurements up to 20 cm are relatively accurate within an angle ranging between -8° and +30°. In fact, the receiver is on the left and the transmitter on the right, which explains why measurements made on the left are less accurate than measurements made on the right; and
    • Between 20 and 80 cm, measurements can still be made with a margin of error under 8%, which is not too bad for a sensor of this kind.
    I had always wondered which of the two parts of the ultrasonic sensor was the transmitter and which was the receiver.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Ultrasonic Calibration?
    By jemorris80 in forum Programming
    Replies: 12
    Last Post: 12-11-2011, 10:36 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •