Goliath Fall 2016

MaxSonar Sensor Field of View Experiment

By: Sou Thao (Electronics and Control Engineer)

Approved by Kristen Oduca (Project Manager)


Requirement: Goliath shall follow the Biped at a fixed distance of 20 inches with a margin of error of 15%.

In order for Goliath to track the biped, we needed to understand its field of view of the sensors.  In other words, we want to know the viewing angle for each MaxSonar Sensor.  The sensors are the eyes of the rover, and by determining the viewing angle, we are able to get an ideal location of where BiPed can be placed so our sensors can see it.  

Setting Up the MaxSonar Sensor

Before setting up the experiment, we have to wire up and test our MaxSonar Sensor.  Because these sensors run on I2C, we connected the pinouts of the SCL and SDA from the MaxSonar Sensor to the Arduino Leonardo [1].  We also powered up the sensor with the 3.3V pin from the Leonardo, and grounded the last pin of the sensor.  After we wired up the sensor, we have to write a code using the Wire.h library in order to communicate with the device through I2C [2].  We first declare the address of the sensor and then begin the transmission to start ranging the sensor.  Then after the sensor begins to operate, we write the information that the sensor is sending back to the variable SensorDistance.  The sensors sends back two bytes of data because it can detect distances up to 25 feet.  However, we can discard the higher byte because we do not need the bigger distances. This is displayed in our Fritzing and Breadboard photo shown in Figures 1 and 2.

Figure 1 - Fritzing Diagram

Figure 1 – Fritzing Diagram

Figure 2 - Bread Board Photo

Figure 2 – Bread Board Photo

Thus our code is:

#define Address 0x71


byte rangeCommand = 0x51;

int SensorDistance,discard;

void setup() {




void loop() {












For setting up the experiment, we took 9 pieces of paper and taped them together.  Next we put the sensor at one end of the paper and took an object and moved it across the paper.  For the object, we used a caliper which was thin enough to represent a small object.  As we moved the caliper across the paper, we made marks of where the sensor was able to detect the caliper.  We also marked points right where the sensor was not able to detect the object.  From this, we drew an area with a green marker, which represents ideally where an object can be for the sensor to detect it.  This is shown in Figures 3 and 4.

Figure 3 - Pieces of Paper Taped Together

Figure 3 – Pieces of Paper Taped Together

Figure 4 - Placing Object for Sensor to Detect

Figure 4 – Placing Object for Sensor to Detect

After mapping out the areas of where the sensor can detect objects, we next drew a triangle using a black marker on the paper to where it would be best to put an object.  By doing this, we can find the viewing angle of the sensor.  The angle θ in the picture is the angle we want to find.  By drawing a line out 30 inches from the sensor to the end of the paper, we measured the distance across the 30 inches line which came out to be 15inches.  Next we measured the side lengths of the triangle and found the distances to be near 30inches.  Because we have the lengths of each side of the triangle, we used one of the geometry rules to determine the angle which came out to be about 30 degrees. The final results are shown in Figure 5.

Figure 5 - Final Results

Figure 5 – Final Results


By conducting this experiment, we were able to determine the viewing angle of our sensor.  The viewing angle is about 30 degrees, meaning that the sensor can detect any object within its 30 degrees field of view.  Thus, we can adjust the sensors and place it at different locations on our Goliath to detect other objects.  Also, from the field of view, we will be able to determine the amount of distance to separate the two sensors and code them to automate the movement of our Goliath based on the tracked object.