Dear God! It's like you actually went through this a few times BEFORE shooting this video! If only every instructional video was as well put together as this one. Two thumbs up mate
Wow! This is an amazing tutorial so far! I look forward to giving my guests a 3 factor authentication system to enter hehe! P.S it’s amazing you still reply to comments - you truly are an great creator - got a sub from me
This is an awesome made video! Very clear instructions, shows only needed information, neat video shootage appealing to an eye. A lot of technical information provided with short and clear comments. Is a pleasure to watch!
I love this video! But I have a question. You used a 5V relay and connected the IN to a pin on the board, which operates at 3.3V. I'm wondering if this can damage the raspberry pi.
ok i finally figured out the touche screen part, but i dont have the xorg driver. Is there another similar config i can use or somewhere to download it?
Firstly, it's a very useful and informative video. Having that said however, this is still 2 factor authentication. The factors in question are something you have, and something you know. Both the fob and your phone are in the "something you know" factor. Typically the other factor would be "something you are", which generally means biometrics.
Hi Rory, thanks and I'm glad you enjoyed the video - despite how old it is now! Great to see people still enjoying it. And yes, I soon realised my mistake at the time (and had the same conversation again and again... then many more times when Raspberry Pi themselves featured this project!). It's technically only 2 factor, although 3 steps :-P And whilst it's open source, it means that anyone can alter it and modify to whatever they like, so could adapt it for fingerprint or retina scanning or something like that. I didn't quite have the budget for those at the time :)
Dear Paul Your Work is Highly Appreciated. I am in the last phase where I am trying only to run my python script in shell I am trying to Run it using Thonny python installed in Pi. I installed MariaDB I get an error in line 3. import MySQLdb Error: ModuleNotFoundError: No module named 'MySQLdb'
The phython script lock.py I tried to Run it In line 3 of the script import MySQLdb I get an error. It is not found. I tried to find this specific file inside usr/var/ It it not there Just to clarify, I installed MariaDB,php7, myphpadmin, because Mysql is not downloadable anymore. However everything worked and I logged in myphpadmin, imported the database succeeded If you could please, give me a lead how to overcome the error Running lock.py
Is it possible to modify this system to open lock with either of three methods (rfid card, password,otp) if yes please give me some references. I don't have much experience in this field 😊 thanks alot
Yes it is, and as I open sourced the code you're free to make changes as use as you see fit (within the terms of the license agreement on GitHub). I can't provide bespoke help here in the comments but if you need one-on-one guidance then get in touch and we can book in some consultancy video call sessions if you like.
Hi Paul! Thank you so much for the tutorial. I have gotten up to the point of the 2nd authentication but the GUI is only counting the digits pressed. Is there anyway you can help with this?
Hi Jenny, I'm glad you got this sorted - before I had a chance to reply here! :) With regards to adding profile pictures, you don't upload an image to phpmyadmin as such, as it's just an interface to the database. The code takes the filename of the image (from db table) and then looks for a GIF with that name in the same dir as the script 👍
Hey, don’t know if you will reply, but if you did I would be very grateful. So I want to get rid of the RFID scanner and the SMS phone text, and JUST have the pin. Is this possible? And what would I have to buy? Thanks so much in advance
That is awesome, sorry to be a bother, but if you could, when you have time, could you tell me what I need to buy specially just for the code part? Don’t need to send links, if you tell me the names I can go check out your links! Thanks so much, and I love how fast you reply! True dedication
@MicroDrop2 no worries! It would just be everything apart from the RFID scanner and tags. (The SMS element doesn't include any physical hardware so nothing crossed off the shopping list there...)
Awesome Video, Thanks. I had a few questions. 1. how could I replace the lock with a servo? 2. how could I use an app instead of the touch screen? 3. and how could I replace the RFID to NFC and use my phone instead of a Fob? 4. Would there be anything different using a Raspberry Pi 4, Than the others? Thanks
Glad you liked the video! :) Yes everything you've suggested is possible. Beyond the scope of a comment reply to go into the hows and details, obviously, but you're more than welcome to take my code/setup and modify it like that to suit your preferences :) The only difference if using a Raspberry Pi 4, just like if you were building this today on a 3, is that this project is 3 years old so all the code and software versions are from that era - you'll need to update accordingly for newer versions of pretty much everything. So take my video and instructions as a conceptual guide, rather than an exact step-by-step. Good luck!
Rest is very well explained, but one thing which i don't understand is how you getting SMS through your raspberry pi. I don't see any GSM board is connected to your phone. or you have subscribed any SMS service ?
This is a REALLY NEAT project and nearly exactly what I was looking for. I am not a programmer though and would like to remove the SMS portion and make the RFID and pin code portion both unlock the door. Basically making it dual single factor. Any help with this would be greatly appreciated! I looked at the PY code and generally understand what each command is doing but dont know enough about it to weed out the SMS portion or make both RFID and PIN trigger. Thanks for putting together a great video on this also! VERY well done.
I'm so impressed by how easy you make this look. I'm convinced that even I can do it. Here's a question: How would you scale this system up to say a dozen doors in a building and share the same database? And if you were only looking for two-factor authentication (fob & PIN), is there a way to disable the third factor?
ha, thanks! I'm sure you could :) Yes for scaling up that would be very simple - you'd simply create a central database on a separate machine on the network (that could be another Raspberry Pi, or another computer set up as a database server). Then I'd assign each door its own unique ID number (just 1-12 would do) and slightly modify the scripts running on each door to identify themselves by ID. That could allow you to specify only certain doors that a given user has access to, for instance (via an additional table in the db). The logging as well could include the door ID so you know which door has been accessed. Finally, the scripts running on each door would simply connect to the central DB over the network and not run a db locally on each Raspberry Pi. You could probably get away with using a Pi Zero on each door, in lieu of a full size Pi too, to save money and be more compact. You could also make access to some (or all) doors time-sensitive, too... by specifying time windows that user X has access to door Y. With regards to disabling the third factor, yes you can do this by just modifying the function calls to skip that altogether and go straight to unlocking the door. If I had the budget and a space to do this, I'd love to make another video doing this expanded system. If you make this, I'd love to see it and feature a video guide on the channel!
Do you have a new build sheet for this project. Some of the links are not working on amazon and would really like to use HDMI touchscreen. Thanks in advance.
I don't I'm afraid, it's quite an old project now. Hopefully it will still inspire you and help with general concepts though, and feel free to share links for updated stuff you find 👍
Thank you. I have the original Pi that has less GPIO pins and a composite port. Will this work with that? Also can I use a Monitor instead of the GPIO pins? I plan on using a external keypad.
Hey! To add new users simply add them to the database table shown in the video, one new row per user. The ID field for their fob must be unique to that user, and if you have a profile image make sure it's a GIF, in the same dir as the script and then input its filename WITHOUT extension in that column of the table. Regarding active directory, you'd have to write a separate little script to sync data from there into this system, or rewrite this system to query AD instead.
Great video, would it be possible to have a POS system involved also? Scan your bank card to make payment, then the door unlocks or sends you a txt with code to unlock
Yes, I didn't include a manual override on my demo in the video as it would depend on the location, circumstances and preference of each specific and individual installation as to how the best way to provide that would be. The simplest way would be just to fit the front keyhole part of the Yale lock, which I left off. Then you've got an immediate offline override 😀
Great project and video! I would like to adapt it for a package delivery door (we’ve had porch pirates) is there a way to eliminate the rfid and the random code generation features and just have a the single pass code that I could give to the delivery driver and also receive the sms notifications? Thanks for your help.
Hi, glad you liked it. Yes, that's fine to do that - if you just modify the Python code to suit your needs, that should work great with the hardware! Let me know how you get on :)
@@ewokkillah You'll need to strip out the functions that you don't need and call the ones you do... plus make any changes. Before trying that, find a beginners' Python course and get familiar with the basics. Happy to help :)
how to incorporate QR code scanning to pay via e wallet/credit card to unlock a compartment/locker ? after a delay to auto shut and lock back in case user let door ajar after taking the stuff in locker.thx
Can I set this system up to handle 10 different locks hooked in to the raspberry pi and a selection screen on the touch screen so the user can select which lock they want to affect before they enter their credentials? If that much works the only other thing I'd need it to do is once the first user approaches and open and closes a door the second and all users coming after can't open that particular door again until the first user has come back and open and closed it. It's essentially a tool storage cabinet that everyone needs to gain access to any of the items in it at a moments notice but we need know who took which tool and to have a record that they did indeed return it or to alert us that it's been x number of days and the tool hasn't been returned.
Yes, you can do all that :) It's unfortunately beyond the scope of a comment reply here, and you'd have to make some changes and code some software updates yourself - but that's all possible! :)
Hi Paul! Amazing video, and something I'll definitely do. I was just wondering though, Is there a way of making the door open and close remotely via a phone app?
@@SwitchedOnNetwork Yes Please!! I'm currently trying to design my system with a mixture of 2 different projects on TH-cam, but a mod to this one would be way easier! Thanks Paul!
I am trying to make a sudo-escape room for my office. The last obstacle will be this device, with a key fob and the pin. I also plan on hooking up a speaker to the stereo port on the pi, and would like to either play a sound file or do text to audio (ex: wrong, try again or success!). So I dont need multiple pins/fobs or the SMS portion. So I think I can just keep everything in the python script, and not need apache/php/mysql. It would even be nice, for the person starting the clock, to be able to do it on this device, and if they run out of time (30 mins), a time's up/siren goes off. Thoughts?
Awesome idea! Yes if you want to simplify it you could scrap using the database and either hardcode everything into the Python script or use flat .txt files on the Pi (or something like SQLite). I look forward to seeing it when you're done :)
I can’t get the rfid reader to work on the pi. Works on windows. Tried just about everything. Lsusb shows it on bus 001 device 007: id 6688:6850 Looks like it maps to /dev/usb/hiddev0
Figured out my problem. I bought the RFID reader/writer. Once I bought the RFID reader, everything worked. Will share a video when everything is finalized.
What an awesome tutorial. I'm implementing this work for my project, and I have a few issues. If you can help me with please, I follow all the steps; however, when I run the python programme, I get this error message : (_tkinter.TclError: no display name and no $DISPLAY environment variable pi ) and also when I turn on the Pi I got a message in the touch screen "failed the load overall spi 2708" I scan the key fob and nothing come up. any help will be much appreciated
Hello Paul, awesome project. I have managed to get everything working except getting the relay switch to trigger and click once I enter the sms code. Any help would be appreciated. I have the exact setup as you did. Thanks
@@SwitchedOnNetwork Yes I tried that with an LED, relay works just fine. The relay has triggered the lock but this happens even before I place my key fob on the rfid reader. Thanks
Ah, something definitely up then! Does anything happen at the point where it's meant to unlock? ie. does it lock? Wondering if your Normally Open/Closed might be reversed? If not... you'll have to go through bit by bit debugging until you figure out what's up I'm afraid! Good luck 🤞
Thanks! Yes that's easily done, just swap the functions around so that when it's initialised it's calling the function to wait for PIN entry stray away. You'll have to remove the name and picture elements too.
Switched On Network Thank you for your fast reply. I want to keep the name and give people acces with the code, then once they put the code i gave them they get a 1 time access code to their phone.
Switched On Network How long do the codes last? Also is there a way to Support your Channel without pledging. Like Paypal, Venmo Etc. Doing it 1 time and easy for people? Thank you. Keep Doing good work.
Hi, if you mean the smsCode then it's generated and held in memory until it's entered into the screen. You can build in a timeout for the code itself if you like, but the screen will automatically stop waiting and return to idle state after 60s, rendering the code invalid. You can change that if you like (line 260 of script). That's very kind of you to want to support the channel, thank you. The best way to make a one-off pledge would be to use Patreon and then cancel after a month (www.patreon.com/SwitchedOnNetwork) or the PayPal email address is paypal@innobellamedia.uk - thank you!
If you mean the pin you enter on the touchscreen then yes, in the database table. You could also build an admin front end for that if you want to make it more elegant.
Hey Paul This is a wonderful project that uses so many of the functions of Python and the Raspberry Pi. Your tutorial was so well documented and delivered. I do have a question though.... I want to remove the SMS authentication and add a step that verifies a number from a separate table in the MySQL database. I can build the table with no problem but I need to figure out where to put the additional code and what it might look like. I also want to make sure and comment out only the SMS configuration if that is possible. Any help would be appreciated!
Thanks for your comment and kind words! I'm not quite sure what you mean by "verifies a number from a separate table in the database".... do you mean like a second PIN?
That would be correct. I am wanting to validate that the person using the card has access to a valid work order. The cool thing about your system is that it would log the work order.
aaaah I see, so the PIN would be personal to them but the work order ID might be known by several, and also be time-limited so only be valid between pre-defined start and end times? Cool application! Yes that's perfectly possible and easily do-able - let me see it when you've done it!
OK Paul, I have this program just about completed, however, a glitch I am having is if you scan the card then scan it again the verification screen pops up at the bottom of the initial verification screen. How can I turn off the RFID reader until Access Denied or Access Granted? Thanks a lot for your help.
Thanks for sharing this great video. I have a question, if I used a non USB input device, like a switch how can it be monitored for status change using RPI.GPIO?
That would depend very much on the device in question. Your best bet is to see if any documentation or example code comes with the device, and if not use the device name as a starting point for your research into it. Good luck!
Great video - might use this to secure an internal door in my house that contains my burglar alarm, and more importantly, wine collection. Be good to have that extra layer of security.
It will depend on the specific display as to whether you'll have to alter the program. If the resolution is the same, there shouldn't be an issue (but you may need different drivers). Higher resolution will probably require work, I don't think it's responsive (but I've not really looked at that code for about 2 years so can't remember lol)
Do you mean something biometric such as fingerprint or retina scanner? The answer is absolutely yes! How you'd interface with it would depend on the device and also how it connects to the Pi (eg. USB, GPIO or even via LAN?!) Best bet is to play around with the device and write a separate sample script to prove concept then swap that into my code. Good luck!
Hi! I have this project for my school, and I got stuck at the error for line 194 in lock.py (rfid_presented += keys[ event.code ] IndexError: string index out of range. Do you have any idea?
A very cool video Paul. I'm completely new to Pi and am looking for things to mess around with - this security system looks like it would be fun to try. I think I understood 99%+ of your instructions but I must have missed the bit where you showed us where you were connecting the PSU to the mains(!) Have you stripped the plug and done that inside the wall as well? Or have you poked a hole through the wall to reach a socket? (I doubt it's the latter.) One other question (just to prove what a novice I am lol): could you use your phone as your input screen or would that completely negate the need for the Pi? Cheers.
Thanks, I'm glad you liked the video and that it's still helping people out after 3+yrs! On my little protype mockup for the video I didn't do anything fancy with the PSU's power lead, as it wasn't inside a real stud wall or anything, so I just plugged it into an extension lead. I could have mounted a socket like this (ebay.to/371StdR) inside the wall on the internal side I guess, or hardwired into the mains, but as it wasn't a permanent setup I didn't need to do anything like that. If you're doing anything like that or installing inside a real stud wall, make sure you research and comply with all local building codes and stay safe! Re: your phone, you'd still need the Pi as that controls the relay switch via the GPIO ports for the electronic door strike, but you'd need a way to connect your phone screen's inputs into the Pi, and it also looks up credentials in the database. You could expand the system so that the RFID reader accepts input from a "virtual fob" via your phone's NFC chip, that would be cool!
@@SwitchedOnNetwork Wow!, that was a quick reply to a 3 year old thread! Thanks. Yes indeed, if I go ahead with this, I'd be fitting inside a real wall so, re the eBay link, I'm assuming you would fit that with the wiring on the INside of the wall (as it would be on the inside of a PC chassis) and on the OUTside of the wall, you'd need to have a kettle plug permanently plugged into the mains? Thanks again. Consider me subscribed!
Thanks for the sub! Yeah you'd fit something like that with the wiring inside and the socket on the outside. You might be able to find something that's a bit more self-contained and that doesn't need soldering or leave exposed wires even on the inside of a wall cavity which would be even better/safer!
Hi. Great video. As others have said could you make a version that not has sms code and that has support for multiple doors and if you could add support for an exit button or a 2 way system for access and exit . Best regards Johan
Hi Johan, thanks for your comment and I'm glad you liked the video and it's still being appreciated all these years later :) Yes, as it's an open source project you can do all of that and more - consider this a base of inspiration onto which you can build! I'd love to see what you come up with, so if you're on Twitter do follow me (@paulfp) and send me pics/video of your finished build :)
Hello sir. Im really lost right now. I want to make disabled parking project. I use rfid reader and card for authentication, ultrasonic sensor to detect if there is a car park at the spot, lcd to display the access, and wifi to send notification to the people who in charge. How can i connect all of this ? It makes me down because i dont even know how to do it. Ive been doing some research but not sven one is helping me out. I want to ask if i want to connect all of this, i have to simply coding one by one or there is another way ? Appreciate it so much if you see my comment 🙏🏼
Thanks, glad you liked it! You're not the first to ask about the power supply - I looked online and couldn't find a power supply that had a single plug to the mains and would output both 5V and 12V, that didn't cost an arm and a leg. The computer PSU was dead cheap and easy to modify, and fulfilled my single-power-cord-for-everything desire so I don't think it was overkill 😂 a more elegant solution would of course be better though haha
Ah yes, because the touchscreen LCD uses several of the GPIO ports, it's safest to use one which is definitely not already being used for something by that. Since I don't know which specific ones are used, or for what, I just used one which was completely guaranteed to be unused due to not being connected to the ribbon cable or connector for the screen. So I chose 13 - you can of course use any unused one, it doesn't have to be number 13. Hope that makes sense?!
Hi there! I'm planning videos on both those in the near future, so if you make sure you're subscribed then you won't miss them when they go live. In the meantime, I also write a magazine article for HackSpace on using just an RFID; you can download the article for free at www.paulfp.uk/blog/2018/02/new-magazine-article-build-an-nfc-powered-door-lock/
awesome project, exactly what i need for a purpose that just cropped up, is there a simple way to disable the other 2 factors of authentification (removing the Text code and user passcode to make it into a SQL controlled RFID lock only ? thanks :)
Thanks, glad you liked it! The answer is yes, you can edit the python script to do whatever you like. Essentially just comment out the bits you don't need... Or you might be better off with this: github.com/paulfp/NFC-Door-Lock My full tutorial on how to use that code featured in HackSpace magazine: www.paulfp.uk/blog/2018/02/new-magazine-article-build-an-nfc-powered-door-lock/
apologies i just read doen the comments and have seen your previous reply to this question, can you just disbale it in the code or do you have to remove the code ? thanks
Hey Paul Do I have to make sure all the files go to the home file or just the one that says lock.py file? I keep getting an error saying this file doesn’t exist?
Hi - that's not something I can help you with in the comments here, but I'm always open to contract work so if you ping me a message on social media (I'm @paulfp on Twitter and Facebook) or via my website (www.paulfp.uk) then we can discuss :) Thanks.
Good day to you sir. I'm currently working on a smart door lock system using Raspberry Pi 3 and I'm using one of your videos as a reference. I'm just wondering, after importing the files for the codes in PhpMyAdmin, it says that it was a success. But there's no tab on the door lock like in your videos. Can you help me out?
Hi - yes happy to help. When you say there's no "tab on the door lock", what do you mean? Can you give some more specifics about what you're expecting, and what you do see? Thanks!
@@SwitchedOnNetwork Good day sir. Can you please do a tutorial on how to handle the database? I'm having trouble understanding on how to add users into the database. Thanks
@@dexterdavid7324 Inside the phpMyAdmin GUI, if you look under Privileges you'll see all you need in there. I'd recommend reading the official MySQL manual for further details :)
Hi there, there's a text version of the tutorial here if you'd like to have a read of that: www.switchedonnetwork.com/2017/11/10/build-the-ultimate-door-security-system-with-three-factor-authentication/amp/ Thanks!
Awesome video to be honest. I had something of the sort in mind to create but i am a beginner so have no clue how to go about implementing this. For now i am creating a simple home security solution (infrared sensor trip to activate video recording and hosting the controls on a web server). i am just getting into this so your video is a bit out of my league for the moment. i will be back to this in a month s time i hope. RESPECT!!
Thanks, glad you like the video. If you've installed a full LAMP stack then you should be able to go to xxxxxxx/phpMyAdmin where the XXX is your pi IP address 👍
Switched On Network im sorry paul. What should i do to view the database on laptop screen ? I try to google the link that you wrote by insert my ip address/phpMyAdmin and the result was not found
Hello am trying to build a lock system for a solar system project using your previous code. What part do I need to remove from the code. It's going to be a two system authentication because the use of keyfob will not be needed
Hi, you'll basically need to remove all the bits that relate to waiting for keyboard input (ie the keyfob) and change the initial waiting screen to be that of the PIN entry. So you'll be looking at the show_idle() function, getting rid of the listen_rfid() function, etc. - although of course on that last function you'l be retaining the stuff to draw out the first PIN entry keypad. The most important thing is to have a solid enough understanding of Python (read some beginners' guides elsewhere first, if you need to) and then look through my code and make sure you fully understand each part and what it does. I'm by far not the best programmer in the world, but I tried to lay it out logically and use sensible variable and function names etc. to make it easy to understand - have a play around and you should be able to change it to do whatever you like. Good luck!
@@SwitchedOnNetwork Yes thanks I've actually worked on that and remove those i just wanted to be sure I was doing the right thing. Thanks for your swift response
@@SwitchedOnNetwork hello so have done all necessary things but I keep getting this error each time I run python lock.py: no module named MySQLdb and have installed all necessary things
Can this be made to work with the NFC of both an iPhone and android phone? Please answer as it will be much appreciated and help in the near future. And in advance thank you for your time :)
Let me know what you find, I'll be genuinely interested! I know that the NFC chips, like everything in the Apple universe, are extremely (and unnecessarily) restricted...
Switched On Network haha yeup you’re right. All I could find for iPhone was an ios 10 (Apple is currently on iOS 12) jail broken work around to be able to mess with their NFC. Sigh maybe this year.
Thanks, yes the possibilities are (nearly) endless so you can add/change pretty much whatever you like! 😀 Also, depending on the type of latch, you might just also have a catch inside for low-tech exit from the inside...
Hello, im a 19 years old portuguese Networking student on my final year, and im required to do a final project for graduation, im love eletronics and your 3-factor authentication door got me even more interested on it. I just wanted to ask if i could do something similar to that as my graduation project. I see that your project uses a touchscreen to show the information and to enter the code, i was thinking if it was possible to change that for a 4x4 keypad and having the messages showing up on a 16x2 lcd. And instead of having the Twilio sms system, having a Fingerprint sensor as the third authentication method. I was looking at your code and i understood a little bit of it but theres things i dont quite understand and im having a hard time adapting your code to use the 4x4 keypad and show the message on the 16x2 lcd. Can you give me some help changing the code, or some hints on how the code works? If someone is experienced in python coding can you help me? I highly appreciate it. Thanks.
This is almost perfect for my smart door lock project; except that I'm pretty old school and didn't like the RFID system. I wonder if I could replicate similar system to this, but with a magnetic strip card swipe reader instead. Just swipe and it'll grant access XD Awesome tutorial, and very much understandable even for someone with ADHD like me :D
That would be even easier to do, if you just wanted to swipe and get in. If you wanted to add the other factors, you would be able to essentially do the same thing he's doing just replacing the hardware and some of the coding with your proper hardware and code, essentially just replacing the RFID for the mag stripe. They essentially work the same, inputting a code into something, one just uses radio frequency to do it, while the other uses a magnetic strip. If you just wanted the magstripe entry, essentially all you need to do is buy the magstripe reader and the raspberry pi, as well as any other things to operate the electronic door lock and set it up so you swipe and it unlocks. Honestly even using raspi would prolly be overkill, I'd imagine just a simple microcontroller would work, if you aren't gonna make it pull up a profile where you have to input your pin, then and send a temporary authentication code sent to your phone, as there is more processing needed. No need for internet or anything, though, so even a really simple raspi could prolly do it. Like a nano or something. This is just me kinda guessing tho
Hey Paul fist of all great project, I have tried recreating this but I have reached the stage where everything is booted to the default screen asking to present "your token" but when I tap the key fob it doesn't accept it. I wrote down the number on the keyfob as the code on PHPMyAdmin. Please could you guide me on how to amend this.
Hey, thanks for your comment! The best way to go about this would be to debug as you would any other issue. If you run the script manually from a shell/terminal, rather than autoload on startup, you should hopefully see some errors get spat out to the command line which might point you in the direction of your problem. Failing that, modify the script slightly so you can figure out what's going on - get it to print out to the screen what code it thinks it's getting from the card, for example, and just check every single micro-stage of the process in that way until you find the issue. Good luck!
@@SwitchedOnNetwork I managed to fix the file so it runs but when it comes to scanning the fobs the screen doesn't change it stays stuck on the first screen. What should I do?
Yes, but not to receive it - to SEND it. The SMS is sent to your phone. It's sent using Twilio (you could use any online service) and goes to the second "thing you have", ie. the phone in your pocket.
Hey man, i really like your raspberry pi door lock System and im trying to rebuild it for school. Following is my question: How can I import the code and the database step by step? I dont know what to do. Thanks in advance
Hi there! If you're familiar with installing a LAMP stack, that will give you a web server (Apache), database (MySQL) and the PHP language to tie the two together - this will enable you have the web interface to access the database, which is callled phpMyAdmin. Install the LAMP stack, then install phpMyAdmin - there are tonnes of guides on how to do this, so I won't go into full details here in the comments. Then, download the door_lock.sql file from my GitHub repo and use the Import feature of phpMyAdmin to import that. For the script, you can use the "git clone" command to pull down the script from the github repo (github.com/paulfp/Three-Factor-Security-Door) You'll need to insert your database username/password into the lock.py script before running. I've also written up a more in-depth text version of the video tutorial here: www.switchedonnetwork.com/2017/11/10/build-the-ultimate-door-security-system-with-three-factor-authentication/ Good luck and enjoy!
Hi, if i pay could you Say to me now to do with Raspberry pi4 b but without rfid, only via smartphone to open door of Apartment and Door of the Building connect to intercom? Thank you, please
Hi there, yes I'm available for paid consultancy work - feel free to DM me on Twitter, Instagram or Facebook - I'm @paulfp in all those places or I'm at uk.linkedin.com/in/paulfp/ on LinkedIn. Thanks!
So I figured out why I couldn't find the Lxsession file, apparently this folder was in /etc/xdg/lxsession/LXDE-pi/autostart. So I attempted to edit this file and add the line you noted and still no luck. I cant seem to figure what else could be wrong. Can I transfer the lxsession file to .config, if so how can this be done?
Hey there! To add a logo, instead of your picture, you simply need to put a photo in GIF format in the same folder/directory as the Python script, then add the filename (without extension, as it can only be GIF) into the database field for your user. If you want to add this to the welcome screen, look at lines 143-145 of the code (github.com/paulfp/Three-Factor-Security-Door/blob/master/lock.py) to see how this is done and how to add it to the welcome screen. To add a clock to the welcome screen, you'll need to create a label for your clock and then set a timer of some sort to update it every second, whilst it's on display, with the current time in HH:MM:SS format. You should then clear this timer when this screen is removed, and start it again when it displays again. That's the general concept of how to do both your things, you'll now have to do the leg work yourself on how to turn that concept into reality. Have fun and enjoy learning! :)
Thank you for your kind comments! I'm glad you enjoyed the video. I don't have any resources for that myself, but if you Google it there are plenty of resources which will help you. Let me know how you get on!
Hi, Im buildings this as a project and im having problems with the gui, im building this without a touchscreen (im doing it conected to a monito), the db and everything is setup correctly, i present my rfid card and it shows the right name on top, but theres no numbers to click, its just a white screen saying "Welcome "my name" ", can you try and help me finding out whats wrong?
That's probably quite an involved issue to solve which I'm guessing can't really be done in comments I'm afraid. This is a VERY old project now, so unless you're using the same versions of everything I used back in 2017 then I imagine a lot of things will be broken and need debugging/recoding.
@@Browmbrownbrown all the software repositories ("repos") will have the updated versions of everything, and if you download Raspbian it'll be latest version. I've not produced updated versions of my code, as this was a one-off project for fun, but with a bit of debugging you should be able to make it work today :)
#Switched on Network # I love your great work. Can the RFID authentication be replaced with a finger print, if yes how do I go about it. Really need it for a project I'm working on in school. Thanks, look forward to your reply.
Happy Holidays...I think I have found the route to my problem I am receiving this error message when trying to the script ImportError: No module named 'MySQLdb'. Can you instruct me on how to rectify it.
How to disable the sms function? I don't want to get a sms every time i open a door. And can I use the databased stored on a LAN server to have more door locks running on the same db?
Yes, you can build a bigger system by having a centralised database as you describe. And to bypass the SMS element, simply remove that bit of code and go straight to activating the relay! 👍
Dear God! It's like you actually went through this a few times BEFORE shooting this video! If only every instructional video was as well put together as this one. Two thumbs up mate
Thanks! Worked hard on it - glad you liked it. Thanks for the kind comments, it means a lot 👍
Wow! This is an amazing tutorial so far! I look forward to giving my guests a 3 factor authentication system to enter hehe!
P.S it’s amazing you still reply to comments - you truly are an great creator - got a sub from me
Thanks!
This is an awesome made video! Very clear instructions, shows only needed information, neat video shootage appealing to an eye. A lot of technical information provided with short and clear comments. Is a pleasure to watch!
Thanks, glad you enjoyed it!
I love this video! But I have a question. You used a 5V relay and connected the IN to a pin on the board, which operates at 3.3V. I'm wondering if this can damage the raspberry pi.
ok i finally figured out the touche screen part, but i dont have the xorg driver. Is there another similar config i can use or somewhere to download it?
Firstly, it's a very useful and informative video. Having that said however, this is still 2 factor authentication.
The factors in question are something you have, and something you know. Both the fob and your phone are in the "something you know" factor.
Typically the other factor would be "something you are", which generally means biometrics.
Hi Rory, thanks and I'm glad you enjoyed the video - despite how old it is now! Great to see people still enjoying it. And yes, I soon realised my mistake at the time (and had the same conversation again and again... then many more times when Raspberry Pi themselves featured this project!). It's technically only 2 factor, although 3 steps :-P And whilst it's open source, it means that anyone can alter it and modify to whatever they like, so could adapt it for fingerprint or retina scanning or something like that. I didn't quite have the budget for those at the time :)
Love this project...I think I'm going to refactor into using Facial Recognition as one of the factors for authentication. You have inspired me!
Awesome, I'd love to see that!
@@SwitchedOnNetwork I am here for the same .I am building facial recognition
Dear Paul
Your Work is Highly Appreciated.
I am in the last phase where I am trying only to run my python script in shell
I am trying to Run it using Thonny python installed in Pi.
I installed MariaDB
I get an error in line 3. import MySQLdb
Error: ModuleNotFoundError: No module named 'MySQLdb'
Hi, thanks - glad you liked it! What happens when you try to install the MySQLdb module?
The phython script lock.py
I tried to Run it
In line 3 of the script
import MySQLdb
I get an error. It is not found. I tried to find this specific file inside usr/var/
It it not there
Just to clarify, I installed MariaDB,php7, myphpadmin, because Mysql is not downloadable anymore.
However everything worked and I logged in myphpadmin, imported the database succeeded
If you could please, give me a lead how to overcome the error Running lock.py
You need to install the MySQLdb module for python, or MariaDB equivalent
Is it possible to modify this system to open lock with either of three methods (rfid card, password,otp) if yes please give me some references. I don't have much experience in this field 😊 thanks alot
Yes it is, and as I open sourced the code you're free to make changes as use as you see fit (within the terms of the license agreement on GitHub). I can't provide bespoke help here in the comments but if you need one-on-one guidance then get in touch and we can book in some consultancy video call sessions if you like.
Hi Paul! Thank you so much for the tutorial.
I have gotten up to the point of the 2nd authentication but the GUI is only counting the digits pressed.
Is there anyway you can help with this?
Hi Jenny, I'm glad you got this sorted - before I had a chance to reply here! :)
With regards to adding profile pictures, you don't upload an image to phpmyadmin as such, as it's just an interface to the database. The code takes the filename of the image (from db table) and then looks for a GIF with that name in the same dir as the script 👍
Hi, would like to check if I would like to incorporate this project with a facial recognition door lock, will it work?
Yes, you can swap out any of the authentication inputs for anything you like 👍😀
Hey, don’t know if you will reply, but if you did I would be very grateful.
So I want to get rid of the RFID scanner and the SMS phone text, and JUST have the pin. Is this possible? And what would I have to buy?
Thanks so much in advance
Hello! Yes that's perfectly possible and the code is all open source so change and update as you wish 👍
Awesome! Any chance you could tell me what to purchase? Thanks 🤩
@@MicroDrop2 - Yep, there are Amazon links for everything you need in the video description.
That is awesome, sorry to be a bother, but if you could, when you have time, could you tell me what I need to buy specially just for the code part? Don’t need to send links, if you tell me the names I can go check out your links! Thanks so much, and I love how fast you reply! True dedication
@MicroDrop2 no worries! It would just be everything apart from the RFID scanner and tags. (The SMS element doesn't include any physical hardware so nothing crossed off the shopping list there...)
Exactly what we were looking for.
good, I want to realize that I can turn on my miner remotely, can I get it? which Raspberry P buy? Thank you
Awesome Video, Thanks. I had a few questions. 1. how could I replace the lock with a servo? 2. how could I use an app instead of the touch screen? 3. and how could I replace the RFID to NFC and use my phone instead of a Fob? 4. Would there be anything different using a Raspberry Pi 4, Than the others? Thanks
Glad you liked the video! :) Yes everything you've suggested is possible. Beyond the scope of a comment reply to go into the hows and details, obviously, but you're more than welcome to take my code/setup and modify it like that to suit your preferences :) The only difference if using a Raspberry Pi 4, just like if you were building this today on a 3, is that this project is 3 years old so all the code and software versions are from that era - you'll need to update accordingly for newer versions of pretty much everything. So take my video and instructions as a conceptual guide, rather than an exact step-by-step. Good luck!
Will it still work if the rfid is replaced with a finger print scanner
This is amzing project....
Rest is very well explained, but one thing which i don't understand is how you getting SMS through your raspberry pi. I don't see any GSM board is connected to your phone. or you have subscribed any SMS service ?
It uses a web service, Twilio, to send the SMS so just through the Internet. No extra hardware required 👍
Hii paul.. im want to ask about the hardware. Where do i have to connect the normally close relay switch ? I hope you can help me.
thx sir for your effort, please, can I replace pin code with face recognition, and SQL-server can not set up in raspberry pi 4, any solution?
This is a REALLY NEAT project and nearly exactly what I was looking for. I am not a programmer though and would like to remove the SMS portion and make the RFID and pin code portion both unlock the door. Basically making it dual single factor. Any help with this would be greatly appreciated! I looked at the PY code and generally understand what each command is doing but dont know enough about it to weed out the SMS portion or make both RFID and PIN trigger. Thanks for putting together a great video on this also! VERY well done.
Im trying to do the same and remove the sms part of the code, did you get it working?
Simply amazing!!
Thanks, glad people are still enjoying this years later 😃
I'm so impressed by how easy you make this look. I'm convinced that even I can do it. Here's a question: How would you scale this system up to say a dozen doors in a building and share the same database? And if you were only looking for two-factor authentication (fob & PIN), is there a way to disable the third factor?
ha, thanks! I'm sure you could :) Yes for scaling up that would be very simple - you'd simply create a central database on a separate machine on the network (that could be another Raspberry Pi, or another computer set up as a database server). Then I'd assign each door its own unique ID number (just 1-12 would do) and slightly modify the scripts running on each door to identify themselves by ID. That could allow you to specify only certain doors that a given user has access to, for instance (via an additional table in the db). The logging as well could include the door ID so you know which door has been accessed. Finally, the scripts running on each door would simply connect to the central DB over the network and not run a db locally on each Raspberry Pi. You could probably get away with using a Pi Zero on each door, in lieu of a full size Pi too, to save money and be more compact.
You could also make access to some (or all) doors time-sensitive, too... by specifying time windows that user X has access to door Y.
With regards to disabling the third factor, yes you can do this by just modifying the function calls to skip that altogether and go straight to unlocking the door.
If I had the budget and a space to do this, I'd love to make another video doing this expanded system. If you make this, I'd love to see it and feature a video guide on the channel!
Do you have a new build sheet for this project. Some of the links are not working on amazon and would really like to use HDMI touchscreen. Thanks in advance.
I don't I'm afraid, it's quite an old project now. Hopefully it will still inspire you and help with general concepts though, and feel free to share links for updated stuff you find 👍
Absolutely brilliant
Thank you!
How do I take out the RFID reader so that I just enter the code? And can I make the code 4 digits long?
Yes you can do that, both those things, just modify the python code as you require 👍
Thank you. I have the original Pi that has less GPIO pins and a composite port. Will this work with that? Also can I use a Monitor instead of the GPIO pins? I plan on using a external keypad.
can we do any of this with our own rfid card? like library card or student id cards ? Please help
Yes! 👍
Switched On Network thanx 👍🏻👍🏻👍🏻
I know this is already a few years old, but would this also work with a maglock instead of a door strike?
Yes, it's open source so you can modify or change the code and do what you like with it 👍
good afternoon Paul. how do you add users to the system and can it sync with active directory?
Hey! To add new users simply add them to the database table shown in the video, one new row per user. The ID field for their fob must be unique to that user, and if you have a profile image make sure it's a GIF, in the same dir as the script and then input its filename WITHOUT extension in that column of the table.
Regarding active directory, you'd have to write a separate little script to sync data from there into this system, or rewrite this system to query AD instead.
@@SwitchedOnNetwork is there any interface that can integrate in order to prevent access to the database? can i use openhab
Great video, would it be possible to have a POS system involved also? Scan your bank card to make payment, then the door unlocks or sends you a txt with code to unlock
Yes, absolutely! You could integrate with something like Stripe via their API to do that.
Hey thanks for the video. Does that mean if there is no internet connection the system wouldn't work and people will be locked?
Yes, I didn't include a manual override on my demo in the video as it would depend on the location, circumstances and preference of each specific and individual installation as to how the best way to provide that would be.
The simplest way would be just to fit the front keyhole part of the Yale lock, which I left off. Then you've got an immediate offline override 😀
@@SwitchedOnNetwork what do you mean by fit the front part of the yale lock?
The bit where you'd insert the key, on the front (outside) side. I only fitted the back latch.
@@SwitchedOnNetwork oh right ok that's sounds more like another option to use the key if internet fails
That's exactly what it is :)
You are the dude I was looking for. You just inspired me. Thank you Paul
Awesome! Hope you have fun building 😃
Very helpful. Thank you!
Cool idea to use an old computer power supply. Nice project
Thanks, it was a fun one. Glad it's still getting the odd view all these years later! 😊
Great project and video! I would like to adapt it for a package delivery door (we’ve had porch pirates) is there a way to eliminate the rfid and the random code generation features and just have a the single pass code that I could give to the delivery driver and also receive the sms notifications? Thanks for your help.
Hi, glad you liked it. Yes, that's fine to do that - if you just modify the Python code to suit your needs, that should work great with the hardware! Let me know how you get on :)
Switched On Network I have no experience with python so I will need to do some research. Any advice is appreciated. Thanks
@@ewokkillah You'll need to strip out the functions that you don't need and call the ones you do... plus make any changes. Before trying that, find a beginners' Python course and get familiar with the basics. Happy to help :)
In fact... you've inspired me to make a "Safe Place" for package delivery, so maybe a video will appear on the channel later this year :)
how to incorporate QR code scanning to pay via e wallet/credit card to unlock a compartment/locker ? after a delay to auto shut and lock back in case user let door ajar after taking the stuff in locker.thx
That sounds like a whole new project in itself - let me know if you build it, I'd love to see it!
Can I set this system up to handle 10 different locks hooked in to the raspberry pi and a selection screen on the touch screen so the user can select which lock they want to affect before they enter their credentials? If that much works the only other thing I'd need it to do is once the first user approaches and open and closes a door the second and all users coming after can't open that particular door again until the first user has come back and open and closed it. It's essentially a tool storage cabinet that everyone needs to gain access to any of the items in it at a moments notice but we need know who took which tool and to have a record that they did indeed return it or to alert us that it's been x number of days and the tool hasn't been returned.
Yes, you can do all that :) It's unfortunately beyond the scope of a comment reply here, and you'd have to make some changes and code some software updates yourself - but that's all possible! :)
Is there a way to remove the sms and the facial recognition and just put the rfid alone?
Yes, just edit the code as required 👍🙂
Hi Paul! Amazing video, and something I'll definitely do. I was just wondering though, Is there a way of making the door open and close remotely via a phone app?
Yes, there is! A few people have mentioned this so maybe it's worth a second video as a project on its own 😀
@@SwitchedOnNetwork Yes Please!! I'm currently trying to design my system with a mixture of 2 different projects on TH-cam, but a mod to this one would be way easier! Thanks Paul!
I am trying to make a sudo-escape room for my office. The last obstacle will be this device, with a key fob and the pin. I also plan on hooking up a speaker to the stereo port on the pi, and would like to either play a sound file or do text to audio (ex: wrong, try again or success!). So I dont need multiple pins/fobs or the SMS portion. So I think I can just keep everything in the python script, and not need apache/php/mysql. It would even be nice, for the person starting the clock, to be able to do it on this device, and if they run out of time (30 mins), a time's up/siren goes off. Thoughts?
Awesome idea! Yes if you want to simplify it you could scrap using the database and either hardcode everything into the Python script or use flat .txt files on the Pi (or something like SQLite). I look forward to seeing it when you're done :)
I can’t get the rfid reader to work on the pi. Works on windows. Tried just about everything.
Lsusb shows it on bus 001 device 007: id 6688:6850
Looks like it maps to /dev/usb/hiddev0
Figured out my problem. I bought the RFID reader/writer. Once I bought the RFID reader, everything worked. Will share a video when everything is finalized.
What an awesome tutorial. I'm implementing this work for my project, and I have a few issues. If you can help me with please, I follow all the steps; however, when I run the python programme, I get this error message : (_tkinter.TclError: no display name and no $DISPLAY environment variable pi ) and also when I turn on the Pi I got a message in the touch screen "failed the load overall spi 2708" I scan the key fob and nothing come up. any help will be much appreciated
Hello Paul, awesome project. I have managed to get everything working except getting the relay switch to trigger and click once I enter the sms code. Any help would be appreciated. I have the exact setup as you did. Thanks
Thanks! Any error output to console if you run from there?
@@SwitchedOnNetwork Thanks for replying. Unfortunately no error
Try writing a separate, standalone script to trigger the relay and check that all works?
@@SwitchedOnNetwork Yes I tried that with an LED, relay works just fine. The relay has triggered the lock but this happens even before I place my key fob on the rfid reader. Thanks
Ah, something definitely up then! Does anything happen at the point where it's meant to unlock? ie. does it lock? Wondering if your Normally Open/Closed might be reversed? If not... you'll have to go through bit by bit debugging until you figure out what's up I'm afraid! Good luck 🤞
Awesome Video. Can i make this only a 2 factor authentication? Removing the rfid. How do i change it on the python script?
Thanks! Yes that's easily done, just swap the functions around so that when it's initialised it's calling the function to wait for PIN entry stray away. You'll have to remove the name and picture elements too.
Switched On Network Thank you for your fast reply. I want to keep the name and give people acces with the code, then once they put the code i gave them they get a 1 time access code to their phone.
Switched On Network How long do the codes last? Also is there a way to Support your Channel without pledging. Like Paypal, Venmo Etc. Doing it 1 time and easy for people? Thank you. Keep Doing good work.
Hi, if you mean the smsCode then it's generated and held in memory until it's entered into the screen. You can build in a timeout for the code itself if you like, but the screen will automatically stop waiting and return to idle state after 60s, rendering the code invalid. You can change that if you like (line 260 of script).
That's very kind of you to want to support the channel, thank you. The best way to make a one-off pledge would be to use Patreon and then cancel after a month (www.patreon.com/SwitchedOnNetwork) or the PayPal email address is paypal@innobellamedia.uk - thank you!
I really neee this system at my business
Thank you, for sharing your knowledge, sir!
My pleasure!
Please specify methods for resetting the as-103 locker?
what's that?
@@SwitchedOnNetwork Is there a way to reset the passwort
If you mean the pin you enter on the touchscreen then yes, in the database table. You could also build an admin front end for that if you want to make it more elegant.
@@SwitchedOnNetwork How can I tell if the bar code is not included in the passwort before the scanner?
Hey Paul
This is a wonderful project that uses so many of the functions of Python and the Raspberry Pi. Your tutorial was so well documented and delivered. I do have a question though.... I want to remove the SMS authentication and add a step that verifies a number from a separate table in the MySQL database. I can build the table with no problem but I need to figure out where to put the additional code and what it might look like. I also want to make sure and comment out only the SMS configuration if that is possible. Any help would be appreciated!
Thanks for your comment and kind words! I'm not quite sure what you mean by "verifies a number from a separate table in the database".... do you mean like a second PIN?
That would be correct. I am wanting to validate that the person using the card has access to a valid work order. The cool thing about your system is that it would log the work order.
aaaah I see, so the PIN would be personal to them but the work order ID might be known by several, and also be time-limited so only be valid between pre-defined start and end times? Cool application! Yes that's perfectly possible and easily do-able - let me see it when you've done it!
OK Paul, I have this program just about completed, however, a glitch I am having is if you scan the card then scan it again the verification screen pops up at the bottom of the initial verification screen. How can I turn off the RFID reader until Access Denied or Access Granted? Thanks a lot for your help.
Thanks for sharing this great video. I have a question, if I used a non USB input device, like a switch how can it be monitored for status change using RPI.GPIO?
That would depend very much on the device in question. Your best bet is to see if any documentation or example code comes with the device, and if not use the device name as a starting point for your research into it. Good luck!
@@SwitchedOnNetwork Cheers. I'm trying to incorporate tkinter with rpi.gpio inputs
Great video - might use this to secure an internal door in my house that contains my burglar alarm, and more importantly, wine collection. Be good to have that extra layer of security.
Protecting your wine collection - an ideal use-case for additional security! :)
There is a way to make just two factor auth?
Yes of course, just modify the Python script as desired :)
Hi bro this is very good video, may I ask if I were to add face authentication how is it possible ?
Do you have to upload the usb readers drivers to the pi?
Not with a USB one like this - it's plug & play like a keyboard 👍
Awesome THANK YOU, Charl south Africa
Can i connect 5 inch touch hdmi display and display program is same as 4 inch
It will depend on the specific display as to whether you'll have to alter the program. If the resolution is the same, there shouldn't be an issue (but you may need different drivers). Higher resolution will probably require work, I don't think it's responsive (but I've not really looked at that code for about 2 years so can't remember lol)
can you use Bio reader instead of RFID? If so what would be required to interface it?
Do you mean something biometric such as fingerprint or retina scanner?
The answer is absolutely yes! How you'd interface with it would depend on the device and also how it connects to the Pi (eg. USB, GPIO or even via LAN?!)
Best bet is to play around with the device and write a separate sample script to prove concept then swap that into my code. Good luck!
Hi! I have this project for my school, and I got stuck at the error for line 194 in lock.py (rfid_presented += keys[ event.code ] IndexError: string index out of range. Do you have any idea?
A very cool video Paul. I'm completely new to Pi and am looking for things to mess around with - this security system looks like it would be fun to try. I think I understood 99%+ of your instructions but I must have missed the bit where you showed us where you were connecting the PSU to the mains(!) Have you stripped the plug and done that inside the wall as well? Or have you poked a hole through the wall to reach a socket? (I doubt it's the latter.)
One other question (just to prove what a novice I am lol): could you use your phone as your input screen or would that completely negate the need for the Pi? Cheers.
Thanks, I'm glad you liked the video and that it's still helping people out after 3+yrs! On my little protype mockup for the video I didn't do anything fancy with the PSU's power lead, as it wasn't inside a real stud wall or anything, so I just plugged it into an extension lead. I could have mounted a socket like this (ebay.to/371StdR) inside the wall on the internal side I guess, or hardwired into the mains, but as it wasn't a permanent setup I didn't need to do anything like that. If you're doing anything like that or installing inside a real stud wall, make sure you research and comply with all local building codes and stay safe!
Re: your phone, you'd still need the Pi as that controls the relay switch via the GPIO ports for the electronic door strike, but you'd need a way to connect your phone screen's inputs into the Pi, and it also looks up credentials in the database. You could expand the system so that the RFID reader accepts input from a "virtual fob" via your phone's NFC chip, that would be cool!
@@SwitchedOnNetwork Wow!, that was a quick reply to a 3 year old thread! Thanks.
Yes indeed, if I go ahead with this, I'd be fitting inside a real wall so, re the eBay link, I'm assuming you would fit that with the wiring on the INside of the wall (as it would be on the inside of a PC chassis) and on the OUTside of the wall, you'd need to have a kettle plug permanently plugged into the mains?
Thanks again. Consider me subscribed!
Thanks for the sub! Yeah you'd fit something like that with the wiring inside and the socket on the outside. You might be able to find something that's a bit more self-contained and that doesn't need soldering or leave exposed wires even on the inside of a wall cavity which would be even better/safer!
Hi. Great video. As others have said could you make a version that not has sms code and that has support for multiple doors and if you could add support for an exit button or a 2 way system for access and exit . Best regards Johan
Hi Johan, thanks for your comment and I'm glad you liked the video and it's still being appreciated all these years later :) Yes, as it's an open source project you can do all of that and more - consider this a base of inspiration onto which you can build! I'd love to see what you come up with, so if you're on Twitter do follow me (@paulfp) and send me pics/video of your finished build :)
Hello sir. Im really lost right now. I want to make disabled parking project. I use rfid reader and card for authentication, ultrasonic sensor to detect if there is a car park at the spot, lcd to display the access, and wifi to send notification to the people who in charge. How can i connect all of this ? It makes me down because i dont even know how to do it. Ive been doing some research but not sven one is helping me out. I want to ask if i want to connect all of this, i have to simply coding one by one or there is another way ? Appreciate it so much if you see my comment 🙏🏼
thanks man, cool video. won't be that guy, but is the power supply not a overkill?
Thanks, glad you liked it! You're not the first to ask about the power supply - I looked online and couldn't find a power supply that had a single plug to the mains and would output both 5V and 12V, that didn't cost an arm and a leg. The computer PSU was dead cheap and easy to modify, and fulfilled my single-power-cord-for-everything desire so I don't think it was overkill 😂 a more elegant solution would of course be better though haha
sure, i can feel you. sometimes when i build something it's a "now or never mentality"
Hi, just wanna ask, what will happen if I using the same signal pin for the relay switch? Really nice project btw
Thanks :) same pin as what...?
Thanks :) same pin as what...?
@@SwitchedOnNetwork pin 13 for the relay switch. You mentioned in the video that for the relay switch need to use other signal pin.
Ah yes, because the touchscreen LCD uses several of the GPIO ports, it's safest to use one which is definitely not already being used for something by that. Since I don't know which specific ones are used, or for what, I just used one which was completely guaranteed to be unused due to not being connected to the ribbon cable or connector for the screen. So I chose 13 - you can of course use any unused one, it doesn't have to be number 13. Hope that makes sense?!
Switched On Network ohh okay got it. One more question, why i cant open the phpmyadmin on the browser? Is there any step I should do first?
Hi, I am new to Raspberry pi. may I know how to do two-factor authentication with RFID and fingerprint? and any source code available? Thanks
Hi there! I'm planning videos on both those in the near future, so if you make sure you're subscribed then you won't miss them when they go live. In the meantime, I also write a magazine article for HackSpace on using just an RFID; you can download the article for free at www.paulfp.uk/blog/2018/02/new-magazine-article-build-an-nfc-powered-door-lock/
awesome project, exactly what i need for a purpose that just cropped up, is there a simple way to disable the other 2 factors of authentification (removing the Text code and user passcode to make it into a SQL controlled RFID lock only ? thanks :)
Thanks, glad you liked it! The answer is yes, you can edit the python script to do whatever you like. Essentially just comment out the bits you don't need...
Or you might be better off with this: github.com/paulfp/NFC-Door-Lock
My full tutorial on how to use that code featured in HackSpace magazine: www.paulfp.uk/blog/2018/02/new-magazine-article-build-an-nfc-powered-door-lock/
apologies i just read doen the comments and have seen your previous reply to this question, can you just disbale it in the code or do you have to remove the code ? thanks
Hey Paul
Do I have to make sure all the files go to the home file or just the one that says lock.py file? I keep getting an error saying this file doesn’t exist?
Hye paul. I just want to ask about the working of the script lock.py work with the electric strike lock ? I really need your help
Hi - that's not something I can help you with in the comments here, but I'm always open to contract work so if you ping me a message on social media (I'm @paulfp on Twitter and Facebook) or via my website (www.paulfp.uk) then we can discuss :) Thanks.
Thank you for informative video.
You're welcome :) Hope you enjoyed it!
@@SwitchedOnNetwork Yes very helpful. Working on a booth strap smart lockers project will be using your solution. Again thank you.
@@nonnywinner5039 Sounds cool, send me details when it's finished, I'd love to see it! :)
Good day to you sir. I'm currently working on a smart door lock system using Raspberry Pi 3 and I'm using one of your videos as a reference. I'm just wondering, after importing the files for the codes in PhpMyAdmin, it says that it was a success. But there's no tab on the door lock like in your videos. Can you help me out?
Hi - yes happy to help. When you say there's no "tab on the door lock", what do you mean? Can you give some more specifics about what you're expecting, and what you do see? Thanks!
@@SwitchedOnNetwork Nevermind. I just managed to import it to my database. Thanks for the quick reply though! And thanks for the tutorial!
Ah, great - glad you sorted it!
@@SwitchedOnNetwork Good day sir. Can you please do a tutorial on how to handle the database? I'm having trouble understanding on how to add users into the database. Thanks
@@dexterdavid7324 Inside the phpMyAdmin GUI, if you look under Privileges you'll see all you need in there. I'd recommend reading the official MySQL manual for further details :)
I love it but can you also open it from the inside
Yes, catch on the inside (see end of video) 👍
Switched On Network thank you so much i love the content make more like this
Thank you!
Is there a way to do this without sending the sms message and using the tag and passcode only
Yes, of course! It's completely open source so you can modify in any way you like 👍👍
Thank you
can i ask , if the extension GPIO is 2 instead of 3 use in this video, can it work ?
Yes, that will work fine too 👍
Please send me any full installation and configuration procedure if possible..
Hi there, there's a text version of the tutorial here if you'd like to have a read of that: www.switchedonnetwork.com/2017/11/10/build-the-ultimate-door-security-system-with-three-factor-authentication/amp/
Thanks!
Awesome video to be honest. I had something of the sort in mind to create but i am a beginner so have no clue how to go about implementing this. For now i am creating a simple home security solution (infrared sensor trip to activate video recording and hosting the controls on a web server). i am just getting into this so your video is a bit out of my league for the moment. i will be back to this in a month s time i hope. RESPECT!!
Sounds like a great project! And glad you liked this video, thanks :)
Hye paul. Your video is awesome. I have problem on how to monitor phpmyadmin using laptop instead of lcd touchscreen? Help me sir
Thanks, glad you like the video. If you've installed a full LAMP stack then you should be able to go to xxxxxxx/phpMyAdmin where the XXX is your pi IP address 👍
Switched On Network i try to write on google at my laptop 192.168.x.xxx/phpMyAdmin but google writen not found
Switched On Network im sorry paul. What should i do to view the database on laptop screen ? I try to google the link that you wrote by insert my ip address/phpMyAdmin and the result was not found
Did you install phpMyAdmin too?
Switched On Network sir how do i need to install using laptop?
Hey...Its Great Video...I just want to ask,How can i write the rfid tags with rfid_code ?
Thanks! This USB reader can only read the RFID tags, it can't programme them too. For that, take a look at the RC522 RFID module. Thanks for watching!
@@SwitchedOnNetwork Thanks a lot....
Hello am trying to build a lock system for a solar system project using your previous code. What part do I need to remove from the code. It's going to be a two system authentication because the use of keyfob will not be needed
Hi, you'll basically need to remove all the bits that relate to waiting for keyboard input (ie the keyfob) and change the initial waiting screen to be that of the PIN entry. So you'll be looking at the show_idle() function, getting rid of the listen_rfid() function, etc. - although of course on that last function you'l be retaining the stuff to draw out the first PIN entry keypad.
The most important thing is to have a solid enough understanding of Python (read some beginners' guides elsewhere first, if you need to) and then look through my code and make sure you fully understand each part and what it does. I'm by far not the best programmer in the world, but I tried to lay it out logically and use sensible variable and function names etc. to make it easy to understand - have a play around and you should be able to change it to do whatever you like. Good luck!
@@SwitchedOnNetwork Yes thanks I've actually worked on that and remove those i just wanted to be sure I was doing the right thing. Thanks for your swift response
No worries, let me know how you get on 👍
@@SwitchedOnNetwork hello so have done all necessary things but I keep getting this error each time I run python lock.py: no module named MySQLdb and have installed all necessary things
you may have installed it for the wrong version of python, or not installed it correctly.
Can this be made to work with the NFC of both an iPhone and android phone? Please answer as it will be much appreciated and help in the near future. And in advance thank you for your time :)
Yes, I see no reason why it wouldn't work with Android. I know nothing about apple products though...
Switched On Network sweet thank you. Looks like I got some homework to do then haha.
Let me know what you find, I'll be genuinely interested! I know that the NFC chips, like everything in the Apple universe, are extremely (and unnecessarily) restricted...
Switched On Network haha yeup you’re right. All I could find for iPhone was an ios 10 (Apple is currently on iOS 12) jail broken work around to be able to mess with their NFC. Sigh maybe this year.
Hi sir i have go trough your code all , can i know what os did you use it . for this .
Raspbian
Question. Once you got in to that door, how will you get out? Thank you.
Latch on inside 👍
@@SwitchedOnNetwork thank you
can we add multiple rfid card?
Yes, unlimited - just add another database row for each
Great video, what about when you are in the room, can you add an over-ride switch so that you can exit?
Thanks, yes the possibilities are (nearly) endless so you can add/change pretty much whatever you like! 😀
Also, depending on the type of latch, you might just also have a catch inside for low-tech exit from the inside...
Hello, im a 19 years old portuguese Networking student on my final year, and im required to do a final project for graduation, im love eletronics and your 3-factor authentication door got me even more interested on it. I just wanted to ask if i could do something similar to that as my graduation project. I see that your project uses a touchscreen to show the information and to enter the code, i was thinking if it was possible to change that for a 4x4 keypad and having the messages showing up on a 16x2 lcd. And instead of having the Twilio sms system, having a Fingerprint sensor as the third authentication method. I was looking at your code and i understood a little bit of it but theres things i dont quite understand and im having a hard time adapting your code to use the 4x4 keypad and show the message on the 16x2 lcd. Can you give me some help changing the code, or some hints on how the code works?
If someone is experienced in python coding can you help me?
I highly appreciate it.
Thanks.
This is almost perfect for my smart door lock project; except that I'm pretty old school and didn't like the RFID system. I wonder if I could replicate similar system to this, but with a magnetic strip card swipe reader instead. Just swipe and it'll grant access XD
Awesome tutorial, and very much understandable even for someone with ADHD like me :D
That would be even easier to do, if you just wanted to swipe and get in. If you wanted to add the other factors, you would be able to essentially do the same thing he's doing just replacing the hardware and some of the coding with your proper hardware and code, essentially just replacing the RFID for the mag stripe. They essentially work the same, inputting a code into something, one just uses radio frequency to do it, while the other uses a magnetic strip.
If you just wanted the magstripe entry, essentially all you need to do is buy the magstripe reader and the raspberry pi, as well as any other things to operate the electronic door lock and set it up so you swipe and it unlocks. Honestly even using raspi would prolly be overkill, I'd imagine just a simple microcontroller would work, if you aren't gonna make it pull up a profile where you have to input your pin, then and send a temporary authentication code sent to your phone, as there is more processing needed. No need for internet or anything, though, so even a really simple raspi could prolly do it. Like a nano or something.
This is just me kinda guessing tho
Hey Paul fist of all great project, I have tried recreating this but I have reached the stage where everything is booted to the default screen asking to present "your token" but when I tap the key fob it doesn't accept it. I wrote down the number on the keyfob as the code on PHPMyAdmin. Please could you guide me on how to amend this.
Hey, thanks for your comment! The best way to go about this would be to debug as you would any other issue. If you run the script manually from a shell/terminal, rather than autoload on startup, you should hopefully see some errors get spat out to the command line which might point you in the direction of your problem. Failing that, modify the script slightly so you can figure out what's going on - get it to print out to the screen what code it thinks it's getting from the card, for example, and just check every single micro-stage of the process in that way until you find the issue. Good luck!
@@SwitchedOnNetwork I managed to fix the file so it runs but when it comes to scanning the fobs the screen doesn't change it stays stuck on the first screen. What should I do?
@@SwitchedOnNetwork I got the same question paul can you please update i'm stuck at the same point too. Thanks
Does it need a SIM card to send the SMS message? Great project!
No, as it uses a web service (Twilio in the example, you could use any) instead - so no SIM required 😀
Thanks!
Should I create a twilio account to receive an SMS?.If no from which account I receive it.I don't undrestand how I get this SMS?
Yes, but not to receive it - to SEND it. The SMS is sent to your phone. It's sent using Twilio (you could use any online service) and goes to the second "thing you have", ie. the phone in your pocket.
Hey man,
i really like your raspberry pi door lock System and im trying to rebuild it for school.
Following is my question:
How can I import the code and the database step by step? I dont know what to do.
Thanks in advance
Hi there! If you're familiar with installing a LAMP stack, that will give you a web server (Apache), database (MySQL) and the PHP language to tie the two together - this will enable you have the web interface to access the database, which is callled phpMyAdmin.
Install the LAMP stack, then install phpMyAdmin - there are tonnes of guides on how to do this, so I won't go into full details here in the comments.
Then, download the door_lock.sql file from my GitHub repo and use the Import feature of phpMyAdmin to import that.
For the script, you can use the "git clone" command to pull down the script from the github repo (github.com/paulfp/Three-Factor-Security-Door)
You'll need to insert your database username/password into the lock.py script before running.
I've also written up a more in-depth text version of the video tutorial here: www.switchedonnetwork.com/2017/11/10/build-the-ultimate-door-security-system-with-three-factor-authentication/
Good luck and enjoy!
Hi, if i pay could you Say to me now to do with Raspberry pi4 b but without rfid, only via smartphone to open door of Apartment and Door of the Building connect to intercom? Thank you, please
Hi there, yes I'm available for paid consultancy work - feel free to DM me on Twitter, Instagram or Facebook - I'm @paulfp in all those places or I'm at uk.linkedin.com/in/paulfp/ on LinkedIn. Thanks!
nice work! thank you for show us your work :)
Glad you liked it!
How do you leave?
Latch on inside 👍
Did you internet connexion for that
Yes, the Raspberry Pi needs to be connected either via WiFi or an ethernet cable into your network.
So I figured out why I couldn't find the Lxsession file, apparently this folder was in /etc/xdg/lxsession/LXDE-pi/autostart. So I attempted to edit this file and add the line you noted and still no luck. I cant seem to figure what else could be wrong. Can I transfer the lxsession file to .config, if so how can this be done?
What version of Raspbian are you running?
@@SwitchedOnNetwork Raspbian GNU/Linux 9.8 (stretch)
Yes, I believe you can copy that autostart file (using the cp command) to:
~/.config/lxsession/LXDE-pi/
Hi.how can I add a clock and date onto the screen,and a logo
Hey there! To add a logo, instead of your picture, you simply need to put a photo in GIF format in the same folder/directory as the Python script, then add the filename (without extension, as it can only be GIF) into the database field for your user. If you want to add this to the welcome screen, look at lines 143-145 of the code (github.com/paulfp/Three-Factor-Security-Door/blob/master/lock.py) to see how this is done and how to add it to the welcome screen.
To add a clock to the welcome screen, you'll need to create a label for your clock and then set a timer of some sort to update it every second, whilst it's on display, with the current time in HH:MM:SS format. You should then clear this timer when this screen is removed, and start it again when it displays again.
That's the general concept of how to do both your things, you'll now have to do the leg work yourself on how to turn that concept into reality. Have fun and enjoy learning! :)
Hi. I found very interesting your project and you made an excellent video. I want to ask you how could i scan with i2c pn532 reader? Thank you! :)
Thank you for your kind comments! I'm glad you enjoyed the video. I don't have any resources for that myself, but if you Google it there are plenty of resources which will help you. Let me know how you get on!
Any way to buy this kit
Yes, the purchasing links in the video description should all work 👍 let me know if any don't
this is amazing project
Hi, Im buildings this as a project and im having problems with the gui, im building this without a touchscreen (im doing it conected to a monito), the db and everything is setup correctly, i present my rfid card and it shows the right name on top, but theres no numbers to click, its just a white screen saying "Welcome "my name" ", can you try and help me finding out whats wrong?
That's probably quite an involved issue to solve which I'm guessing can't really be done in comments I'm afraid. This is a VERY old project now, so unless you're using the same versions of everything I used back in 2017 then I imagine a lot of things will be broken and need debugging/recoding.
@@SwitchedOnNetwork is there anyway to get the updated versions?
@@Browmbrownbrown all the software repositories ("repos") will have the updated versions of everything, and if you download Raspbian it'll be latest version. I've not produced updated versions of my code, as this was a one-off project for fun, but with a bit of debugging you should be able to make it work today :)
#Switched on Network # I love your great work. Can the RFID authentication be replaced with a finger print, if yes how do I go about it. Really need it for a project I'm working on in school. Thanks, look forward to your reply.
Yes it can be - just replace those bits of code and modify as required. Enjoy!
@@SwitchedOnNetwork You're Great
How much do you charge for a paided service
Channel memberships launching soon - watch this space!
Happy Holidays...I think I have found the route to my problem I am receiving this error message when trying to the script ImportError: No module named 'MySQLdb'. Can you instruct me on how to rectify it.
How to disable the sms function? I don't want to get a sms every time i open a door. And can I use the databased stored on a LAN server to have more door locks running on the same db?
Yes, you can build a bigger system by having a centralised database as you describe. And to bypass the SMS element, simply remove that bit of code and go straight to activating the relay! 👍
@@SwitchedOnNetwork what part of the code is the SMS bit?
Line 314