Introduction: HC-SR04 VS VL53L0X - Test 1 - Usage for Robot Car Applications

About: If you want to do people to build ships,... All you need to do them to crave greatness and the vastness of the sea Antoine de Saint-Exupery

This instructable proposes a simple (though as scientific as possible) experimenting process for comparing roughly the effectivity of two most common distance sensors, which are of a completely different physical functioning. The HC-SR04 uses ultrasound, means sound (mechanical) waves and the VL53L0X uses infrared radio waves, that is electromagnetic very near (in frequency) to optical spectrum.

What is the practical impact of such a ground difference?

How can we conclude which sensor fits best to our needs?


Experiments to be done:

  1. Distance measurements accuracy comparison. Same target, plane of target vertical to distance.
  2. Target material sensitivity comparison. Same distance,plane of target vertical to distance.
  3. Angle of the target plane to the line of distance comparison. Same target and distance.


Of course there is much more to be done, but with these experiments can somebody take an interesting insight to sensors evaluation.

At the last step is given the code for the arduino circuit that makes the evaluation possible.

Step 1: Materials and Equipment

  1. wooden stick 2cmX2cmX30cm, which serves as a base
  2. peg 60cm long 3mm thick cut in two equal piece
    1. the pegs must be put firmly and vertically in the stick 27cm apart (this distance is not really important but is related to our circuit dimensions !)
  3. four different types of obstacles the size of a typical photo 15cmX10cm
    1. hard paper
    2. hard paper - reddish
    3. plexiglas
    4. hard paper covered with aluminum foil
  4. for the holders of the obstacles, I made two tubes out of old pencils which can rotate around the pegs

for the arduino circuit:

  1. arduino UNO
  2. breadboard
  3. jumper cables
  4. one HC-SR04 ultrasonic sensor
  5. one VL53L0X infrared LASER sensor

Step 2: Some Information About the Sensors...

Ultrasound distance sensor HC-SR04

Old time classics of economy robotics, very cheap although deadly sensitive in case of a wrong connection. I would say (although irrelevant to the aim of this instructables) not ecoomic for the energy factor!

Infrared Laser distance sensor VLX53L0X

Uses electromagnetic waves instead of mechanical sound waves. In the plan I supply there a wrong connection that means according to the datasheet (and my experience!) should be connected to 3.3V instead of 5V in the diagramm.

For both sensors I supply datasheets.

Step 3: Apparatus Affect on the Experiment

Before beginning the experiments, we have to check the influence of our "appliance" on our results. To do this, we try some measurements with out our experimental targets.
So after leaving the pegs alone, we try to "see" them with our sensors.
According to our measurements at 18cm and at 30cm distance to the pegs, the sensors give irrelevant results. So they don't seem to play some role to the our coming experiments.

Step 4: Distance Accuracy Comparison

We notice that in case of distances smaller than 40cm or so, the accuracy of the infrared is better, instead of the longer distances where the ultrasound seems to work better.

Step 5: Material Dependent Accuracy

For that experiment I used differently colored hard paper targets with no difference in the results (for both sensors).
The big difference, as expected, was with the plexiglass transparent target and the classic hard paper target. The plexiglass seemed to be invisible to infrared, instead of the ultrasound to which were no difference. To show this, I present the photos of the experiment along with the related measurements.

Where the accuracy of the infrared sensor dominates the competition is in the case of strongly reflective surface. That is the hard paper covered with aluminum foil.

Step 6: Angle Related Distance Accuracy Comparison

According to my measurements there is a much more stronger dependence of the accuracy on the angle in case of the ultrasound sensor, instead of the infrared sensor. The inaccuracy of the ultrasound sensor increases much more with the increase of the angle.

Step 7: Arduino Code for Evaluation

The code is as simple as possible. The aim is to show at computer screen simultaneously the measurements from both sensor so to easy to compare.

Have fun!