Introduction: IoT : Androino Doorlock

Do you ever leave your key under doormat or other hidden place so another family member can open the door?

or when you arrive at your office and realize your door hasn't been locked.

what if another person open your door using the key that you leave.

That's not safe.

Androino Doorlock have the solution.

you can lock and unlock your door using RFID card or your Android.

Just install the app in your android, so you can check your door condition and you can lock or unlock your door whenever and wherever you are.

what you need is:

Hardware:

  • NodeMCU v3 Lolin (ESP8266 module)
  • RC522 (RFID module)
  • Relay module
  • Selenoid Doorlock
  • Power Supply 12V
  • LM2596 (DC-DC converter module)
  • Jumper Cable
  • USB to microUSB cable
  • Android Smartphone

Software:

  • Arduino
  • NodeMCU Flasher Master
  • Notepad ++
  • FileZilla
  • Browser

Step 1: Connect and Flash NodeMCU V3

If you already install driver and flashing NodeMCU just skip this step, otherwise you should read this step to get things ready.

If you are using NodeMCU v3, you must install CH340 Driver.

Open link and click download, you should get zip file. Extract file and run the setup.exe and simply click install.

Check your device manager to assure your NodeMCU is connected.

After you can see NodeMCU in device manager download NodeMCU Flasher Master from GitHub.

Open NodeMCU Flasher Master, set the NodeMCU port and just click flash.

Step 2: Wiring

Connect NodeMCU with RC522 module.

RC522======>NodeMCU

SS======>GPIO16

SCK======>GPIO14

MOSI======>GPIO13

RST======>RST

VCC======>3.3

GND======>GND

i have read so many tutorial about how to connect RC522 to NodeMCU. Many of them connect RST pin of RC522 to to GPIO pin, but after i try RFID wont read any card, so i move the jumper to RST rather than GPIO pin.

After that connect relay module to another available GPIO in this case i use GPIO5.

Step 3: Get Your Own Domain

In this tutorial i use 000webhost as a server for Androino Doorlock.

If you already have your own domain you can also use your domain as a server.

Download Notepad++ and write this code

<? php

	$var1=$_GET["variable1"];
	
	$api=$_GET["api_key"];
	
	$api_key_var="ZXC321ASD";
	
	if(!strcmp($api_key_var,$api))
	{
		$fileContent ="Variable1=".$var1."\r";
		$fileStatus= file_put_contents('web.html',$fileContent);
		if($fileStatus!=false)
		{
			echo "Success: data written to file \n\r";
		}
		else
		{
			echo "Fail: try again \n\r";
		}
	}
	else
	{
		echo "Fail: wrong api key \n\r";
	}
? >

Then save it to YourFileName.php.

After that open FileZilla then login to the server, then upload YourFileName.php to your website.

The API key is up to you, i just randomly write the API key.

$var1=$_GET["variable1"]; this syntax is to get value from entered link

the program will search what value after text variable1 and store it to variable "var1".

this program is case sensitive.

example:

if we enter this link in our browser

yourweb.com/YourFileName.php?variable1=100 -----> var1 value is 100.

yourweb.com/YourFileName.php?variable1=3 -----> var1 value is 3.

yourweb.com/YourFileName.php?variablE1=100 -----> var1 value is empty.

-------------------------------------------------------------------------------------------------------

after variable var1 get the value, then php file will generate file in this case web.html

you should see web.html in your FileZilla if the file succesfully generated.

the content of web.html is depend from this syntax:

$fileContent ="Variable1=".$var1."\r";

so if you call this link yourweb.com/YourFileName.php?variable1=3

then this link yourweb.com/web.html

your should see Variable1=3

Attachments

Step 4: AppInventor

Open AppInventor, Make new project and write name of your project (this will be your app name).

after you create project you will see designer page, all you need is:

  • Label x2
  • Button x1
  • Canvas x1
  • ImageSprite x2
  • Web x2
  • Clock x1

After that upload lock and unlock image, you can download from file below.

Designer setting:

  1. Canvas
    • Width : 100 %
    • Height : 50%
  2. Image Sprite
    • X: 50
    • Y: 0

Then go to block and follow the picture above.

Step 5: Program + Testing

Make sure you has downloaded ESP8266 Board and RC522 library.

i use NodeMCU 1.0 (ESP-12E Module), 80Mhz, 115200, 4M.

download the program below and upload it to NodeMCU.

Thanks for your attention.

write in the comment if you want to ask.

Vote Me... :)