15 May
15May


Hello everyone today i will tell you how to make Arduino portable Radar using ultrasonic sensor and oled display.

Material Needed :-

1) Arduino Uno

2) Ultrasonic sensor Hcsr04

3) Oled Display 128x32 i2c

4) jumper wires

5) Arduino Usb

6) servo motor sg-90


First we connect the Oled Display with Arduino. Do connections as follows :-

OLED Display - Arduino

               Vcc   -   3.3v

               Gnd  -   Gnd

               Scl    -   A5

               SDA  -   A4

Connection of Ultrasonic with Arduino :-

Ultrasonic sensor - Arduino

                      Vcc   -   5v

                      Trig   -   8pin

                      Echo -   9pin

                      Gnd   -   Gnd


Connection of servo motor with Arduino

Servo motor - Arduino

             Gnd   -  Gnd

             Vcc   -   5v

          Signal  -  11pin

Circuit Diagram :


Below is the program download link :-

Program Download link :-

arduino_radar_oled.ino



Program explaination :-

In the program First we include all the library which are required in the project.

After that in void setup we intialize all the pins and our Display.

In void loop() we have created 6 loops for the Radar line to move from the left to right and then from right to left. We have use first three loops for right to left and other three for left to right.

we have created a function at the bottom for the measurement of Distance from the ultrasonic sensor and we are also Displaying the value of the Distance value to the Oled Display.

Whenever we call the Distance function it returns the present Distance value.

LETS TALK ABOUT FIRST THREE LOOPS >>>>
First loop is created to move the line from coordinate (0,10)  to (0,0)

*IN THIS FIRST WE MAP THE SERVO angle value According to the loop value by using map() function.

*Then we Get the the Distance value from ultrasonic sensor By call Distance_value() function and check  for the condition if Distance is Greater than 40 cm then we did not draw circle in the Line.

* If the Distance is Less than 40 cm then we have Drawn the Circle on the Radar Line and Also Drawn the Warning sign on the Left Side.


 Second LOOP

IN the Second Loop we move the Line from Coordinate (0,0)  to (128,0)


For the Servo and Condition we Did same as we Done in First Loop.


THIRD LOOP

IN the Third Loop we move the Line From Coordinate (128,0)  to (128,10)



For the Servo and Condition we Did same.


FOR THE OTHER THREE LOOPS WE REVERSES THE VALUE FOR MOVING THE LINE FROM RIGHT TO LEFT.

THANK YOU

Comments
* The email will not be published on the website.
I BUILT MY SITE FOR FREE USING