Radar System Using Ultrasonic Sensor & Arduino Uno
by Technoesolution2020 in Circuits > Arduino
2427 Views, 2 Favorites, 0 Comments
Radar System Using Ultrasonic Sensor & Arduino Uno
Hello friends welcome back to "Techno-E-Solution" , In this tutorial we are going to make cool project "Arduino Radar System Using Ultrasonic Sensor & Arduino Uno" using Processing Application. Radar is a object detecting system, It uses microwaves to determine the range, direction, speed, altitude of object. In Arduino Radar system we use Arduino Uno & Ultrasonic Sensor to detect objects and small servo motor to rotate ultrasonic sensor. You know the radar is long range object detecting system, Usually Radar system is used in Marine, Aircrafts, Missiles, etc.
If you like my project follow me for my latest project :-
Facebook :- https://www.facebook.com/TechnoShubham
Instagram :- https://www.instagram.com/technoesolution2020/?hl...
Instructables :- https://www.instructables.com/member/Technoesolut...
Dailymotion :- https://www.dailymotion.com/technoesolution
Youtube :- https://www.instagram.com/technoesolution2020/?hl...
So without wasting time, Let's get started.............
MATERIAL REQUIRED
To make this project we need some Components :-
- Arduino Uno
- Ultrasonic Sensor
- Servo motor
- Breadboard
- Frame/ Structure (Mechanix Toy Set)
SOFTWARE REQUIRED
CIRCUIT DIAGRAM
Follow the circuit for making a connection.
Next PCB
NextPCB is a high-quality PCB Manufacturer. With professional PCB manufacturing capabilities, our PCB engineers with more than 10 years of experience will double-check your engineering files.
NextPCB is certified by IATF16949, ISO9001, ISO14001, UL, CQC, RoHS and REACH; more importantly, we handle the whole process including the PCB prototype, PCB manufacturing, PCB assembly, testing, and final shipment. We are capable of assembling BGA, Micro-BGA, QFN, and other leadless package parts. We also have an online parts shop, you can choose any parts you need.
If you want a Printed circuit board go through the NEXT PCB
ARDUINO CODE
Just Copy the following code & upload to the arduino Uno.
/* Hello friend Welcome To "Techno-E-Solution" Here is a code of "Arduino Radar Using Ultrasonic Sensor" */ #include <Servo.h> const int trigPin = 9; const int echoPin = 10; long duration; int distinCM; Servo radarServo; void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); Serial.begin(9600); radarServo.attach(11); } void loop() { for(int i=0;i<=180;i++) { radarServo.write(i); delay(50); digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distinCM = duration*0.034/2; Serial.print(i); Serial.print("*"); Serial.print(distinCM); Serial.print("#"); } for(int i=180;i>=0;i--) { radarServo.write(i); delay(50); digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distinCM = duration*0.034/2; Serial.print(i); Serial.print("*"); Serial.print(distinCM); Serial.print("#"); } }
Downloads
PROCESSING CODE
- Now open Processing Application.
- Copy the following code & paste into Processing.
- Hit the Run Button.
import processing.serial.*; import processing.opengl.*; import toxi.geom.*; import toxi.processing.*; ToxiclibsSupport gfx; Serial port; String serialAngle; String serialDistance; String serialData; float objectDistance; int radarAngle, radarDistance; int index=0; void setup() { size (1280, 720); gfx = new ToxiclibsSupport(this); smooth(); //println(Serial.list()); //String portName = Serial.list()[0]; String portName = "COM4"; port = new Serial(this, portName, 9600); //port = new Serial(this,"COM4", 9600); port.bufferUntil('#'); } void draw() { //fill(10,255,10); noStroke(); fill(0,4); rect(0, 0, 1280, 720); fill(10,255,10); //Radar Arcs and Lines pushMatrix(); translate(640,666); noFill(); strokeWeight(2); stroke(10,255,10); arc(0,0,1200,1200,PI,TWO_PI); arc(0,0,934,934,PI,TWO_PI); arc(0,0,666,666,PI,TWO_PI); arc(0,0,400,400,PI,TWO_PI); strokeWeight(4); line(-640,0,640,0); line(0,0,-554,-320); line(0,0,-320,-554); line(0,0,0,-640); line(0,0,320,-554); line(0,0,554,-320); popMatrix(); //Ultrasonic Lines pushMatrix(); strokeWeight(5); stroke(10,255,10); translate(640,666); line(0,0,640*cos(radians(radarAngle)),-640*sin(radians(radarAngle))); popMatrix(); //Object Detection Lines pushMatrix(); translate(640,666); strokeWeight(5); stroke(255,10,10); // red color objectDistance = radarDistance*15; if(radarDistance<40) { line(objectDistance*cos(radians(radarAngle)),-objectDistance*sin(radians(radarAngle)),633*cos(radians(radarAngle)),-633*sin(radians(radarAngle))); } popMatrix(); } void serialEvent (Serial port) { serialData = port.readStringUntil('#'); serialData = serialData.substring(0,serialData.length()-1); index = serialData.indexOf("*"); serialAngle= serialData.substring(0, index); serialDistance= serialData.substring(index+1, serialData.length()); radarAngle = int(serialAngle); radarDistance = int(serialDistance); }
Downloads
DEMONSTRATION
NextDFM Software From NextPCB
A PCB Design Problems Detector, An Engineering Solution Provider Import the Gerber file with one click. No need for complicated file reading steps to review easily and improve efficiency.
Download Software Help you quickly familiarize DFM design specifications and production needs to determine whether there are any manufacturing constraints
Features
Make PCB design more standard Prevent the quality flaw Impedance calculation function and lamination automation Automatically generate the best puzzle CAM350 free alternative version Check Gerber files anytime, anywhere and parse it with one click Instate Quote and evaluate delivery time Reduce cost and improve benefit these are advantage comparing to Eagle and Altium