Unlock any computer with your finger (XIAO + Arduino + GT-521F)
My work laptop has a fingerprint scanner, which i love. My phone also has a fingerprint login like who even types their password nowadays, just like everything else, i want my workstation to have a biometric login, and i want to make this with parts i already have, because who just has random microcontrollers and fingerprint modules line or Wrong so i came up with this fingerprint login device, its the just a fingerprint login by just byron, now tell you how it works. Afterward from this video sponsor, you dont have any sponsors, so the device is pretty simple when youre on the login screen. You rest your finger on the sensor. The light will come on and the wrong finger will do nothing and, if its the correct finger, it types in your password for you to be honest, its the heights of laziness. But i mean who isnt lazy nowadays and isnt that a point of automation to replace humans, i mean to make our lives a little bit more comfortable isnt that right, elon musk, who knows lets dive deep into how this project works. All the features i packed into this tiny device and why a simple weekend project turned into a month of work. This is just byron on this channel. I do just about anything. You can do yourself, so i didnt want the device to need any extra software or drivers. The idea here is to follow the cash rule. Keep it simple stupid.
I want something that will do the same thing. My fingers do thats what she said. The point is to simulate a keyboard to enter the password and use a fingerprint sensor to verify and trigger it. It also needs to be as small as possible to avoid too much space. On my desk i mean the costly real estate of my desk, probably rivals that of dubai. So here size does matter and the smaller the better well thats, not what she said. So i could 3d print the housing to get it. Nice and small, simple right lets head to the lab Music. Now i have three different fingerprint sensors lying around two of these are based on the as608 chip. You would see in most arduino projects, while the gt521f32 by sparkfun is less common. Now i could sit here and compare these sensors, but i know you dont got time for that. You just want to know what to buy so i picked the gt521f mainly because of its size and how elegant it looks all sensors can store 100 prints and if 100 fingers can unlock your computer, then what is the point of even having a password? So it really boiled down to which had the best form factor and the gt521 really had a nice look about it like look at it now. Remember when it comes to electronics looks doesnt matter until anyone tell you otherwise for the microcontroller, i could have gone with the arduino pro micro.
I have used this in previous videos, like my diy pc drone controller video, its easy to use and supports usb hid, so it can act as a usb keyboard. Still, i recently got this super cute seed studio zao that can also do usb hid its hands down. The better choice with a 48 megahertz clock and 3.3 volt logic funny enough zhao means small and chinese and me being 5.6. I know what it feels like to be zhao its built around the zamdi 21, which packs a 32 bit arm. Cortex processor, with songs, really fancy and cool, but it doesnt mean it could run minecraft well. Can it the gt521 fingerprint sensor also uses 3.3 volt logic. So there is no need for any logic level, electronics, basically its the definition of relationship goals. Something worth noting is the code at the end of the day should be still compatible with arduino pro micro with little modifications. The first goal was to get the zhou to work, so i followed the guide from seedstudio.com, which included adding this out to the arduino boards manager. If you dont know anything about arduino or microcontrollers, you can check out my arduino playlist linked in the description Music. Once the tsar was set up, you have to run a blank led code as well as with any microcontroller project Music, adding the arduino keyboard library. I can add a button to trigger a series of keystrokes. This is great if you want to make those keyboard macros for those gta cheat codes or change the tab when your mom walks in unexpectedly, Music now to add the fingerprint sensor, i followed the wiring guide from spark phone.
This sensor required a pair of these qw iic cables, also sold by sparkfun. I will link them in the description or you can do like me and cut one of these double ended ones in half and solar headers on both ends. No, the colors of the wires are not standard, so black does not mean ground. I will link this circuit diagram in the description the connector on the right is for the capacitive sensor. It lets the microcontroller know a finger is on the sensor. The other side is for the data lines. You can also solder usb cable to the underside and connect the sensor directly to the computer, which i thought was pretty cool. You can download and see your fingerprint, among other things, definitely something for a feature project in arduino. I added the sparkfun library by josh. You can use the blink example to test the wiring. It was great to see everything working on the first try. I first loaded my fingerprint with the enrolled example. I then used the id example to verify my fingerprint and lock me in it worked well, so i thought late in the day i tried to fingerprint sensor again and it was not working and i had to type in my password like a caveman again. This is where the problem started. The light did not come on, which told me one of two things could be the problem: either the capacitive sensor stopped working or there was a problem in the code.
I unplugged the board and plugged it back in, and everything was working fine again after spending some time. I realized the problem was in the library. What happened was they would send a command to the fingerprint sensor and use the while loop without a timeout to wait for reply? This sometimes may never happen because uat isnt always accurate. The sensor could be busy or the wire could have noise a while loop without a break condition is essentially like cancer, which can eventually lock up a code. So i decided to write my own library. This is not a discredited library by josh, it works, but it was last updated four years ago and it was limited to the only software serial. So it was something quick to get started after a week of reading the data sheet and testing. I finished my own library. This has more core functions needed for some of my future projects and, most importantly, hardware and software serial. This library would be available on git for anyone to use. I can even disconnect the sensor and plug it back in without the cord locking up something joshs library cant. Do the code didnt crash after a week of use so its safe to see that its working great for the housing i jumped over to fusion 360.. I wanted it to have a small footprint and be simple, so i thought two parts a base to hold everything and a simple cover on the top.
I designed the bottom, so the zow can slide into place. The cover would then lock in with an opening in the back for the usbc connector, and i added some standoffs to hold the fingerprint sensor. This would use some m3 screws. This would also allow enough space for the wires to pass. I rounded all the edges and send this to my 3d printer. It came out great better than expected test fitting. I realized the side. Clips was a bit too old and i had to use some sandpaper to bring them down Music, but it worked, and i think it looked amazing. The last thing to do was assault up the wires. I cut the wires down the sides to fit inside and this is the way i realized a problem. In my sliding design, i had to solder the wires as far from the edge as possible as to not mess up the sliding process. It was a tight fit. So bear that in mind if you use this design, but it worked and i think it looked amazing Music. I originally had quoted a password and you can do that if you want. But what if i wanted to change a password later, would i need to reprogram the whole thing over, so my solution was to store the password in flash storage. Among some other things. This is the non volatile, storage or nvs for short and its used to store information that isnt erased when a device powers down that way.
I can make a user interface to change your password or fingerprints at any time without editing the code, so 700 lines of code later and a quick upload and the device was finished when a device is plugged into the computer. The led should blink once indicating it is ready. The flash is cleared when we upload a code, so it goes to its default passwords and it removes all fingerprints generally. The device would be in sleep mode waiting for fingerprint, but first we need to set it up because right now it has nothing in the memory to do this. I open up the arduino serial, monitor or any serial monitor would do. The baud rate is 9600 and we want no line ending resting. Your finger on the sensor would make the device think its trying to log in and it wont, wake up the device. You need to do. A simple tap and a wake up device saying enter password. Ive set the default menu password to one two, three, four, five, six, seven eight. So i type that in and press enter to send note. I have set this to five tries before the entire memory is wiped and fingerprints erased. Also, the password needs to be at least four characters long a menu would show up from here. I can change the device, password change, the login password and add a new fingerprint. Among other things, it is recommended to change the device password, but i think the default is pretty secure, send the number one and you will be instructed to enter a new device password twice.
If you take too long or if the passwords dont match the setting would fail if both passwords match your password is changed now lets change the logging password by sending two this would be the password for your computer. The same goes here as the device password, but just note. The serial field, doesnt have auto hide feature, so be careful of whos behind you, then you can check if any prints are added by sending tree. Adding a fingerprint is also easy. You send the number four and follow the on screen instructions. You would have to press your finger three times for it to be stored if theres an error at any time or you switch fingers, the process will be cancelled and youll be sent back to the menu. Great, my fingerprint is stored. You can check any of your fingerprints by sending the number 5 from the menu. This will return if it is found. Lastly, if you want to click all the fingerprints, you can send the number six leaving the device alone for 10 seconds. You will relock the device and after 20 it will go back to sleep mode, waiting for a finger. So in the end we get this super simple right and ive been using this for the past month with no issues, even when unplugged or powered down so im. Pretty happy with how it came out now. The last thing for us to talk about is security and encryption.
Something to add in the future would be to encrypt the password with a random key before storing it in flash memory. This is important to make it more difficult, for someone to lets say, write a code to retrieve that data from flash now arduino automatically wipes the flash before programming, but someone else could just use a different software that doesnt. Another thing i can do is to use the unique serial number from the fingerprint sensor to pair that sensor with this out. This is similar to what apple does with their fingerprint sensors. This isnt particularly important since the matching is being done on the gt521f and not the sao, so someone can lets say, try to switch out the fingerprint sensor with one that already have their prints on it. I can also seal the housing and resin so that someone has to physically destroy the device to open it, which is actually something some manufacturers do so long story short. This is a really fun project, but it should not be used to protect a bank vault still. It should still be acceptable for your personal computer once you dont have any hackers in your family, and i think if you did, this would be the least of their worries. So i hoped everyone liked and enjoyed this video. There are additional features i am thinking about. For version 2.