Sonar with Arduino
This project describes the construction of a sonar scanner with an arduino and a us-100 ultrasonic sensor.
The sensor is available from Dealextreme. The arduino transmits the
information to a program written In processing where it is plotted.
The ultrasonic sensor works by sending out a sound and then waiting for the sound to be reflected back
from an object. The time between the pulse is send out and a pulse is received can be measured and the distance
can be calculated. In figure 1 the speaker transmits a sound wave going to the right, and it its an object sending a
wave back to the left. Read more about the sonar here
Figure 1: Sonar, principle of operation.
The sonar is placed on a servo motor to be able to make a 180 degree sweep. The setup is shown in figure 2.
The wireing is done as in a similar project from Mr. Par Michael Clergeot. His porject can be found
Figure 2: The sonar mounted on a servo motor.
The processing program receives points from the sonar by an angle and a distance to the nearest object. This is then
converted to a point in the xy-plane. A screen dump of the program is shown in figure 3. The dots changes color dependent
on how old they are, since the sonar can only update one dot at the time.
Figure 3: A screen dump of the prosessing program.
The code for the arduino is shown below. The sketh can be downloaded here.
The code for processing is shown below. The sketh can be downloaded here.