In this project we are going to make a simple radar to detect obstacles.
Range depends on the range of the Ultrasonic sensor we used (in this project : 3 meter) .
Step 1: Components
1 - Arduino Uno
2 - Ultrasonic Distance Sensor ( link : https://www.parallax.com/product/28015).
3- Servo Motor.
Step 2: Wiring and Connections
1- Connect Ultrasonic sensor (5V and GND) to Arduino (5V and GND).
2- Connect Ultrasonic sensor (SIG) to Arduino (Digital pin 8).
3- Connect Servo motor (5V and GND) to Arduino (5V and GND).
4- Connect Servo motor (SIG) to Arduino (Digital pin 9).
5- Connect Arduino Uno to your Computer using USB cable.
Step 3: Coding
There are two code files attached in this step :
The first one for Arduino and the other of MATLAB.
for Arduino code :
you don't need to modify it , just upload it on Arduino.
for MATLAB code :
you need to modify line 28 ( s1 = serial('COM12'); )
to your new com port # .
NOTE : Before closing MATLAB, close the serial port by writing "s1.close()" in MATLAB workspace.