loading
4Comments

Tell us about yourself!

Complete Your Profile
  • Android automatic open electric door with QR code scan

    thanks for sharing sir,., it worksi want to ask...I try to add the PIR and alarm in your projectwhy my alarm always voiced?.please help me...This is my sketch :#include <SoftwareSerial.h>SoftwareSerial Blue (8, 9);relayDoorlock int = 13; // Relay doorlock at pin 13statusRelay int = 0; // Status relay starting with 0inputPin int = 11; // Choose the input pin (for PIR sensor)int pirState = LOW; // We start, assuming no motion detectedint val = 0; // Variable for reading the pin statuspinSpeaker int = 10; // Set up a speaker on a PWM pin (digital 9, 10, or 11)String ReadString;void setup () { pinMode (inputPin, INPUT); // Declare sensor as an input pinMode (pinSpeaker, OUTPUT); pinMode (relayDoorlock, OUTPUT); // Set Relay as output Blue.begin (9600);}void loop () { statusRelay ...see more »thanks for sharing sir,., it worksi want to ask...I try to add the PIR and alarm in your projectwhy my alarm always voiced?.please help me...This is my sketch :#include <SoftwareSerial.h>SoftwareSerial Blue (8, 9);relayDoorlock int = 13; // Relay doorlock at pin 13statusRelay int = 0; // Status relay starting with 0inputPin int = 11; // Choose the input pin (for PIR sensor)int pirState = LOW; // We start, assuming no motion detectedint val = 0; // Variable for reading the pin statuspinSpeaker int = 10; // Set up a speaker on a PWM pin (digital 9, 10, or 11)String ReadString;void setup () { pinMode (inputPin, INPUT); // Declare sensor as an input pinMode (pinSpeaker, OUTPUT); pinMode (relayDoorlock, OUTPUT); // Set Relay as output Blue.begin (9600);}void loop () { statusRelay = digitalRead (relayDoorlock); while (Blue.available ()) { delay (3); char c = Blue.read (); ReadString + = c; } val = digitalRead (inputPin); // Read input value if (val == HIGH) {// check if the input is HIGH Playtone (300, 160); delay (150); 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 { Playtone (0, 0); delay (300); if (pirState == HIGH) { // We have just turned off Serial.println ("Motion ended!"); // We only want to print on the output change, not state // Inside Of The Serial Port pirState = LOW; } } if (readString.length ()> 0) { Blue.println (ReadString); if (ReadString == "esvmxrplOa1KIpyn6BRk") // Change the Random string ente { digitalWrite (relayDoorlock, HIGH); // Turn on the relay for 30 seconds digitalWrite (val, LOW); ReadString = ""; } if (ReadString == "CxzJHRO9n1M5OMndUq2T") // Change the Random string ente { digitalWrite (relayDoorlock, LOW); // After 30 seconds, turn off the relay digitalWrite (val, HIGH); ReadString = ""; } }}// Tell Arduino To Play Piezo Buzzer Tone// In msecs duration, frequency in hertzvoid Playtone (long duration, int freq) { duration * = 1000; int period = (1.0 / freq) * 1000000; long elapsed_time = 0; while (elapsed_time <duration) { digitalWrite (pinSpeaker, HIGH); delayMicroseconds (period / 2); digitalWrite (pinSpeaker, LOW); delayMicroseconds (period / 2); elapsed_time + = (period); }}

    View Instructable »