This project is meant to simulate a 2D representation of a radar. The ultrasonic sensor is going to be the emitter and receiver of signals for this project. The sensor is placed onto a servo that moves in a 180 degree arch which allows for somewhat accurate simulation of the real thing. The signals from the sensor go to the Arduino board, which in turn sends the signals to the lcd screen Which acts as our output device, which imitates the look of radar.
The first idea that i started from was from a forum post where someone mentioned a radar being made with an ultrasonic sensor. with someone showing a photo of a sensor and a servo in the comments.
It can be useful by scanning for approaching objects and alerting individuals visually from where the object is coming from and trough audio means, thus grabbing their attention.
The Ultrasonic sensor sends a signal to the Arduino which processes it and then sends the appropriate response to the buzzer, servo and LCD
Schema electrica
Picture of project hardware prototype:
Picture of project hardware final:
The code for this project is as follows: libraries, declaring the ports that will be used, setup for the LCD and servo. In setup, we give each pin/port its use for each component and give the LCD its initial background colour. The buzz function gives us a way to use a buzzer with any frequency and time of our choosing whenever it is needed in the loop function. In the loop function, the first thing that is done is give the LCD its background elements that make up the interface that the user sees
TFTscreen.background(0, 0, 0); TFTscreen.stroke(255, 255, 255); TFTscreen.circle(80, 128, 102); TFTscreen.setTextSize(2); TFTscreen.text("Dist(cm)", 0, 0);
Which is followed by the code for the right rotation of the servo, which includes more visual elements such as the rays used to indicate the distance between the sensor and the object it detects, with it putting a red circle at the end of the line to indicate the exact spot where the object was seen and activating the buzz function:
void buzz(int freq, int time) { tone(buzzer, freq); delay(time); noTone(buzzer); }
The left rotation code isn't different from the right rotation code, with it doing essentially the same thing . At last, there is the calc_dis function which calculates the distance from the sensor to the object.
Arduino ide was the main environment in which the code part of the project was made
The libraries that were used for this project were:
#include <Servo.h> #include <TFT.h> #include <SPI.h>
Overall the project works as intended, with it doing what i originally had planned for it. The ultrasonic sensor acting as an input for the Arduino and for the LCD moves in the proper 180 degree arch that is required of it by the code and graphic design of the graphic displayed to the user. The buzzer doesn't work as originally intended, but instead alerts us when an object is within the specified distance of the radar, which causes it to activate with every input that passes the checks in the code. This whole project needed a bit of creativity to get it fully working and into a presentable shape, with the support for the sensor and the whole casing for it being made from stuff around the house, the support being made from cardboard and the casing from lego pieces. With the modularityy of the casing , the components within can be repurposed for a myriad of different purposes.
In conclusion, this project was quite the learning experience, with it teaching me new skills that i would have learned much latter otherwise and how to improvise and make do with an unfinished product due to for some time missing a crucial component. Other than that, the radar works as intended, with some future iterations changing the ultrasonic sensor with something more similar to the real deal. Overall, this was a great experience, and has created new opportunities for self growth and development .
HC-SrR04 Datasheethttps ://datasheetspdf.com/pdf-file/1380136/ETC/HC-SR04/1
Servo https://datasheetspdf.com/pdf-file/791970/TowerPro/SG90/1
All libraries were downloaded from the Arduino IDE