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
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:
- Canvas
- Width : 100 %
- Height : 50%
- Image Sprite
- X: 50
- Y: 0
Then go to block and follow the picture above.
Attachments
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... :)
Attachments

Participated in the
IoT Builders Contest
19 Comments
Question 5 years ago on Step 2
I'm completely new to electronics. And I'm trying to implement this project for my college work. I'm using NodeMCU v3 Amica Make and there is no VU pin in it. What is the alternative?
Kindly Expedite! My project submission is due this week!
7 years ago
You are realy an Inventor,
I am in love with this IBLE.
I have al the parts ordered and hope i can get it to work like you did.
i was amazed how cool Arduino gets when the quarter finally drops in your head.(my head ) but you are on 100% of Arduino knowledge, and i on 20/30%.
But it's finally climbing higher after 1 year
o yes i got 2 NODEMCU boards the first version and the V3 and is much larger.
Wider is beter to say.
are they exact the same?? and if not , whats the difference? if i may ask.
yes you rock
WannaDuino!!!
Reply 7 years ago
Thanks a lot. :)
im not 100% of Arduino knowledge, i just want to share what i learnt to other people so it can be useful.
the difference between NodeMCU first version and the V3 is in pin configuration V3 has addition pin VUSB, V3 use CH340 to comunicate with PC while NodeMCU use CP2102.
Reply 5 years ago
i'm using 1st version in that where should i connect VCC pin of relay module
Reply 5 years ago
please give replay i needed it
6 years ago
Thanks for this Tutorial! I was looking for the pinout from RC522 to LOLIN, this was quite helpful - Eeeexcept that in step 2 you forgot the MISO line which must be connected to GPIO12. ;)
Reply 6 years ago
Thanks for your correction
:)
i hope this tutorial helpful for you...
Reply 5 years ago
relay connection i didn't get
explain input connection for relay
5 years ago
i am getting reverse question mark on serial monitor and also relay module is not glowing
6 years ago
nice project!! really helpfull for people, hopefully i can try this
6 years ago
Real good project, thanks for posting
6 years ago
amazing ,stil doing it, soon
7 years ago
I loved this project. realy realy its good idea.
do you know ı will do this project why ?
because someone comin to my home and in garden they taked my chicken :(
wh they taked our chicken why ? if ı will see them ı will fight them ı am sure
thank you very much
Reply 7 years ago
use a wifi alarm camera from BANGGOOD i got it to. it records when somebody enters your space. and you can change al the parameters.
it comes with an APP android and ios and even for windows.
it has even a baby phone function, so if you see somebody, you can yell or talk to them. from anywhere in the world.
and is super cheap, good for the chickens friend.
http://www.banggood.com/Digoo-BB-M1-Wireless-WiFi-USB-Baby-Monitor-Alarm-Home-Security-IP-Camera-HD-720P-Two-Way-Audio-p-1083520.html?rmmds=myorder
Reply 7 years ago
Thanks you, i hope with this project can help you to prevent your chicken stoled.
you can also put a sensor like PIR sensor(motion sensor) and send the data to your website and show the data to your android.
since this project use your own website, you can send data without delay(real-time) not like other IoT server provider that require delay for sending the data.
dont forget to vote me.
:)
7 years ago
Nice Instructable. I will try this.
But I cannot figure out in which method of the arduino Code you store the rfid codes?
Can you explain this?
Thank you.
Reply 7 years ago
have you downloaded my program?
if you already download, goto line number 192,thats subroutine to store RFID in EEPROM.
in line number 163 is to find stored RFID card in EEPROM
RFID card store information that call nuid
example
A7 E2 55 1B
that nuid will stored in 4 EEPROM register in this program i use register address 1000 to store A7
1001 E2
1002 55
1003 1B so on.....
if you already install RC522 library, you can find this program in example RC522 - servo_motor.
dont forget to vote me...
:)
Reply 7 years ago
Thank you for your reply.
Now I see it.
At each Start you can register new Cards. Thats clever :-)
Have'nt tried it on my NodeMCU. But now it is clearer to me.
7 years ago
Very good Idea, control your doors from anywhere.