Output Devices
I used a sonar sensor to detect the proximity of a nearby object! I had to display this using the LCD. Apparently the LCD didnt work out, but I was able to get an accurate output on the serial monitor!
Theory:
Here , we are going to calculate the distance of the sensor and any object in front of it.
At t1 we send the trigger signal , and at t2 we get the echo.
so dt = t2-t1
And as dt is the time for the sound taken to reach to the object and return back;
The exact time taken by the sound to reach the object is : dt/2
Now , Normal speed of sound is: 340.29 m / s
And converting it to Centimeters per Micro Seconds gives : 0.034049 CM / microseconds
The actual distance traveled by the sound or the distance between the sensor and the object is:
(dt/2) * 0.034049
Which is the exact formula used in the software.
My challenges in this project!
- Soldering
i was terrible at soldering and almost completely shorted my arduino! But then with the help of Andrei, I was able to immprove my soldering abilities! After using the solder braid and to suck away all the extra solder, luckily I found that the Arduino Micro I was suing had not yet fried up! - Using the Sonar appropriately
It was important to learen about the PulseIn function. Which gave the time and the multiplying that by the speed of sound gave me the distance from the object!
My final idea is to integrate these components onto my project so as to add the feature of collision protection! I could control the motor with relative to the distance from any nearby object!
The codes are as below:
The above is with LCD but the below is the code in which I use the serial plotter!
>
Professor Rob had helped me a lot in figuring out the issues with the setup I had and evetually even help me come with the working design! We went overtime for the same! Really appreciate his help in the same