ultra sonic security system. To catch the thieves if they are near my door by giving me the sound through buzzer sound.
I wanted to use a ultrasonic sensor in my project, so I searched Google to find an idea suitable for use, I find a similar idea in the arduino project hub
to stimulate circuit
to upload code to arduino board
buzzer
bread board
jumpers
LED
220 ohm resistors
arduino board
ultrasonic sensor
slide switch
stimulation of circuit in tinkercad
Connect a red wire from the 5V pin on the Arduino to the positive channel of the breadboard. Connect a black wire from the GND pin on the Arduino to the negative channel of the breadboard:
Buzzer = pin 7
On Ultrasonic Sensor:
Echo = pin 3
Trig = pin 2
LED:
Yellow LED = pin 5
The wires connected to the LEDs should be connected in line to the positive side of the LED, while the negative side of the LED should be connected to the negative channel of the breadboard using a 220 ohm resistor.
slide switch :
ground pin with ground bread board
terminal with pin 8
The circuit has been built as described above.
I have two inputs that are
slide switch to control open circuit
ultrasonic sensors
And two outputs that are
bell sound
LED
code
define each with number on arduino pins
invoid setup:
define each pin as input or output
in void loop:
use if condition to make its function an recognize distance.
if distance less than 20 CM open yellow LED and sound buzzer
else
close LED and buzzer sound
enclosure
The buzzer didn't respond to distances all the time it made a sound.
The problem was in the code logic , almost buzzer didn’t enter in if condition
Maram and Ahmed help me to solve this problem.
Title of Media
Title of Media
Title of Media