Written By: Milton Ramirez (Electronics & Control Engineer)
Verified By: Ernie Trujillo (Project Manager)
Approved By: Miguel Garcia (Quality Assurance)
The ultrasonic sensor works by one side sending an Ultrasonic sound and the other side recording the distance by how long it takes to listen to the echo. The sound that the sensor produces is so low that it cannot be heard by human ears.
- Arduino Uno R3
- 4 alligator wires
- 4 jumper wire t
- Ultrasonic sensor
So, for my test, I connect an Ultrasonic sensor to an Arduino Uno microprocessor. Then upload a code that was found in a library called new ping that already had a code called newpinnexample that worked with the ultrasonic and then displayed the values in the serial monitor in Arduino. This code has the delay at 50 ms but I changed this to 300ms, so it can be a little easier to keep track of all the values that are being displayed in the serial monitor in the Arduino program. Another thing I needed to change was the max value since the code had it set to 200cm. I changed this to 500 since most product descriptions for this sensor say that the max distance is between 400cm-500cm.
For the most part, most of the results I got were similar to what the product description said, the minimum value I was able to get was 2cm. Anything lower than that would result in 0 cm.
As you can see in Picture 3 there seem to be a +/- 1 margin of error in the reading in the Ultrasonic sensor.
As you see, the max value that I was able to record was 403cm which is in between the max range in the sensor description, which is supposed to be between 400cm-500cm.
In conclusion, the Ultrasonic sensor seems to be a great option to use in the collision avoidance part of the class’s projects. The only problem with the sensor is that it needs 5V to operate and cannot be directly connected to any pins in the 3Dot board since the 3dot can only supply 3.3V. It might also be tedious to code since you might have to make a condition statement that can overcome the margin of error in the readings.