Ultrasonic sight
This week's assignment is to build a smart circuit.
I wanted to make obstacle avoidance circuit using different sensors and I found the inspiration here.
TinkerCad to simulate the circuit before connecting the hardware.
Arduino IDE for uploading the code on the board.
Arduino uno to take inputs and perform action.
Breadboard for wiring all the components
Ultrasonic sensor to measure the distance to any obstacle.
IR sensor to detect the obstacle.
Buzzer to generate sound if object detected.
Jumper wires for connection.
Cardboard for enclosing the components.
First, I opened tinkercad for wiring and simulating the circuit, I connected the components as shown in the figure.
The output pins of the buzzer and the sensors are connected to digital pins of the arduino. Make sure to choose the ultrasonic sensor that has 4 output pins. Also IR sensor is not available on tinkercad so I used pir sensor.
For the code, Using the code blocks I had two conditions to tone the buzzer:
the ultrasonic sensor measures distance less than 20 cm.
The IR sensor detects object and sends high signal to the arduino.
If either of these conditions happened, Then the buzzer should be tuned for 1 sec to alert the person that there's an obstacle either in front of them or on the ground.
I wired the circuit on the breadboard and connected the components to the arduino uno board.
Then I copied the text code from tinkercad and on arduino IDE and pasted it in a new sketch.
After that I uploaded the code using the arduino cable and the arrow button.
Test
After that I decided to make a quick enclosure for the circuit, using cardboard I made openings for the ultrasonic sensor in the front and I placed the IR sensor at the bottom while the buzzer is mounted at the top.
And that's how it turned out.
I didn't know how to connect the ultrasonic sensor or how to code it, it was my first time dealing with it.
So I google searched and read few articles, but this one was rich in every information I needed to know.
We made a minion that waves at you when it senses your existence.