Distance detection using ultrasonic sensors
In order to come out with simple obstacle avoidance, I have started working on distance detection using 4 ultrasonic sensors, placing each at the front, back and the 2 front edges . Below are the calibration code for one of the sensor.
After testing the code, I found out that the distance detection were quite accurate until the sensor was placed in a scenario where the front space of the sensor was free, with nothing being placed within 400 cm. Erratic reading extracted from the sensors are shown as below.
This ends up causing the result inaccuracy, and will cause problems if we were to integrate this code into the automation control the next time. Hence, I need to find out a solution to mitigate the erratic readings problem.