How to request distance measurement from distance sensor?

Hi guys

My project which i am trying to achieve is to use something like a trigger to request the distance measurement from the sensor to the object, but only when it is triggered (perhaps with an ir sensor or something similar?)

Any ideas?

Some sensors have a trigger that will cause the sensor to do the measure thing only when the trigger is a thing do. You can use a button, as a trigger, to fire the sensor to take a measurement using a single trigger.

I do something similar with a LIDAR.

thats great and sounds very similar to what i want to achieve. Basically, i want to record measurement data using either a LIDAR, Ultrasonic, IR or ToF sensor, but only when an object is detected. My thoughts were perhaps an IR sensor, which detects the object when it is close enough, which would then tell the other sensor (LIDAR/Ultrasonic/ToF) to capture the measurement data.
I understand that i can use a button, but i am hoping that i can use a sensor instead to detect an object.

If anyone has any example and/or tutorials for this, it would be much appreciated!

Use your distance sensor to determine whether an object is present and if so, save the distance(s).

You haven't given very good information about the details of your problem, and the title of your post makes no sense, but presumably you will know that an object becomes "present" when the reported distance from your distance sensor changes from greater than X to less than Y, where:

  • X is some distance beyond which it is assumed that an object is not present
  • Y is some distance, less than or equal to X, that indicates an object is present

DaveEvans:
Use your distance sensor to determine whether an object is present and if so, save the distance(s).

You haven't given very good information about the details of your problem, and the title of your post makes no sense, but presumably you will know that an object becomes "present" when the reported distance from your distance sensor changes from greater than X to less than Y, where:

  • X is some distance beyond which it is assumed that an object is not present
  • Y is some distance, less than or equal to X, that indicates an object is present

I would agree to this post and adding to this post, you can also use ultrasonic sensors in UART mode where in the sensor consistently outputs distance readings and your micro controller only needs to "read" them passively as a listener and when the distance is above a certain threshold you can raise a software interrupt.

DaveEvans:
Use your distance sensor to determine whether an object is present and if so, save the distance(s).

You haven’t given very good information about the details of your problem, and the title of your post makes no sense, but presumably you will know that an object becomes “present” when the reported distance from your distance sensor changes from greater than X to less than Y, where:

  • X is some distance beyond which it is assumed that an object is not present
  • Y is some distance, less than or equal to X, that indicates an object is present

Thanks for the reply. I appreciate your comment.

The idea is to have 2 sensors.

Sensor 1 (ToF sensor) will be situated on the top of a table, waiting to be told to take a measurement.
Sensor 2 (Either IR or Ultrasonic) will be situated near the ground, waiting for an object to be in range (quite close, so say 10mm).

Once Sensor 2 has an object in range, it tells Sensor 1 to take a measurement reading.

In theory, sensor 2 is acting like a button, but without an actual press, just simply an object within range.

Then obviously, the data will be sent to serial, with the future hope of having it sent to an sql database to be displayed on a webpage.

Well, that’s somewhat more helpful than the first post. But to help others help you, why don’t you give the big picture?

  • Exactly what are you trying to accomplish? - What is this mysterious object “near ground”? - What is the ToF sensor pointed at and measuring the distance to? Is there some relationship between that thing and the object “near ground”? - What make/model sensors are you using or thinking of using? - Have you tried google to find sensors that people usually use with Arduino? What have you found? - Do you need help choosing from what you’ve found? If so, what are your requirements (such as the 10 mm you mentioned)? - Have you looked at or tried sensor vendor tutorials and example code…e.g., Adafruit, Sparkfun…and if not, well, do it. - What don’t you understand about how the sensors are used with an Arduino and “triggered”?

Then obviously, the data will be sent to serial, with the future hope of having it sent to an sql database to be displayed on a webpage.

That statement does not seem to be pertinent to the present discussion, except to the extent that it may highlight an apparent misconception. Nothing about your project is “obvious” to readers of this forum, except what you clearly explain.

PS: the HC-SR04 ultrasonic distance sensor, commonly used by hobbyists, has an approximately 2 cm blind distance, so 10mm is out of the question.

If you really require such a small blind distance of 10mm then you can perhaps try out laser range sensors like this one (Laser Range/ToF sensor Detection Range 1CM-2Meters 3% Accuracy VL53L0X GY-530 | eBay)

