Introduction: Android Automatic Open Electric Door With QR Code Scan

This simple tutorial, show you, how to make a simple electric door opener.

No buttons needed.
When you open the app, the phone automatic connect to your arduino via bluetooth,
and scanning the QR code, then open the door for 3 sec, and app closing, disconnect from arduino.

Arduino code in video description.

Part list:
- Arduino nano v3
- HC-06 Bt module
- Relay modul (1 channel)
- Electrick lock (there is 2 type, im use which need power to open)

Thank you..

Comments

rst21dll (author)2016-01-05

please help me sir

I try to add the PIR and alarm in your project

but it doesn't work

my alarm always voiced

.

This is my sketch :

#include <SoftwareSerial.h>

SoftwareSerial Blue (8, 9);

relayDoorlock int = 13; // Relay doorlock at pin 13

statusRelay int = 0; // Status relay starting with 0

inputPin int = 11; // 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

pinSpeaker int = 10;

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

{

digitalWrite (relayDoorlock, HIGH); // Turn on the relay for 30 seconds

digitalWrite (val, LOW);

ReadString = "";

}

if (ReadString == "CxzJHRO9n1M5OMndUq2T") // Change the Random string

{

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 hertz

void 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);

}

}