HC-SR04 ultrasonic sensor detection area limitation

I plan on using these sensors to measure different peg distances which I will put in an array. The cylindrical pegs are on the ground and the sensor are overhead measuring the distance to the top of the peg. My question is--can these sensors be used to measure the distance if the diameter of the peg is around 5/8 of an inch and the table which they are standing on is between 2-5 inches from the top of the pegs (peg range is 2-5 in)? My concern is that the sensor will not measure the top of the pegs correctly and instead measure the distance to the table due to their small diameter. Maybe a different sensor suggestion?? Thanks!

The SR04 emmits a cone of 15 degrees, which quickly expands the area of detection. The SR04 can be prone to detecting other SR04's signal and noise generated by objects such as electric motors.

Perhaps a LIDAR may work for you? http://en.benewake.com/product/detail/5c345cd0e5b3a844c472329b.html <- a good low end LIDAR.

I am switching over to use a TFMiniPlus from a TFMini. The TFMini was able to resolve a 2 inch wide pipe at 400cm.

A feature I'd look for is for the LIDAR to be able to do triggering instead of continuous free run.

If you do decide to test the TFMiniPlus, remove the protective film on the LIDAR face before applying power. I did not remove the film, applied power and smoked the LIDAR after a few minutes.

There are better LIDAR's available, cost goes up.

Thanks for the reply, the TFMiniPlus sounds like an expensive option and would require me to buy additional components. I plan on using 6 sensors at a time or with slight delays between each sensor. I was looking at something similar to the Adafruit_VL6180X Adafruit VL6180X Time of Flight Distance Ranging Sensor (VL6180) [STEMMA QT] : ID 3316 : $13.95 : Adafruit Industries, Unique & fun DIY electronics and kits
My problem with that is that this sensor utilizes the SDA and SCL Pins and I plan on having 6 sensors with the same addresses. This is the reason I thought ultrasonic sensors would be convenient to set up (only utilizing the I/O pins). The Adafruit_VL6180X seems like a viable option in terms of the ranges I will be working with and the narrow length of the beam for my small target area, however I wouldn't know how to set 6 of these to my Arduino UNO.

An I2C port expander?

I believe this works only if each device has a unique address, in my case they would have the same address. Unless, is it possible to change it?

Multiplexer?

Activate the pull-up on the individual SCL lines using a separate digital pin and diode. That allows you to activate sensors one at a time.

Very simple; posted in this forum before but as usual I can't find it :frowning: Does demand more pins of course: the SCL/SDA pair and one for each sensor.