The VL6180X has a minimum distance of 5 mm and would be more suited for this 10 mm distance.
I don't know of any (non-contact) sensor that has a shorter minimum distance.

DaveEvans:
Well, that's somewhat more helpful than the first post. But to help others help you, why don't you give the big picture?

  • Exactly what are you trying to accomplish?
  • What is this mysterious object "near ground"?
  • What is the ToF sensor pointed at and measuring the distance to? Is there some relationship between that thing and the object "near ground"?
  • What make/model sensors are you using or thinking of using?
  • Have you tried google to find sensors that people usually use with Arduino? What have you found?
  • Do you need help choosing from what you've found? If so, what are your requirements (such as the 10 mm you mentioned)?
  • Have you looked at or tried sensor vendor tutorials and example code...e.g., Adafruit, Sparkfun...and if not, well, do it.
  • What don't you understand about how the sensors are used with an Arduino and "triggered"?

That statement does not seem to be pertinent to the present discussion, except to the extent that it may highlight an apparent misconception. Nothing about your project is "obvious" to readers of this forum, except what you clearly explain.

PS: the HC-SR04 ultrasonic distance sensor, commonly used by hobbyists, has an approximately 2 cm blind distance, so 10mm is out of the question.

I do apologise, im not the brightest spark with arduino based stuff, but i am trying to learn as i go along.

So the project is this.

I need to establish the fill level of a trash bin.
I have already tried and tested using a sensor in the top of a bin, but for my project it is advised to have it externally.
The idea is to have the sensors situated on the bin collection wagon itself. (simulated for testing)

Sensor1 would be situated at the top of the bin wagon, pointed down towards the ground.
Sensor2 would be situated where the bin is loaded onto the wagon.

When the bin is loaded onto the wagon, sensor2 sees it, then requests that sensor1 takes a distance measurement. The measurement is taken from sensor1 to the top of the trash inside the bin. Calculations will be taken into account to get the actual fill level (i will do this after i figure out exactly what im doing!).

The sensors i have to hand are:

HC-SR04 Ultrasonic Sensor
GP2Y0A21YK0F IR Analog Distance Sensor
VL53L0X v2 Time-of-flight Sensor
I also have a couple of those IR Obstacle Avoidance Sensors with the onboard adjustable potentiometer to adjust range (not sure on model numbers).
Also, i have access to a Garmin Lidar sensor, but i cannot have access to this at all times, so im trying to avoid using it if i can help it.

I am trying to get a working prototype of this before i continue further. The hope is to have it take distance readings, and send these readings to a databse to be displayed on a webpage and/or an app.

From the comments so far, my thinking is that the best sensor to use, to detect the bin presence, is the ToF sensor. Then perhaps the Ultrasonic or IR sensor to take the measurement when requested?

cmanu83:
From the comments so far, my thinking is that the best sensor to use, to detect the bin presence, is the ToF sensor. Then perhaps the Ultrasonic or IR sensor to take the measurement when requested?

Ohh thats the background. I don't know how the HC-SR04 would hold up to trash humidity and environment. If you opting for ultrasonic then perhaps try this one which is fully sealed and waterproof Sealed Waterproof ultrasonic/distance small blind sensor arduino Fully Genuine | eBay.

Also how about a pressure plate glued to the surfaces? If there is pressure on any of the plates you can use that as a detection that the trash bin has loaded into the wagon? and then trigger your ultrasonic distance sensor? Is that plausible for your setup?

So what are the actual distances you have to measure? Those trucks and bins tend to be pretty big.

From what distance do you have to detect the presence of the bin? Do you need to align the bin with the lifting mechanism as well? And if so, see which side of the bin you're looking at?

Also you have the problem of trash not making for a nice level surface on top. You may have objects sticking out of the bin even when it's just 10% filled or so. Weighing the bin may be a better measure, but also that's fraught with uncertainties (a load of stryrofoam packing waste vs. a load of bricks and related construction waste, for example).

Trash bin? Bin wagon? Photos are worth a 1000 words.

Why can't sensor1 be used to determine whether a bin is present AND measure the fill height? If a bin is NOT present, won't the distance that sensor1 measures be larger than the distance it measures when an empty bin is present?