I am making a motion sensor security system. can anyone help
I am making an Analog to digital converter…Can i get help for parts list and comprehensive circuit diagram please?
Hi fazefaiz,
what help you want,in your code or in hardware?
but if you use the “PIR Motion Sensor” ,its very easy to use it have three pin VCC GND and OUTPUT
if you have any movement the output will be 5V else it will be 0V .
and if you want help in your code we can help you to make it in interrupt mode.
i wish i can help you.
Here is the code as well as the schematics for this project
If you’d like you can switch out the LED for a buzzer, that’s what I did.
Click me for the code!
/*
- PIR sensor tester
*/
int ledPin = 13; // choose the pin for the LED
int inputPin = 2; // choose the input pin (for PIR sensor)
int pirState = LOW; // we start, assuming no motion detected
int val = 0; // variable for reading the pin status
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(inputPin, INPUT); // declare sensor as input
Serial.begin(9600);
}
void loop(){
val = digitalRead(inputPin); // read input value
if (val == HIGH) { // check if the input is HIGH
digitalWrite(ledPin, HIGH); // turn LED ON
if (pirState == LOW) {
// we have just turned on
Serial.println("Motion detected!");
// We only want to print on the output change, not state
pirState = HIGH;
}
} else {
digitalWrite(ledPin, LOW); // turn LED OFF
if (pirState == HIGH){
// we have just turned off
Serial.println("Motion ended!");
// We only want to print on the output change, not state
pirState = LOW;
}
}
}