How to Make a Simple Radar Using Ultrasonic Sensors

Introduction: How to Make a Simple Radar Using Ultrasonic Sensors

About: someone who likes electronics Yt channel : https://www.youtube.com/c/mrsottong IG 1 : sottong_teknik

In this article I will make a simple radar using Arduino Nano. The purpose of this radar is, when there is an approaching item, the LED will light. and when there is no object approaching, the LED will off.

I use an ultrasonic sensor to detect approaching items. and for the display I used RGB ring WS2812.

I suggest reading the 2 articles below first before continuing reading this article.

Step 1: Required Components

This is a list of components prepared to make this simple radar:

Library required:

Step 2: Assemble All Components

follow the instructions below to assemble all the components:

Arduino to Ultrasonic Sensor

+5V => VCC

D11 => Trig

D12 => Echo

GND => GND

Arduino to Neo Pixels

D6 => IN

+5V => VCC

GND => GND

Step 3: Programming

Enter the sketch below into the sketch that you made. then click upload

#include
#ifdef __AVR__ #include #endif

#define PIN 6

#define NUMPIXELS 16

Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

const int trigPin = 12; const int echoPin = 11; long duration; int distance;

void setup() { #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000) clock_prescale_set(clock_div_1); #endif

pixels.begin(); pixels.setBrightness(10);

pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin, INPUT); // Sets the echoPin as an Input Serial.begin(9600); // Starts the serial communication

}

void ultra (){ digitalWrite(trigPin, LOW); delayMicroseconds(2);

digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance= duration*0.034/2;

Serial.print("Distance: "); Serial.println(distance); } void loop() {

ultra();

if(distance < 8){ for(int i=0; i 8) { for(int i=0; i

Step 4: Result

the results can be seen in the video above

When an object approaches. The red LED will turn on.

thank you for reading this article, if you have questions just write it in the comments column.

Be the First to Share

    Recommendations

    • Microcontroller Contest

      Microcontroller Contest
    • Automation Contest

      Automation Contest
    • Make it Glow Contest

      Make it Glow Contest

    Comments