This week's assignment is to build and program a smart circuit using an Arduino UNO which reads a signal from an input component to control an action component using code blocks.
My idea is to make a sensor park that uses in vehicles to assist you to park without crashing.
It's about an ultrasonic sensor that calculates the distance between the car and the object, the buzzer sensor, and the led work depending on the distance to warn you. So, the ultrasonic is the input, and the buzzer and led outputs.
I have searched and get inspired by these videos.
Software: Tinkercad
To simulate the circuit and write the code with code blocks.
Software: Arduino IDE
To upload the code to the Arduino UNO
Materials:
Mini Breadboard
Arduino UNO
cable
220 ohm resistor
Jumpers
Buzzer sensor
LED
Ultrasonic sensor
First, I tried to make the circuit and simulate it on tinker cad.
Wired the buzzer sensor and led to the Arduino to digital pin and GNDs.
Wired the ultrasonic sensor with 4 pins, Trigger as input, Echo pin is an output pin, Vcc to powers the sensor, and the Ground of the system.
I used the code blocks to write the code and made it 4 parts for 4 modes.
I have set the Arduino to read the inputs and outputs from the ultrasonic sensor.
I have made an If condition and puts distances. In every mode, the output changes depending on the distance.
In this mode when the distance is between 20 and 25 cm the buzzer and the led will beep and light with a slow rhythm.
1
In this mode when the distance is between 15 and 20 cm the buzzer and the led will beep and light with a little bit faster rhythm.
2
In this mode when the distance is between 8 and 15 cm the buzzer and the led will beep and light with a faster rhythm to warn that you are close to crashing with something behind you.
3
In this mode when the distance is between 3 and 8 cm the buzzer and the led will beep and light nonstop to warn that you almost crashed with something behind you.
4
After simulating the circuit on Tinker cad and making sure that everything is working correctly, I started building the circuit on the breadboard.
The ultrasonic sensor works as an input, the buzzer sensor and led work as an output.
Connect the buzzer sensor and the led with the Arduino to digital pins 13,8 respectively and GNDs.
Connect the ultrasonic sensor with 4 pins, Trigger as input (pin 9), Echo pin is an output (pin 10), Vcc to powers the sensor(pin 5v), and the Ground of the system.
After that, I copied the code from tinker cad and insert it in the Arduino IDE to upload the code to Arduino UNO.
After I have finished, my uni mate Basem suggested that when the vehicle gets too closer to something, the sensor beep until you move.
I think this assignment will help me a lot when I started my final project, it helped me understand how the Ultrasonic sensor will work.
And. I want to add this feature to my RC car.
The coolest thing i have learned this week is how to use Ultrasonic sensor.