The goal of this project is to design a robot car that can detect the blockage in the front of it and avoid hitting the blockage. The goal is achieved using two HC-SR04 ultra-sonic sensors. The sensor is powered by a 5V power supply and it contains one transmitter and one receiver. There are four pins on the sensor which are VCC pin, trigger pin, echo pin, and ground pin. The detailed connection can be seen in the video. A GPIO is set as the trigger for the sensor and it will send out a high signal with a duration larger than 10µs to trigger the sensor. Once the sensor receives the trigger, the transmitter will send out 8 cycle sonic bursts. After a short delay period, the echo pin on the sensor will send out the high signal until the receiver receives the sonic wave bounced back from a blockage. The distance between the cart and the object is calculated using the following equation.
Distance = high level time(s)*350(m/s)/2
A fixed distance is set in the control code and used as a decision point. When the measured distance is smaller or equal to the set distance, the car will turn to avoid hitting the object. Otherwise, the car will keep moving forward with a set velocity. The detection range for the ultra-sonic sensor is only 15⁰ which is quite narrow. In order to avoid blind spots, two sensors are used to widening the detection range. More sensors are needed if the width of the car gets longer.
The control circuit is build based on the TI LaunchPad F28379D board. The code is constructed in the code composer based on C language. The full code is attached to the project folder.
Comments
Please log in or sign up to comment.