MATLAB/LEGO MINDSTORMS Exercise #10 Precision and Accuracy of Ultrasonic Sensors

Exercise_Precision_accuracy_of_sensor_3

This exercise is intended to help students to understand the difference between accuracy and precision by means of performing multiple measures of distances by using the LEGO MINDSTORMS EV3 Ultrasonic. In addition, the students should understand in which data format the measurements are recorded, stored and transfered between the sensor and the computer.

Exercise “Precision and Accuracy of the Ultrasonic Sensor”

  1. Build an experimental setup of an EV3 brick and an ultrasonic sensor. The sensor points towards a wall at a suitable distance.
  2. Write a MATLAB script, which performs a large number of repeat measurements of the sensor.
  3. Display the measurements over time and discuss the result.
  4. Evaluate the measurement series statistically and discuss the result.
  5. What is your conclusion about the suitability of the sensor for measuring distances? What can they be used for and what not?

Solution “Precision and Accuracy of the Ultrasonic Sensor”

  1. Build a small device comprising an EV3 brick with an ultrasonic sensor, connected through cables with each other and connected to the computer using an USB cable.
  2. Create a MATLAB script performing replicate (e.g. 1,000) measurements of the distance. You can also change the absolute distance between the wall and the sensor. Furthermore, you can compare the measurements with the results of measuring distances with a tape measure. As you can see by typing whos in the MATLAB Command Window the ultrasonic sensor records double precision data.
  3. Displaying the data over time and as a histogram reveals that the ultrasonic sensor has a maximum distance of 2.55 meters and rounds the distance values to full millimeters.

Download the MATLAB script and example file.