DIY Fingerprint Login for Any Computer (xiao + Arduino + Gt521f32)

1,948

26

8

Introduction: DIY Fingerprint Login for Any Computer (xiao + Arduino + Gt521f32)

About: Just about anything you can do yourself.

So, it seems like everything nowadays has some sort of biometric login. My work laptop has a fingerprint scanner which I love. My phone also has a fingerprint login, like who even types their passwords nowadays.

Just like everything else, I want my workstation to have a biometric login. So I made one using the Seeeduino Xiao and the GT-521F fingerprint scanner.

So the device is pretty simple. When you are on the login screen, you rest your finger on the sensor. The light will come on, the Wrong finger will do nothing, and if it is the correct finger, it types in your password for you.

Full Project Video

Supplies

Seeed XIAO: https://amzn.to/3yW1UpP

SparkFun GT521F32: https://amzn.to/38Sopl9

QWIIC Cable: https://amzn.to/3EmmP9I or

QWIIC Cable set: https://amzn.to/3tIpPbx

M3 Screws: https://amzn.to/2VJZwoI

Tools:

3D printer, Sandpaper

Step 1: Getting Starter - Seeeduino XIAO

The first goal is to get the xiao to work, so I followed the guide from SeeedStudio.com,

https://wiki.seeedstudio.com/Seeeduino-XIAO/

This included adding the xiao to the Arduino boards manager.

If you don't know anything about Arduino or microcontrollers, you can check out my Arduino playlist

https://youtube.com/playlist?list=PL1vbJjS91-vTXzd...

Once the xiao was set up, you can run a blink the LED code as always with any microcontroller.

Adding the Arduino Keyboard library, I can add a button to trigger a series of keystrokes.

https://www.arduino.cc/reference/en/language/funct...

This is great if you want to make keyboard macros for them GTA Cheat codes or change the tab when your mom walks into your room unexpectedly.

Step 2: Circuit Diagram and Fingerprint Sensor

I followed the wiring guide from Sparkfun.

https://learn.sparkfun.com/tutorials/fingerprint-scanner-gt-521fxx-hookup-guide/all

This sensor required a pair of these Qwiic cables, also sold by Sparkfun. I would link them in the description. You can also do like me and cut one of the double end ones in half and solder headers on both ends. Note that the colours of the wire are not standard. So black does not mean ground.

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 a 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 future project.

Step 3: Code

My GT-521F Fingerprint Library: https://github.com/justbarran/Just-a-Fingerprint-S...

There is a Blink example that can be used to test the wiring.

I originally hardcoded the password, and you can do that if you want, but what If I wanted to change the 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 non-volatile storage or NVS for short, and it is used to store information that isn't eased when the device powers down. That way, I can make a user interface to change the password or fingerprints at any time without editing the code.

Note: NVS has a limited amount of write cycles, most times in the range of 10s of thousands, so it is not really something to worry about for this application.

My Code: https://github.com/justbarran/FingerPrint-PC-Login

Step 4: The Housing

For the housing, I jumped over to fusion 360. I wanted it to have a small footprint and be simple. So two parts, a base to hold everything and a simple cover on top. I designed the bottom so the xiao can slide into place; the cover would lock in with an opening in the back for the USB C connector. And I added some standoffs to hold the fingerprint sensor with some m3 screws. This would allow enough space for the wires to pass. I rounded all the edges and sent this to the 3d printer.

3D files: https://www.thingiverse.com/thing:4970187

It came out better than I expected. Testing the fit, I realised the side clips were a bit too out, and I had to use some sandpaper to bring them down.

Step 5: Putting It All Together

The last thing to do was to solder up the wires. I cut the wires down to size to fit inside—this is where I realised the flaw in my slide-in design. I had to solder the wire as far in from the edge as to not mess up the sliding process. It was a tight fit, so bear that in mind if you use this design. Live and learn, but it worked, and I think it looked amazing.

Step 6: Using the UI

Jump to 9:55
https://youtu.be/po1630srsHI

When the device is plugged into the computer, the led should blink once, indicating it is ready. The flash is cleared when we upload the code, so it goes to its default passwords and removes all prints.

Generally, the device would be in sleep mode waiting for a fingerprint. But first, we need to set it up because right now it has nothing in the memory.

To do this, I Open the Arduino serial monitor/ or any serial monitor would do. The baud is 9600, and we want "No line ending. Now we want to wake up the menu. Resting your finger on the sensor would make the device think you are trying to log in, and it wouldn't wake up the device. You need to do a simple tap, and it would wake up and say enter a password.

Note. I have set it to 5 tries before the entire memory is wiped and fingerprints erased. Also, the password needs to be at least 4 characters long.

I have set the default menu password to 12345678, so I type that in and press enter to send.

A menu would show up. From here, I can change the device password, change the login password, 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 1, and you would be instructed to enter a new device password twice. If you take too long or if the passwords don't match, the setting will fail. If both passwords match, your password is changed.

Now, let's change the logging password by sending 2; this would be the password for your computer. The same goes here as the device password. But just note the serial field doesn't have an auto-hide feature. So be careful of who is around.

Then you can check if any prints are added by sending 3; Since this device is new, it should say 0.

Adding a fingerprint is also easy. You send the number 4 and follow the on-screen instructions. You would have to press your finger 3 times to be stored. If there is an error at any time or you switch fingers, the process would be cancelled, and you would be sent back to the menu.

The print is stored.

You can check any of your fingerprints by sending the number 5 from the menu. This would return if it was found.

Lastly, if you want to clear all print, send then number 6.

Leaving the device alone for 10 seconds would relock the device, and after 20, it would go back to sleep mode, waiting for a finger

So in the end we get this.

Super simple right, And i have been using this for the past month with no issues even when unplugged or powered down. so I am pretty happy with how it came out.

Step 7: Future

Now the last thing to talking about is security and encryption. Something to add in the future would be to encrypt the passwords with a random key before storing them in flash memory. This is important to make it more difficult for someone to write a code to retrieve the data from flash.

Arduino automatically wipes the flash before programming, but someone else could use another software that doesn't.

Another thing I can do is to use the unique serial number for the fingerprint sensor to pair that sensor to the xiao. This is similar to what Apple does with their fingerprint sensors. This is particularly important since the matching is being done on the GT521f and not the XIAO. This is to prevent someone from, let say, trying to switch out the fingerprint sensor with one that has their prints on it.

I can seal the housing in resin so that someone has to physically destroy the device to open it which is also something some manufacturers do.

So long story short, this was a fun project, but it should not be used to protect a bank vault. Still, it should be acceptable for your personal computer.

There are additional features I am thinking about for version 2 Like storing multiple passwords. So let me know in the comments if you also have any more ideas.

Be the First to Share

    Recommendations

    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge
    • Home Cooked Speed Challenge

      Home Cooked Speed Challenge
    • Organization Contest

      Organization Contest

    8 Comments

    0
    justbarran
    justbarran

    Reply 10 days ago

    Thanks a lot

    0
    VicW3
    VicW3

    Question 20 days ago

    Can I buy a complete kit…or better yet, a completely assembled unit?

    0
    trivenijakkireddy1
    trivenijakkireddy1

    Question 21 days ago

    Is this project only useful for PC's?

    0
    justbarran
    justbarran

    Answer 21 days ago

    I think the possibilities are endless as to what it can be used for. What are you thinking off?

    0
    Ranuga
    Ranuga

    25 days ago

    Very useful project. I would like to try it. Well Done:)

    0
    justbarran
    justbarran

    Reply 24 days ago

    Thanks a lot, be sure to let me know if you run into any issues and let me know how it comes out if you do.