The assignment of this week is to build and program a smart circuit using arduino , so I searched in the Arduino Project Hub and the project of Ultrasonic Radar which inspired me to try .
the idea to create a radar with ultrasonic sensor moving around on servo and connected to radar screen when it find an object the screen detect it.
For software: use Tinkercad to create the circuit and code it using blocks.
Use Arduino IDE to load the code to the Arduino.
For hardware: use Breadbord Arduino uno as the brain, ultrasonic sensor to detect objects, servo motor for motion, a buzzer for sound, red LED for light, jumpers for connecting components to the Breadbord and Arduino.
1-Connect red jumper from 5v pin in Arduino to positive of bread board,and ground to negative with black jumper
3-Connect ultra sonic sensor with Arduino, echo to pin 2 and trigger to pin 3.
5- Connect the buzzer with the breadboard the ground with negative, and the positive with Arduino at pin 5.
Finally, using Tinkercad code blocks to perform the circuit, I used the if condition for the ultrasonic sensor, if the ultrasonic distance <= 10 then set buzzer (pin 5) and LED (pin 6 ) HIGH, else set pin 5 and pin 6 LOW.
for the servo motor count up by 1 degree from 1 to 180 and wait for 0.8 sec then count down by 1 degree from 180 to 1.
2-Connect servo with Arduino in 4pin and with bread board with negative and positive.
4- Connect the ultra sonic sensor to the breadboard and the ground to negative and VCC with positive.
6- Connect the LED with breadboard to the ground to negative, and (+) with 220 Ωressistor connected to pin 6 in Arduino.
simulate the circuit
Prepare all components and get ready to connect them together, 5v of Arduino with positive breadboard and ground with negative
connect the servo with orange jumper to (pin4) and ultrasonic with (echo )green jumper to(pin2) and( trigger)purple jumper to (pin3) breadboard with ground and VCC with negative.
connect the buzzer set pin to the negative in the breadboard and the positive with a gray jumper to pin5 at Arduino.
Connect the LED set the negative pin to the negative of the board, and the positive pin with a resistor, and connect it with a red jumper to pin 6 of the Arduino.
copy text code from Tinker Cad, paste it into Arduino IDE, and connect it with Arduino Uno.
Select Arduino uno and upload the code to it.
Testing component
Final project
this assignment was very challenging for me.
it was the first time to set code on my own and this project needed to set two different codes for two separate functions.
The first challenge was the radar needed other programming code (Java code) that opened in processing software to get the green screen of radar, it was very advanced to me so I replaced it with a buzzer and red LED.
The second challenge was servo coding I wanted it to move one by one I tried it the wrong way first so I asked my instructor Ahmed Atef and he told me to try adding variation by the degree I wanted, and use the count9up\down) condition and it worked.
I searched and found many videos that had the same idea, and I learned how to simplify my idea if it was very advanced for me and try several ways until I reached what I wanted.