Basic idea :
This small project will teach you, how to make a simple Grab alarm using an LDR ( light dependent resistor).
When you try to move your hand over the LDR, there is a loud alarm that goes on , and the alarm turns off as soon as you move your hand away from the LDR. The LDR works on the following principle " WHEN LIGHT FALLING ON THE LDR IS HIGH;RESISTANCE IS LOW ." and vice-versa. Basically for an LDR , light is inversely proportional to the Resistance.
Requirements :
1. Connect one terminal of the piezo buzzer to Digital pin 9(you can choose and PWM enabled pin) , and connect the other terminal to ground . Your buzzer connection is now complete.
2. Now make the connections like this :
the black wire goes to ground
the green wire goes to pin A0 on the Arduino
the red wire goes to the 5v pin on the Arduino
Connections Sketch:
Source Code:
Discussion:
Grab Alarm Project Video:
This small project will teach you, how to make a simple Grab alarm using an LDR ( light dependent resistor).
When you try to move your hand over the LDR, there is a loud alarm that goes on , and the alarm turns off as soon as you move your hand away from the LDR. The LDR works on the following principle " WHEN LIGHT FALLING ON THE LDR IS HIGH;RESISTANCE IS LOW ." and vice-versa. Basically for an LDR , light is inversely proportional to the Resistance.
Requirements :
- LDR ( you can choose any variant ), these come in various sizes ,usually based on the size of the area on which the light falls.
- Piezo buzzer (PCB MOUNT).
- Resistor (220ohm /1kohm)
- Connecting wires or Jumper cables
- Arduino UNO R3
- USB cable
- Breadboard
1. Connect one terminal of the piezo buzzer to Digital pin 9(you can choose and PWM enabled pin) , and connect the other terminal to ground . Your buzzer connection is now complete.
2. Now make the connections like this :
the black wire goes to ground
the green wire goes to pin A0 on the Arduino
the red wire goes to the 5v pin on the Arduino
Connections Sketch:
Schematics :
Source Code:
Discussion:
- I have used ldrval variable to store the value being sent by the LRD connected to the arduino
- The value is then printed on the serial monitor . This following part is very crucial .
- After you have fully connected your circuit , you should upload your sketch to the arduino and then open the Serial monitor from the tools section on your arduino platform .
- If your sketch is working properly then it should send back some values to your serial monitor .
- Try to place your hand closer to the serial monitor and observe the readings changing .
- In this manner you have to decide what your threshold value will be ; crossing which your buzzer will start.In my case ,this value was 900. Try to play around with this value , as this decides the sensitivity of the Alarm going on.
- See the source code line 28 : you can also play around with the value . In my case i put it to 170 . You can use values ranging from 0-255 , where 0 represents off .
Picture of the Serial Monitor :
No comments:
Post a Comment