Ultrasonic Security System
This week assignment is to Design and program a smart device that perform a certain function or solve a problem with multiple input and action components using Arduino UNO.
i got inspired by this "Ultrasonic Security System" from projecthub.arduino website.
but i added some like using light sensor and more led.
this security system is used to protect any room from thieves where by the ultrasonic sensor if any one be around it will make the alarm work "buzzer and light led" and the light sensor will help if it is dark it will light the room by a white led.
Software:
-Arduino IDE to upload the code.
-Tinker-cad for wiring diagram.
Materials:
-Arduino UNO
-Ultrasonic sensor.
-Light sensor.
-MINI Breadboard
-Jumper wires.
-Red LED.
-white LED.
-Buzzer.
-220 Ω resistors.
-9v power adapter.
after some searches about the components i use, I started adding the components on the breadboard and connecting it to the power source and Arduino UNO board.
Connected the light sensor as follows:
VCC to positive of power source.
GND to negative of poer source.
DO to one of digital Arduino pins .
connected Ultrasonic sensor as follows:
VCC to positive of power source.
GND to negative of poer source.
TRIG to one of digital Arduino pins.
ECHO to one of digital Arduino pins.
connected the led as follows:
terminal 1 to ground of power source.
terminal 2 to the terminal 1 of the resistor.
terminal 2 to one of digital Arduino pins.
Note: the LDR sensor is not exist at tinker cad but the following pic shows how to connect it.
4. connected the buzzer as follows:
terminal 1 to ground of power source.
terminal 2 to one of digital Arduino pins.
Tinker-cad simulation
code description:
-when power is on the ultrasonic sensor and light sensor start their work .
-when there is any object at distance 10 from the ultrasonic the red led and the buzzer should work as an alarm .
-and if it is dark the light will be on by the light sensor and the white led.
-I coded the red and white led also the buzzer as following:
-when the ultrasonic sensor read less than 10 the buzzer and the red led is on and when reads more than 10 they are off, for white led when light sensor reads 1 ( dark outside) the led is on when it reads 0 ( not dark outside) the led is off.
demo video
1
2
3
i connected the light sensor with 9 v power source and there was that sound coming from it at first i think this sound is normal but then search about its data sheet and i found that it works with just 5 v or 3.3 v.
light sensor data sheet
practicing using the different sensors and searching about data about them for sure it will help me in final project.
for me using light sensor for first time was amazing .