Need advice on Lego NXT Ultrasonic sensor use.

26 views
Skip to first unread message

Jim DiNunzio

unread,
Jan 19, 2026, 2:31:36 PMJan 19
to RSSC-List, hbrob...@googlegroups.com

I’m getting my bot ready for our RSSC’s contest, the Can-Do Challenge on Feb 14 (https://www.rssc.org/can-do-challenge.html), and need some advice on use of the Ultrasonic sensor use.

 

I’ve attached two pictures of my bot. I’ve used this sensor before successfully for at least 2ft in contests a long time ago where I mounted it horizontally. However, in this design I thought vertical would be better to detect a can. I tried horizontal first, but it didn’t work any better.

 

https://www.youtube.com/watch?v=dNbv3ONI3cU&list=PLmb0WjGtyZZS9qjUYhY4bdeh4ZQYx7BYS

Each tile has 12in (30cm) sides

 

I can reliably get good distance measurements when a can is within 1-2 feet (30-61cm), but I need a 3 feet (91cm) range for the contest.

The sonar seems to be very sensitive to its pitch and if pitched a small angle too low it strangely sticks to reading 23cm, some point on the floor. If it is slightly too high then it misses the can entirely. The further away the target is the smaller the sweet spot angle.

 

But keeping it exactly level on a moving platform is challenging. I’ve tried adjusting its pitch very slightly but it has not resulted in an improvement. My earlier bot design was a little more stable and maybe kept the sensor more level?

 

I do have a second ultrasonic sensor and am wondering if I should mount it as well. Both units behave the same when mounted in the position shown.

 

Thanks,

Jim

 

WIN_20260119_10_51_57_Pro.jpg
WIN_20260119_10_55_12_Pro.jpg

Eva Carrender

unread,
Jan 19, 2026, 4:18:43 PM (14 days ago) Jan 19
to RSSC-List, hbrob...@googlegroups.com
Jim, 

After looking at your photos and video, it's very likely that your sideways/vertical mounted Ultrasonic is being impeded by the grabber arm. Often times as the sound field is increased it will "see" objects in the way.

All the best,
Eva Carrender



Making Learning Fun Emoji


--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/hbrobotics/011e01dc897a%243400b7f0%249c0227d0%24%40gmail.com.

camp .

unread,
Jan 19, 2026, 4:29:36 PM (14 days ago) Jan 19
to RSSC-List, hbrob...@googlegroups.com, j...@dinunzio.com
    It could be worse. At least you're trying to find something cylindrical. With the TABLEBot Challenge, I've taken to using a 3.5" tube as my "block" because ultrasonic waves spang off flat surfaces, never returning to the receiving transponder.

Enjoy,
Camp

--
You received this message because you are subscribed to the Google Groups "RSSC-List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rssc-list+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/rssc-list/011e01dc897a%243400b7f0%249c0227d0%24%40gmail.com.

jimdi...@gmail.com

unread,
Jan 21, 2026, 10:28:55 PM (12 days ago) Jan 21
to Bob Huss, John Davis, RSSC-List, hbrob...@googlegroups.com

Thanks for the advice. After some tests I decided on a rear of robot, centered, and horizontal orientation for the U.S. sensor because I can reliably rotate close to 180 degrees with my odometry based localization and even have an IMU mounted if necessary to use. Even with this the range that the can is visible seems to be maxing out significantly less than 90cm. I’ll try different floors like cement vs. my shiny marble tiles and try the foam tape trick on the lower half of the transmitter.

 

Jim

 

 

From: rssc...@googlegroups.com <rssc...@googlegroups.com> On Behalf Of Bob Huss
Sent: Wednesday, January 21, 2026 3:31 AM
To: John Davis <jfd...@sbcglobal.net>
Cc: RSSC-List <rssc...@googlegroups.com>; hbrob...@googlegroups.com
Subject: Re: [RSSC-List] Need advice on Lego NXT Ultrasonic sensor use.

 

What I found on  NXT was to test the edges of the claw to be wide enough to not be seen by the U.S. sensor.  Then I would search only left direction for the edge of the can, on several trial runs. Then I add several milliseconds to center the claw on can.  If I remember right, the left part of the sensor is transmit, so I am guessing that the horizontal mounting position might be better if sideways movement is quick.

Good luck.

Bob Huss

 

On Tue, Jan 20, 2026, 12:00 AM John Davis <jfd...@sbcglobal.net> wrote:

My suggestion is foam-tape off a lower section of the transmitting sensor and aim slightly below the optimum. That way, if the robot tilts upward it may still see the can but the nearby floor will not be illuminated. If it tilts downward, the floor reflection may still be reduced sufficiently while the normal cone still strikes and reflects from the can. I think the lower 'eye' is the transmitter on your robot.

John F. Davis
(310) 961-2196 (cell)

On Monday, January 19, 2026 at 11:31:38 AM PST, Jim DiNunzio <jimdi...@gmail.com> wrote:

 

 

--

You received this message because you are subscribed to the Google Groups "RSSC-List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rssc-list+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/rssc-list/011e01dc897a%243400b7f0%249c0227d0%24%40gmail.com.

--
You received this message because you are subscribed to the Google Groups "RSSC-List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rssc-list+...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "RSSC-List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rssc-list+...@googlegroups.com.

WIN_20260121_19_16_41_Pro.jpg

Chris Albertson

unread,
Jan 23, 2026, 1:34:21 PM (10 days ago) Jan 23
to John Davis, Bob Huss, Jim DiNunzio, RSSC-List, hbrob...@googlegroups.com
I tried to solve this and some other problems with ultrasound by taking advantage of the fact that the robot is moving.

For example, if you. If you get a false positive “hit” or the sensor fails to notice an object, the results will likely be different after the robot has moved, even just a little.     So I used a simple algorithm.   “An obstacle is only 'real' after it has been detected N times with M pings.”   But this means you have to have at least decent localization.  The sensor gives only a distance and a crude angle, and you have to convert them to real-world coordinates.   Then, when you see an object at the same location N times, it is real. Conversely, if none of these objects are on the path, the path is really clear.

I think all sensors are like this; they become MUCH better if you take advantage of the fact that the robot is moving.  Especially cameras.   I run some video data through YOLO’s object recognition.   Yolo gives you a bounding box and a label, and what is neat is that it takes 30 frames per second.    This means you don’t wait long to get 10 or 15 samples.  With that many, Yolo is near perfectly accurate. If you say “object must be recognized 7 times in 10 frames at the same real-world location,”

All that said, ultrasound never did give good results; the angular resolution is too poor.   I tried to make it better with another trick:  I used multiple sensors with overlapping fields of view.   Then, if sensors A and B both saw the object, I knew it was in the angle where the views overlap.  But still, the robot was confused by chair legs under a dining table, and it could not tell a doorframe from a continuous wall until it was very close.  




On Jan 22, 2026, at 10:26 PM, John Davis <jfd...@sbcglobal.net> wrote:

I was playing with an NXT ultrasound with a 40 kHz sensor taped onto it. (I like to see the actual chirp and echoes on a scope.) It occurred to me that driving over a smooth floor is just like driving along a wall; at certain distances from the wall the echo returned (when the side lobe of the chirp hits the wall) can be strong enough and at an angle to be seen as a target closer than the actual object.
One way to eliminate that might be a front-mounted ultrasonic close to the ground; any possible reflection will come from a nearby more perpendicular angle and thus be too close in time to be detected. (For ground further away the transmission angle will be too shallow to reflect back into the receiver.)

John F. Davis
(310) 961-2196 (cell)

On Wednesday, January 21, 2026 at 07:28:50 PM PST, <jimdi...@gmail.com> wrote: 


Jim DiNunzio

unread,
Jan 25, 2026, 2:41:17 PM (8 days ago) Jan 25
to Chris Albertson, John Davis, Bob Huss, RSSC-List, hbrob...@googlegroups.com

Thanks for the pointers to all.

 

Here’s a milestone in my progress:

https://youtube.com/shorts/2u_xTZ9i4l8?feature=share

 

Now I’ll try to extend the range capability and improve the success rate!

 

Re the comments, I do like to take many measurements while the robot is moving or scanning completely past the detected, in range target in this case to find the minimal distance and optimal angle to the target. Because this is for a constrained contest and arena (https://www.rssc.org/can-do-challenge.html), then I don’t need to engineer it beyond those requirements.

 

Personally, if I were building a modern robot for this contest, I would not use an Ultrasonic sensor, but instead a ToF infrared sensor module like the VL53L7CX which is available in ready to use boards in the market for a range of prices. I have bought DFRobot’s RP2040 uC based board (https://www.dfrobot.com/product-2999.html) available for under $22

 

For my YOLO object detection implementation on Big Orange I’ve been using basically the same algorithm Chris describes below for several years, calling it computePersistance(). It works quite well.

 

Jim

 

 

From: Chris Albertson <alberts...@gmail.com>
Sent: Friday, January 23, 2026 10:34 AM
To: John Davis <jfd...@sbcglobal.net>
Cc: Bob Huss <boba...@gmail.com>; Jim DiNunzio <jimdi...@gmail.com>; RSSC-List <rssc...@googlegroups.com>; hbrob...@googlegroups.com
Subject: Re: [RSSC-List] Need advice on Lego NXT Ultrasonic sensor use.

 

I tried to solve this and some other problems with ultrasound by taking advantage of the fact that the robot is moving.

Reply all
Reply to author
Forward
0 new messages