I've spent time with the TOF10120. You can change several parameters inside the device by transmitting (on the serial interface) a message with the format 'sR-xxxx#' where R is the number of the register in the range 0 to 8 inclusive, and xxxx is a numeric, decimal value (which varies in size depending on the register to which you are writing). Conversely you can read any register by sending 'rR#' where R is the number of the register. So to read register 3 you send 'r3#' across the serial interface. Deviation (register 1) allows you to change a scaling value. Changing this value you can calibrate the device at a given range. So, for instance, I can set an object exactly 200mm from the sensor and modified the deviation until the reported distance is 200mm or thereabouts. As an example, I send the command 's1-02#' on the serial port which reduces the deviation by 2mm. Reading back the register (by sending 'r1#') you will notice the 's1-02#' command is a decrement of 2 - you are NOT setting an absolute value! So conversely, if you send the command 's1+02#' you will see the value of the register increments upwards by 2. The ONLY time this command sets an absolute value is when you send 's1-0#'. The maximum range for the register value appears to be -100 to 99. For my device I found the best value for register 1 was D=-17mm. I'm not sure why it's return in millimeters. I suspect this implies there is an ideal calibration distance. One thing for sure, you can massively improve the accuracy of your device by playing with this value! There are other useful things you can set including filtering, on or off (I suspect this is kalman filtering) which is register 3. You can also set the measurement periodicity over serial which is set, by default to 100ms. This is set via register 2. You can also tell the device to stop continuous transmission of readings (the passive mode) using register 5. This is set by sending 's5-1#' for passive or 's5-0' to return to continuous streaming. If you DO set for passive reads, you can either read across i2c or by reading register 6 ('r6#'). Note this will ONLY return the distance when the device is in passive mode. Finally there is another value, register 8, which is the calibration command. To be honest I haven't played with this register (yet) but I suspect that using a combination of register 1 and register 8 you can actually get decent accuracy out of this device. Next up we have the i2c interface (which I prefer to use as the serial connection is a 1 to 1 interface) If you read 2 bytes from device 82 (aka top seven bits of address 0xA4), register 0, you will always get the range (in mm). That applies to both active and passive modes on the serial interface. However you can also read and write the other registers! This is where things get strange. I've spent time mapping i2c byte addresses to their equivalent registers. Here's what I've come up with so far: i2c byte address 0 corresponds to distance (2 bytes). byte address 6 is the deviation (2 bytes) and corresponds to r1. The serial send interval (default 100ms) is found at byte address 10. The maximum distance measurement (max value 2000) is found at byte address 12. The active/passive flag for serial measurement transmission is found at byte address 9 (1 byte). The distance measurement is found at byte address 4 (2 bytes). The 8 bit device address is found at byte address 14 (2 bytes) or byte address 15 (1 byte). The filtering on/off flag is at byte address 8 (1 byte). I hope this helps. If you spot any errors or have additional information, please rely to this comment and I'll either make corrections or confirm your observations!
@@lebronjames2864 I haven’t used one yet, but it probably depends on your definition of accuracy. Assuming it functions by measuring round-trip delay of a brief laser pulse, I see no reason why it couldn’t measure distances as short as 1 mm. At these ranges, constant error would have more effect than proportional error, so I imagine it might read 3mm instead of 1mm. This would be “only off by 2mm”, while also being “200% off”.
Very good and useful video. I am working with the HC-SR04 sensor and I realized that I should imagine A WIDE CONE exiting from it. In your case, to have a real idea of the cone, stating to your measures, you had to put a long ruler bar starting from the centre of the sensor and hit around the 50cm lower bar on the table (the max distance of meaningful detection) and see the real angle. Another thing that you could do, was to raise the sensor to increase the distance from the table and avoid the sound cone to hit the table and bounce back.
It would be useful to test measuring distance to an angled surface. I have found that the ultrasonic sensors don't sense objects when at an oblique angle, but in robot applications you may need to sense a wall that you are not pointing at right angles. It seems like optical sensors are better in this regard.
Would be interesting to know how they cope with reflective surfaces (eg, gloss paint) and angled surfaces. In my experiences, few distance sensors cope well in either case, but I'm intrigued to know what the limits might be.
The accuracy of the sonic receptor might benefit from a shroud, such as a short toilet tissue tube or other exclusion/rejection barrier, which would limit the angle of echo-return waves.
Could the failure of the HC-SR04, have anything to do with the fact that it looks to be mounted pointing upwards and that the reflected waves are missing the receiver. I note the TOF10120 line of sight was parallel to the test platform, but it appears as though the HC-SR04 is inclined upwards by 10 to 15 degrees.
This will be useful for picking the appropriate sensor for projects. Thanks. 👍 Maybe in a future video, you can compare PIR and microwave motion detectors. 🤔
I suspect the ultrasonic sensor was responding to the reflection received from the sticks on the board. That ultrasonic sensor has a small pic on it and you're at the mercy of the embedded firmware. I can assure you that it received the reflection from the further distance, it just ignored it. I did a pic project in the early 2000s using some transducers obtained from a surplus electronics store. I was able to receive reflections from over 8' away reliably. It does have a broad cone of sensitivity, but that can be handled with a literal waveguide to narrow it considerably. I was driving the sending transducer solely by connecting it to two output pins and toggling one low and the other high simultaneously, with a slight delay then reversing the drive, effectively putting 10v peak to peak on the sender, for 6 cycles spaced to generate a 40kHz signal. Using a single opamp on the receiving transducer, it could easily measure to the far wall in the room I was using. Using an oscilloscope I could see other reflections arriving early. I suspect the sensor you are using is picking the first one above a hard set threshold, without regard to any stronger ones received later. Outside of convenience and cost, these mass produced sensor modules are just not that good. I don't believe they have any ability to measure relative strength of the reflections, just a simple comparator aided by a gradual increase in sensitivity (by lowering the threshold) as time elapsed after there transmission, eventually giving up after a preset limit. They're fine for what people use them for, simple to use, but fairly crude technology wise. They're built to a price point, and it shows.I haven't dug through the Arduino library code, but I'm confident that the pulse widths measurements are equally as crude, influenced by random inaccuracies caused by interrupt handling routines. I would think that by using the capture feature of the atmega chip, consistency would greatly improve. I have no experience with the TOF module.
Glad to see that, I have a half dozen of the old sound sensors that I got once when I thought about robots but never went forward. Now I don't have the funds to buy the laser anyhow. Thanks for the entertainment and knowledge!
Thanks for this. Confirms the problem I've been having with my TOF sensor. This, unfortunately, makes it much less practical for my project. I'll have to do what I can with the HC-SR04
This was an interesting comparison. I am wondering if the sensors may have been picking up your supporting timbers that you used at each set point. Are they even needed with the way this is designed? Might be better to replace the timber supports with just lines to align each measurement point and see how it goes with that. It was an interesting comparison. I had high hopes for the TOF laser sensor. Apart from the speed of the readings, the two sensors were quite similar in accuracy, given you couldn't go further than 50cm with the ultrasonic one.
Could the distance be off for the long because of your mounting brackets, the right angle at the leading edge might be the problem. Put in a triangular leading edge taller than the square rear spacer or remove the rear entirely.
The problem with the HC-SR04 is that you often have "outliers" in the measurements and have to recognise and filter them out yourself. There are also big problems when the measurement falls on a surface that is positioned at an oblique angle to the sensor. I had hoped to find out in this video whether the laser sensor performs better. But unfortunately not.
According to the article you are using "331.4 + (0.606 * temp) + (0.0124 * hum)" to calculate the speed of sound. Could you give a quick explanation where you found these numbers? I did find the .6*temp+331 in some other reference but have been unable to track down the humidity calculation.
I thought I might be able to use the TOF10120 for an application where I'd previously tried an HC-SR04, but was disappointed its apparent lack of accuracy. Then I found the VL53L0X laser board, and wondered if you'd tried that. It's supposed to work up to 2m, so seems to serve a similar function to both these devices, and it's cheaper than the TOF10120. Has anyone tried comparing them?
I haven't verified this, but it seems that many sensors will find "edges" and report their distance. The white pieces, you used to hold the target, could be causing that effect.
I concur with this. basically, it's what you were saying about the field widening. i'm surprised you didn't try placing a piece of board or paper to cover the unused brackets between the sensor and the target.
More data of course is alway nice - I wondered about the angular spread of the ultrasonic sensor. ...There seemed no excuse for the poor laser performance. BTW -- Saw your icon and immediately thought of Tin Hat Ranch who used that as their logo - sure wish he was back on UA-cam, he was very creative.
Great demonstration. I wonder if the LASER was designed for close range work? Due to the fact that it's very small it could be mounted inside a device and the LASER could be used to adjust a electrical / mechanical component. For example elevator door. Measuring the distance to close the door, slowing it down or speeding it up.
I own a HC-SR04 too and as far as i know those devices are rated up to 7 meters. At 26:13 the reading didn't even change if you go to 100mm. I would suggest trying another lib and check the calculations that are done with the temperature and humitiy sensor. Maybe there is some sort of mathematical maximum hidden in it. Another possibility could be that it catches the white place holder.
Just had another thought. I wonder if those edges were the cause of error of the TOF sensor. Might want to rerun the tests with the white guides removed.
I've not looked much at these - but I was expecting they'd both work far better than they did. The broad spread of the uSonic sure negated numerous applications, as did the short range of the laser - who'd think a laser would be so limited in this regards. Thanks that both fun and very informative.
It is possible to improve the HC-SR04 by decreasing it's measuring angle. To do this one can simply roll up some card stock into a tube and slip it over the transceiver/receiver cylinders. Longer card stock tubes result in a higher directionality of the measurement.
It would be perfect if an infrared sensor can be added to the test... thanks for the incredible effort to make these videos. Thank you. Btw, I have doubts the ultrasonic sonic spec max distance sensing is 400cm...
Have you tried the US-100 ultrasonic distance sensor? In my limited experience, it seems to be both faster and more accurate than the HC-SR04, and compensates for temperature on its own in serial UART mode.
Very interesting workshop today. Thanks Bill. It seems like these sensors are barely useful for anything more than proximity sensing. The laser module looks pretty much like what you see on automatic plumbing fixtures in public restrooms.
One thing we must take into account is that no sensor has a real linear response. Usually the manufacturer datasheet has a table or graphical representation of the readings versus the real values. That info should be included in the software, usually in the form of a lookup table, to compensate for the natural non linearity of the sensor. And, yes, a LASER based sensor will always out perform a ultra sound one, but not by $10.
I would assume that the different reflectivity between foam and wood wall causes the different reading as it would change the amplitude of the reverse signal. Nice measurement though!
You need to lift the sensor higher off the surface. The error appears to be exactly the distance to the quarter round behind the 500 mm Mark. Alternatively, put down a black or charcoal felt as acoustic damper. The Ultra-sonics are easily good to 200 cm
For optimum accuracy you must know the angle of transmission cone pattern on the sensors Often you will pick up the ground suface too early in most applications with low mounted sensors, which gives false readings. The sensors TX pattern is not that narrow as you may think.
Consider this a 'heads up' to anyone getting their TOF10120 working for the first me. I found that the compile fails because of a reference to "fdevopen". ('fdefopen not declared in this scope'). I am not a seasoned Arduino coder and I really didn't know what to do to fix it. In researching it I couldn't 't even figure out just what it was supposed to do. Anyway, just for grins, I just deleted it and any references to it and what-a-ya-know... the sketch works just fine without it.
One of the disadvantages of the US sensor in practical use in robotics is that hard surfaces work as a mirror. If these are under an angle it measures the reflection rather than f.i. the wall itself.
Nice to see you accurately reporting your preconceived bias. ie "I assumed the laser sensor would run circles around the ultrasonic sensor". I thought everything was just opinions these days, and reality or facts were a thing of the past :)
Great stuff. I'm more than impressed of the quality of your videos. Have you ever thought about using the LIDAR stuff together with the jetson nano? Which tool are you using to create your beautiful animations? This might be something useful for my class room presentations.
Can a tube be added to the transmitting ultrasonic transmitter in order to restrict the wide spread of the sound transmission and thus improve accuracy?
I like all of your videos. I just have one question. Why do all the videos measure distance for you or for others? They do not approach small or precise distances, i.e. from zero to five centimetres. Are there such sensors? Please explain. Thank you.
Great video DroneBot! Can either of these be used behind a sheet of protective glass/plastic? Or will the sound/light reflect off a see-through surface? I'm trying to find devices that can be placed at multiple levels inside a canister of dry goods (e.g., dog food), and am thinking I'll need to separate the sensor from the stored material by a sheet of glass or plexiglass.
It would be interesting to see how the sensors compare to measuring objects that are not directly facing the sensor. Say if the plywood is place 25 cm away and then slowly turned on the Y axis, how many degrees off could it reach before the sensor in not able to read it. Similarly, how well do the sensors detect rounded objects, like a garbage bin?
Nice vid. Quick question. Does anybody know if the Tof10120 can detect water surface levels? Mounted pointing down at the water surface. Thanks for any comments / followups.
I've tried that and it didn't seem to work well (i.e., the measurements were way off). The light just passes through the water until it hits the bottom of the container if it's in range. If you're trying to measure the level in a smaller body (e.g., a few feet), I'd use eTape liquid level sensors.
@@cdfairchild Thanks for the feedback. I am going to test independently with multiple ToF sensors as well as the ultra sonic HC-SR04 and will report back as to my findings especially since the sensors are soooo cheap. However, I thought a lot more about it and I think I am going to be using load cells. Knowing approximate densities as the fluids relate to water and knowing that 1 mL = 1 gram for water and being able to measure to the 1 gram increment on the load cells I should be able to make these measurements with a high degree of confidence. I will report back early part of February as to my findings. Thx for your feedback
A small point, but the HC SRo4 seemed to be pointing upward a bit on the test rig. Could be that it is shooting over the top of the board at the longer distance?
Is it surprising that a "Time of Flight" sensor is only effective at close range? If it's designed to tell how long your quad copter or whatever has been in the air, do you really want it to potentially confuse trees and structures with the ground? Think of a macro lens on a camera: you can focus it very close to the subject, and not farther away. Remember that the Time of Flight sensor is an optical device with a very narrow field of view, which indicates it's designed to focus at a short distance. Remember that the ultrasonic sensor had the exact opposite problem: at longer distances, the target wasn't wide enough for the ultrasound signal to be bounced back.
I suspect the ultrasound sensor is picking up the white colored holders on the base board, if you had the sensor twice as high from the base, the sensor would miss the obstacles on the base board. it is a quit narrow vertical angle from the transducers. To me that is the most likely cause of the max measurement Kind regards Hans
Would be interesting to use another. movable transducer and see if you can measure the beam pattern maybe sidelobes picking something off the bench that's bigger than the main return ?
I wonder if the stray hc-sr04 reflection at 50+cm is the vertical face of the quarter round making the slot at 50cm (I have not read the comments yet; maybe someone else already suggested this)?
What happens at the extreme, ie the 400 cm distance quoted for the SR04? I have the SR04 and an SR08 with supposedly double the distance, but can't get more than 6 feet in my shop. According to tech support it's because the sensor is seeing the floor or the ceiling, something I dispute because I have an 8 foot ceiling and my sensor is right on the edge of my desk, 32" off the floor. They work great at short distances but the divergence could be an issue. I'd like to see some experiments with cone reflectors and push the limits to the extreme. As a result of my own tests and these issues I decided to go with microwave (radar) and also laser (bouncing off a mirror and back) for vehicle detection on a busy highway.
would have nice to also show performance with the obstructions at an angle in real world cases objects are rarely perfectly perpendicular to the incidence plane
very nice dimension sensor video...👍 do you have a video on line-scan cameras or document line-scan 8.5" wide sensors? would opencv work with these sensors? thanks...:)
fantastic explaination sir, i leaned so much new things from your vidios......i would like to tell you to please tell us how do u refer datasheets from your veiw , so could learn from your experience.... thank you so much
Hello. Thank you very much for another great video. Could you please let me know what application you use for the wiring schematic, where you show connections between the board and sensors?
A possible very useful application for the TOF10120 is in pressure tanks tipple used for spray painting. It is difficult to tell how close to empty the tank is. This sensor would seem ideal if it can tolerate air pressures around 100 PSI. Is there any information about pressure or can someone reasonable guess what might happen?
Hey, nice video. I missing something about reflection details. Like u said, everyone is very familiar with these ultrasonic sensors but they bring some problems like reflection in specific angles with them. I try to make a rc car to drive autonomic and this issue brings me to gather new informations about other types of meassure tools like lidars or laser.
Now there's an infrared proximity sensor that is very similiar to the hc-sr04 in price (i don't know what's it's official name is) and seems quite easy to use (according to my little experience at least...). I wonder if you could review that sensor as it is quite responsive hence could be used for high speed sensing.
Hey there Dronebot, Would the orientation of the sensor change the results, for instance orientating the device 90 degrees from tested pin placement? Or tilting the sensors slightly off the perpendicular axis (up, down)? Also I'm curious if you covered the rungs on your test bed from sensor to target might improve the results. I've played around with the HC-SR04 and looking to use it in a home application. Thanks for producing these informative videos!
Would it be possible to check the laser distances device light pattern that it emits with a solid state camera? Much like you would check to see if you're TV remote control is working, just incase something odd is happening.
Thanks for the video... do you think a motion sensor or break beam could be made by using one these? Im looking for a simple result as either an open circuit or closed circuit.
Sir can you please make a tutorial on control of continuous servo motor clockwise-stop-countercw control with joystick on Arduino mega board. It will be really helpful for the learners. Im trying but not getting done. Kindly help sir. 🙏🙏🙏🙏🙏
Can any of these sensors detect a level of fluids in the tank? Let say I need to know how much fluid is in the tank and have an alarm if certain level is reached. Which of these two sensors will be better?
I've spent time with the TOF10120. You can change several parameters inside the device by transmitting (on the serial interface) a message with the format 'sR-xxxx#' where R is the number of the register in the range 0 to 8 inclusive, and xxxx is a numeric, decimal value (which varies in size depending on the register to which you are writing). Conversely you can read any register by sending 'rR#' where R is the number of the register. So to read register 3 you send 'r3#' across the serial interface.
Deviation (register 1) allows you to change a scaling value. Changing this value you can calibrate the device at a given range. So, for instance, I can set an object exactly 200mm from the sensor and modified the deviation until the reported distance is 200mm or thereabouts. As an example, I send the command 's1-02#' on the serial port which reduces the deviation by 2mm. Reading back the register (by sending 'r1#') you will notice the 's1-02#' command is a decrement of 2 - you are NOT setting an absolute value! So conversely, if you send the command 's1+02#' you will see the value of the register increments upwards by 2. The ONLY time this command sets an absolute value is when you send 's1-0#'. The maximum range for the register value appears to be -100 to 99. For my device I found the best value for register 1 was D=-17mm. I'm not sure why it's return in millimeters. I suspect this implies there is an ideal calibration distance. One thing for sure, you can massively improve the accuracy of your device by playing with this value!
There are other useful things you can set including filtering, on or off (I suspect this is kalman filtering) which is register 3. You can also set the measurement periodicity over serial which is set, by default to 100ms. This is set via register 2. You can also tell the device to stop continuous transmission of readings (the passive mode) using register 5. This is set by sending 's5-1#' for passive or 's5-0' to return to continuous streaming. If you DO set for passive reads, you can either read across i2c or by reading register 6 ('r6#'). Note this will ONLY return the distance when the device is in passive mode.
Finally there is another value, register 8, which is the calibration command. To be honest I haven't played with this register (yet) but I suspect that using a combination of register 1 and register 8 you can actually get decent accuracy out of this device.
Next up we have the i2c interface (which I prefer to use as the serial connection is a 1 to 1 interface)
If you read 2 bytes from device 82 (aka top seven bits of address 0xA4), register 0, you will always get the range (in mm). That applies to both active and passive modes on the serial interface. However you can also read and write the other registers! This is where things get strange. I've spent time mapping i2c byte addresses to their equivalent registers. Here's what I've come up with so far: i2c byte address 0 corresponds to distance (2 bytes). byte address 6 is the deviation (2 bytes) and corresponds to r1. The serial send interval (default 100ms) is found at byte address 10. The maximum distance measurement (max value 2000) is found at byte address 12. The active/passive flag for serial measurement transmission is found at byte address 9 (1 byte). The distance measurement is found at byte address 4 (2 bytes). The 8 bit device address is found at byte address 14 (2 bytes) or byte address 15 (1 byte). The filtering on/off flag is at byte address 8 (1 byte).
I hope this helps. If you spot any errors or have additional information, please rely to this comment and I'll either make corrections or confirm your observations!
so actually you can get good readings below 100mm? How low?
@@lebronjames2864 I am out of country until July 7th. I will take a good look at readings below 100mm when I return to my lab and update here.
@@lebronjames2864 I haven’t used one yet, but it probably depends on your definition of accuracy. Assuming it functions by measuring round-trip delay of a brief laser pulse, I see no reason why it couldn’t measure distances as short as 1 mm. At these ranges, constant error would have more effect than proportional error, so I imagine it might read 3mm instead of 1mm. This would be “only off by 2mm”, while also being “200% off”.
Great info thanks!!! Is it possible to change the i2c address to use several of them?
Thank you. 2 years passed. Do you still continue to use this laser sensor? Any additional info on it? Going to use it in a small RC car.
Thank you so much for the amount of hard work you did in this single video, just to make everybody understand things pretty easily. Hats off Man!
Very good and useful video. I am working with the HC-SR04 sensor and I realized that I should imagine A WIDE CONE exiting from it. In your case, to have a real idea of the cone, stating to your measures, you had to put a long ruler bar starting from the centre of the sensor and hit around the 50cm lower bar on the table (the max distance of meaningful detection) and see the real angle.
Another thing that you could do, was to raise the sensor to increase the distance from the table and avoid the sound cone to hit the table and bounce back.
Great presentation. I like the consistent camera angle/view and more meaningful transitions. Bravo!
It would be useful to test measuring distance to an angled surface. I have found that the ultrasonic sensors don't sense objects when at an oblique angle, but in robot applications you may need to sense a wall that you are not pointing at right angles. It seems like optical sensors are better in this regard.
Would be interesting to know how they cope with reflective surfaces (eg, gloss paint) and angled surfaces. In my experiences, few distance sensors cope well in either case, but I'm intrigued to know what the limits might be.
The accuracy of the sonic receptor might benefit from a shroud, such as a short toilet tissue tube or other exclusion/rejection barrier, which would limit the angle of echo-return waves.
Recently started into the microcontrollers world and I learn a lot on your channel. Thanks for the uploads. Hugs from Brazil.
Could the failure of the HC-SR04, have anything to do with the fact that it looks to be mounted pointing upwards and that the reflected waves are missing the receiver. I note the TOF10120 line of sight was parallel to the test platform, but it appears as though the HC-SR04 is inclined upwards by 10 to 15 degrees.
Disagree. I don't think the Time of Flight sensor "failed"
Thank you so much for sharing! Helped me a lot decide wich would be appropriate for my project! Huge thanks!
Sir Your way of teaching is very perfect with very good details. thanks you for sharing.
This will be useful for picking the appropriate sensor for projects. Thanks. 👍
Maybe in a future video, you can compare PIR and microwave motion detectors. 🤔
I suspect the ultrasonic sensor was responding to the reflection received from the sticks on the board. That ultrasonic sensor has a small pic on it and you're at the mercy of the embedded firmware. I can assure you that it received the reflection from the further distance, it just ignored it. I did a pic project in the early 2000s using some transducers obtained from a surplus electronics store. I was able to receive reflections from over 8' away reliably. It does have a broad cone of sensitivity, but that can be handled with a literal waveguide to narrow it considerably. I was driving the sending transducer solely by connecting it to two output pins and toggling one low and the other high simultaneously, with a slight delay then reversing the drive, effectively putting 10v peak to peak on the sender, for 6 cycles spaced to generate a 40kHz signal. Using a single opamp on the receiving transducer, it could easily measure to the far wall in the room I was using. Using an oscilloscope I could see other reflections arriving early. I suspect the sensor you are using is picking the first one above a hard set threshold, without regard to any stronger ones received later. Outside of convenience and cost, these mass produced sensor modules are just not that good. I don't believe they have any ability to measure relative strength of the reflections, just a simple comparator aided by a gradual increase in sensitivity (by lowering the threshold) as time elapsed after there transmission, eventually giving up after a preset limit. They're fine for what people use them for, simple to use, but fairly crude technology wise. They're built to a price point, and it shows.I haven't dug through the Arduino library code, but I'm confident that the pulse widths measurements are equally as crude, influenced by random inaccuracies caused by interrupt handling routines. I would think that by using the capture feature of the atmega chip, consistency would greatly improve.
I have no experience with the TOF module.
Glad to see that, I have a half dozen of the old sound sensors that I got once when I thought about robots but never went forward. Now I don't have the funds to buy the laser anyhow. Thanks for the entertainment and knowledge!
Thanks for this. Confirms the problem I've been having with my TOF sensor. This, unfortunately, makes it much less practical for my project. I'll have to do what I can with the HC-SR04
I 3d printed some shades and managed to reduce the detection angle of hcsr04!
This was an interesting comparison.
I am wondering if the sensors may have been picking up your supporting timbers that you used at each set point. Are they even needed with the way this is designed? Might be better to replace the timber supports with just lines to align each measurement point and see how it goes with that.
It was an interesting comparison. I had high hopes for the TOF laser sensor. Apart from the speed of the readings, the two sensors were quite similar in accuracy, given you couldn't go further than 50cm with the ultrasonic one.
Could the distance be off for the long because of your mounting brackets, the right angle at the leading edge might be the problem. Put in a triangular leading edge taller than the square rear spacer or remove the rear entirely.
This is likely it. It's sound. It's not super directional and it will read any echo that comes back.
Brilliant as usual, I was also a little surprised by the result
The test starts at 21.18, up to then this guy is TAAAAAAAALLLLLLLLKKKKKKIIIIIIIIIG. A lot !
I have been pondering which sensor to go with; but the i2c factor for this project of mine made the choice for me. Thank you universal coincidences.
The problem with the HC-SR04 is that you often have "outliers" in the measurements and have to recognise and filter them out yourself. There are also big problems when the measurement falls on a surface that is positioned at an oblique angle to the sensor. I had hoped to find out in this video whether the laser sensor performs better. But unfortunately not.
According to the article you are using "331.4 + (0.606 * temp) + (0.0124 * hum)" to calculate the speed of sound. Could you give a quick explanation where you found these numbers? I did find the .6*temp+331 in some other reference but have been unable to track down the humidity calculation.
I thought I might be able to use the TOF10120 for an application where I'd previously tried an HC-SR04, but was disappointed its apparent lack of accuracy. Then I found the VL53L0X laser board, and wondered if you'd tried that. It's supposed to work up to 2m, so seems to serve a similar function to both these devices, and it's cheaper than the TOF10120. Has anyone tried comparing them?
I haven't verified this, but it seems that many sensors will find "edges" and report their distance. The white pieces, you used to hold the target, could be causing that effect.
I concur with this. basically, it's what you were saying about the field widening. i'm surprised you didn't try placing a piece of board or paper to cover the unused brackets between the sensor and the target.
Thanks Bill, yet again another great presentation
It would be nice to see a tabular result comparison.
More data of course is alway nice - I wondered about the angular spread of the ultrasonic sensor. ...There seemed no excuse for the poor laser performance.
BTW -- Saw your icon and immediately thought of Tin Hat Ranch who used that as their logo - sure wish he was back on UA-cam, he was very creative.
Thank you so much for the effort you put into this test, I'm very appreciative of the knowledge I gained from your work thank you again.
Great demonstration. I wonder if the LASER was designed for close range work?
Due to the fact that it's very small it could be mounted inside a device and the LASER could be used to adjust a electrical / mechanical component.
For example elevator door. Measuring the distance to close the door, slowing it down or speeding it up.
I own a HC-SR04 too and as far as i know those devices are rated up to 7 meters. At 26:13 the reading didn't even change if you go to 100mm. I would suggest trying another lib and check the calculations that are done with the temperature and humitiy sensor. Maybe there is some sort of mathematical maximum hidden in it. Another possibility could be that it catches the white place holder.
Just had another thought. I wonder if those edges were the cause of error of the TOF sensor. Might want to rerun the tests with the white guides removed.
I knew I'd find this comment. The readings were suspiciously close to 50 cm.
I've not looked much at these - but I was expecting they'd both work far better than they did. The broad spread of the uSonic sure negated numerous applications, as did the short range of the laser - who'd think a laser would be so limited in this regards. Thanks that both fun and very informative.
Agreed. ~6% error on the laser at 75cm really surprised me especially.
It is possible to improve the HC-SR04 by decreasing it's measuring angle. To do this one can simply roll up some card stock into a tube and slip it over the transceiver/receiver cylinders. Longer card stock tubes result in a higher directionality of the measurement.
It would be perfect if an infrared sensor can be added to the test... thanks for the incredible effort to make these videos. Thank you. Btw, I have doubts the ultrasonic sonic spec max distance sensing is 400cm...
Have you tried the US-100 ultrasonic distance sensor? In my limited experience, it seems to be both faster and more accurate than the HC-SR04, and compensates for temperature on its own in serial UART mode.
Very interesting workshop today. Thanks Bill. It seems like these sensors are barely useful for anything more than proximity sensing. The laser module looks pretty much like what you see on automatic plumbing fixtures in public restrooms.
In my University we create many robots using these sensors. From automatic book transporter to a self driving car.
One thing we must take into account is that no sensor has a real linear response. Usually the manufacturer datasheet has a table or graphical representation of the readings versus the real values. That info should be included in the software, usually in the form of a lookup table, to compensate for the natural non linearity of the sensor.
And, yes, a LASER based sensor will always out perform a ultra sound one, but not by $10.
I've tested a M5stack tof vl53lox it's accurate to about 150cm after that it's readings start getting erratic.
Also please compare it with VL53L0X sensor too.😊
I would assume that the different reflectivity between foam and wood wall causes the different reading as it would change the amplitude of the reverse signal. Nice measurement though!
You need to lift the sensor higher off the surface. The error appears to be exactly the distance to the quarter round behind the 500 mm Mark.
Alternatively, put down a black or charcoal felt as acoustic damper. The Ultra-sonics are easily good to 200 cm
I love how you don't use any library, help a lot to work on serious devices instead of only Arduinos.
For optimum accuracy you must know the angle of transmission cone pattern on the sensors
Often you will pick up the ground suface too early in most applications with low mounted sensors, which gives false readings.
The sensors TX pattern is not that narrow as you may think.
Consider this a 'heads up' to anyone getting their TOF10120 working for the first me. I found that the compile fails because of a reference to "fdevopen". ('fdefopen not declared in this scope'). I am not a seasoned Arduino coder and I really didn't know what to do to fix it. In researching it I couldn't 't even figure out just what it was supposed to do. Anyway, just for grins, I just deleted it and any references to it and what-a-ya-know... the sketch works just fine without it.
Can it see through glass?
One of the disadvantages of the US sensor in practical use in robotics is that hard surfaces work as a mirror. If these are under an angle it measures the reflection rather than f.i. the wall itself.
Great content and testing. Yet, I believe that detection at an angle should be included in the tests.
Nice to see you accurately reporting your preconceived bias. ie "I assumed the laser sensor would run circles around the ultrasonic sensor". I thought everything was just opinions these days, and reality or facts were a thing of the past :)
Moving the HC-SR04 upwards will show targets at 75cm and 100cm.Now false reflection on wood plank are the cause.
Great stuff. I'm more than impressed of the quality of your videos. Have you ever thought about using the LIDAR stuff together with the jetson nano?
Which tool are you using to create your beautiful animations? This might be something useful for my class room presentations.
I don't know if he is using it, but Fritzing is somewhat similar for the circuit presentation.
Can a tube be added to the transmitting ultrasonic transmitter in order to restrict the wide spread of the sound transmission and thus improve accuracy?
This would be a worthy test!
No, but if can tune it to the frequency, think cantenna
I like all of your videos. I just have one question. Why do all the videos measure distance for you or for others? They do not approach small or precise distances, i.e. from zero to five centimetres. Are there such sensors? Please explain. Thank you.
Thanks, I learned a lot. I would like if in tests you could do speed as well, to see how fast they react. Thank you again
Great video DroneBot! Can either of these be used behind a sheet of protective glass/plastic? Or will the sound/light reflect off a see-through surface? I'm trying to find devices that can be placed at multiple levels inside a canister of dry goods (e.g., dog food), and am thinking I'll need to separate the sensor from the stored material by a sheet of glass or plexiglass.
It would be interesting to see how the sensors compare to measuring objects that are not directly facing the sensor. Say if the plywood is place 25 cm away and then slowly turned on the Y axis, how many degrees off could it reach before the sensor in not able to read it. Similarly, how well do the sensors detect rounded objects, like a garbage bin?
Are you measuring water level? Laser might measure depth of the container while ultrasonic would measure water level. Both might be needed.
Very interesting find Bill.. thanks for sharing this.. carry on..
Nice vid. Quick question. Does anybody know if the Tof10120 can detect water surface levels? Mounted pointing down at the water surface. Thanks for any comments / followups.
I've tried that and it didn't seem to work well (i.e., the measurements were way off). The light just passes through the water until it hits the bottom of the container if it's in range. If you're trying to measure the level in a smaller body (e.g., a few feet), I'd use eTape liquid level sensors.
@@cdfairchild Thanks for the feedback. I am going to test independently with multiple ToF sensors as well as the ultra sonic HC-SR04 and will report back as to my findings especially since the sensors are soooo cheap. However, I thought a lot more about it and I think I am going to be using load cells. Knowing approximate densities as the fluids relate to water and knowing that 1 mL = 1 gram for water and being able to measure to the 1 gram increment on the load cells I should be able to make these measurements with a high degree of confidence. I will report back early part of February as to my findings. Thx for your feedback
Thanks. Great as always!
Thanks mate,superb video.
A small point, but the HC SRo4 seemed to be pointing upward a bit on the test rig. Could be that it is shooting over the top of the board at the longer distance?
Please, What is the maximum distance can HC-SR04 measure in the open area???
Thank you so much for the video sir.. plz make a video on HC-12 433 SI4463 Wireless Serial Module
Is it surprising that a "Time of Flight" sensor is only effective at close range? If it's designed to tell how long your quad copter or whatever has been in the air, do you really want it to potentially confuse trees and structures with the ground?
Think of a macro lens on a camera: you can focus it very close to the subject, and not farther away.
Remember that the Time of Flight sensor is an optical device with a very narrow field of view, which indicates it's designed to focus at a short distance.
Remember that the ultrasonic sensor had the exact opposite problem: at longer distances, the target wasn't wide enough for the ultrasound signal to be bounced back.
Good job. Informative experiment.
I suspect the ultrasound sensor is picking up the white colored holders on the base board, if you had the sensor twice as high from the base, the sensor would miss the obstacles on the base board. it is a quit narrow vertical angle from the transducers.
To me that is the most likely cause of the max measurement
Kind regards Hans
Library for both are same else for TOF which library should be included
Would be interesting to use another. movable transducer and see if you can measure the beam pattern maybe sidelobes picking something off the bench that's bigger than the main return ?
Would have been interesting to know how they behave with thinner objects, thinner or smaller in both vertical and horizontal direction
I wonder if the stray hc-sr04 reflection at 50+cm is the vertical face of the quarter round making the slot at 50cm (I have not read the comments yet; maybe someone else already suggested this)?
What happens at the extreme, ie the 400 cm distance quoted for the SR04? I have the SR04 and an SR08 with supposedly double the distance, but can't get more than 6 feet in my shop. According to tech support it's because the sensor is seeing the floor or the ceiling, something I dispute because I have an 8 foot ceiling and my sensor is right on the edge of my desk, 32" off the floor. They work great at short distances but the divergence could be an issue. I'd like to see some experiments with cone reflectors and push the limits to the extreme. As a result of my own tests and these issues I decided to go with microwave (radar) and also laser (bouncing off a mirror and back) for vehicle detection on a busy highway.
I'd prefer watching tutorial video from old men to young men :) Thanks for the tutorial
Helpful video 👍
Would not be a fair comparison but ive found the vl53l1x sensors to be accurate past 2 meters no matter the surface reflectivity
would have nice to also show performance with the obstructions at an angle
in real world cases objects are rarely perfectly perpendicular to the incidence plane
Could it be the power socket in front of the table? It is about at 52 cm mark if you can see
very nice dimension sensor video...👍 do you have a video on line-scan cameras or document line-scan 8.5" wide sensors? would opencv work with these sensors? thanks...:)
fantastic explaination sir, i leaned so much new things from your vidios......i would like to tell you to please tell us how do u refer datasheets from your veiw , so could learn from your experience.... thank you so much
Hello. Thank you very much for another great video. Could you please let me know what application you use for the wiring schematic, where you show connections between the board and sensors?
Local electronics store? Which stores can I buy arduino components from that are local in North America?
Have you tried to figure out what the maximum read frequency is? And the actual angle of view?
Hi will it work in underwater to measure distance I am working on a school project building submarine with distance measurement TOF10120
Nice job. Thanks
I'd really like to find something with a range of about 100 meters that isn't real expensive and is weatherproof.
you and me both :-)
Interesting. I was expecting a very accurate laser sensor. Users will have to implement software compensation to be able to use it.
I tried to use your code with tof10120 but in serial monitor value is showing only 0mm, can anyone help where is the problem,
great test
Thanks for the video. It was a very usefull information.
A possible very useful application for the TOF10120 is in pressure tanks tipple used for spray painting. It is difficult to tell how close to empty the tank is. This sensor would seem ideal if it can tolerate air pressures around 100 PSI. Is there any information about pressure or can someone reasonable guess what might happen?
Hey, nice video. I missing something about reflection details. Like u said, everyone is very familiar with these ultrasonic sensors but they bring some problems like reflection in specific angles with them. I try to make a rc car to drive autonomic and this issue brings me to gather new informations about other types of meassure tools like lidars or laser.
Now there's an infrared proximity sensor that is very similiar to the hc-sr04 in price (i don't know what's it's official name is) and seems quite easy to use (according to my little experience at least...). I wonder if you could review that sensor as it is quite responsive hence could be used for high speed sensing.
I have a doubt, how well TOF works when its exposed to solar ligth?
Hey there Dronebot,
Would the orientation of the sensor change the results, for instance orientating the device 90 degrees from tested pin placement? Or tilting the sensors slightly off the perpendicular axis (up, down)? Also I'm curious if you covered the rungs on your test bed from sensor to target might improve the results. I've played around with the HC-SR04 and looking to use it in a home application. Thanks for producing these informative videos!
very usefully video, thanks
you are amazing teacher
Would it be possible to check the laser distances device light pattern that it emits with a solid state camera? Much like you would check to see if you're TV remote control is working, just incase something odd is happening.
next calculate distance with images of 2 cameras ;)
Thanks for the video... do you think a motion sensor or break beam could be made by using one these? Im looking for a simple result as either an open circuit or closed circuit.
Sir can you please make a tutorial on control of continuous servo motor clockwise-stop-countercw control with joystick on Arduino mega board. It will be really helpful for the learners. Im trying but not getting done. Kindly help sir. 🙏🙏🙏🙏🙏
Can any of these sensors detect a level of fluids in the tank? Let say I need to know how much fluid is in the tank and have an alarm if certain level is reached. Which of these two sensors will be better?
Is important to placement of ToF sensor (Vertical or horizontal) to measure distance?