Biometric Access

Arduino-based Fingerprint Lock

Johann Wyss

Issue 26, September 2019

This article includes additional downloadable resources.
Please log in to access.

Log in

Fingerprint access is not limited to unlocking your Smartphone. Thanks to an affordable fingerprint sensor, we show you how to build your own biometric access controller.


We’ve seen Sci-Fi movies as far back as 1966 using biometric access. For example, there was voice, retina and facial recognition in Star Trek (1966), voice and facial recognition in 2001: A Space Odyssey (1968), and fingerprint ID in Back To The Future II (1989) where Biff pays his taxi fare using his thumbprint.

We see many things from Sci-Fi movies become a reality, and it was in 2004 that we saw a fingerprint reader built into an IBM ThinkPad laptop. We’ve also seen smartphones over the last few years with fingerprint access, and very recently into credit cards!

Thanks to the popularity of fingerprint technology in consumer electronics, we're now seeing the technology become available to us Makers. We spotted the Fingerprint Sensor (XC4636) that recently became available at Jaycar Electronics, so we just had to put it to the test and build it into a project.


Biometric authentication, simply put, is the measurement of biological characteristics in order to identify or single out an individual using biologically unique identifiers. This process is commonly used in electronic access and denial control systems, where instead of a physical key an individual can use their unique biological traits to gain access to an area or system.

The most common and arguably the most established form of biometrics for area access and denial systems is the fingerprint scanner. It should come as no surprise to anyone that each person on Earth has a largely unique fingerprint, evidenced by the fact we have been using fingerprints as a method of criminal identification for decades.

For this month’s project, we are going to show how to interface the Jaycar fingerprint sensor module with an Arduino microcontroller development board to create a biometric fingerprint lock.

You are not limited to controlling a relay. You could extend this to create any number of projects. For example, you can activate an electrical device, launch a rocket, gain access to your PC, track who has entered a room, building, etc.


The key component of this project is, of course, the XC4636 Fingerprint sensor module from Jaycar Electronics. This sensor essentially takes a photo of your fingerprint and stores key data relating to individual traits to the onboard memory. These traits refer to specific markers unique to the individual.

With the help of an Arduino and some code, the sensor records things such as the position and number of ridge endings, the number and position of ridge bifurcations (where a ridge diverges into two separate ridges), and the number and location of short or island ridges.

Combined, this allows the sensor to create a very detailed map of an individual’s fingerprint, which it can compare against the fingerprint of people attempting to gain access to a system.

Top to Bottom: Ridge Ending, Bifurcation, Short Ridge

It checks the current fingerprint of the person attempting access and compares it against the fingerprints stored in memory to verify if a person is granted access. It also produces a confidence score between 0 and 200 to demonstrate how positive it is of a correct match. This threshold can be set in the Syno Chip software by using the “Secure level” between 1 and 5.

We simply take the result from this sensor, and if that number is within the range of approved/accepted fingerprints, we trigger a relay. This relay could actuate a door strike, solenoid, or with a little modification even control a servo.


Because the fingerprint sensor was so new, there was very little information available on how it worked. There was no datasheet available at the time and there was not even a reliable pinout for the module. All we knew was that the module ran on 3.3V and should work with the software serial library made available on GitHub.

Our initial attempt to use this sensor was to make some basic assumptions, primarily related to wire colours. In most applications, it's reasonable to assume that a red wire will carry the supply voltage while a black wire will usually be the 0V or GND connection. With this in mind, we set the current limit on our power supply to 30mA with a supply voltage of 3.3V and attached it to the module wires. It did nothing and showed zero current flow. This meant the next step was to teardown the product and reverse engineer it to identify the pinout.

The first component that gave us an idea of the devices pin configuration was the diode. This component appeared to be reverse polarity protection, which would suggest that the anode of this diode would be connected to the VCC pin. With our multimeter in continuity mode, we tested for a connection between the anode of this diode and the six available wires. This did confirm that the yellow wire on our device was the VCC pin.

With VCC found the next step was to find the GND connection. We originally attempted to find the GND by identifying the processor and searching its datasheet. While this did indeed make it perfectly clear which pin on the IC was GND, it also showed that it was not possible for our probes to reach it as it was on the bottom side of the IC.

Jaycar's Fingerprint Sensor Module, XC4636

Therefore, we began to look at the accompanying components. Since this is a microprocessor, we knew it will need bypass capacitors, and since it’s a DC application, we know that it’s highly likely the vast majority of capacitors will be attached to GND. We could simply look for continuity between the GND of the capacitors and the attached wires. In doing this, we realised that the red wire on this module was the GND connection.

The final step was to identify the serial RX and TX pins. This was done using the continuity mode in conjunction with the datasheet for the processor. We simply followed the UART RX and TX pins to their respective wires.

In our case, this was Black as TX and White as RX.

During this process, we noted that the signals each went through a three terminal SOT23 package device, likely to be a transistor. This would indicate that we may not need to step the voltage down to 3.3V on the data lines, however, to err on the side of caution we will proceed by using a voltage divider on the signal inputs.


Ideally, the voltage divider on the TX and RX lines should be around 5 to get the 3.3V desired output, as evident by this voltage divider calculation.

Vout = Vin × (R2 / (R1 + R2))

We know:

Vout = 3.3V

Vin = 5V

R1 is the top resistor we need to calculate

R2 is the bottom resistor, which we will make 10kΩ.

Rearranged to make R1 the subject, the formula is:

R1 = (R2 × (Vin - Vout) / Vout) = (10000(5 - 3.3)) / 3.3 = 5151Ω

We will use the closest E12 resistor value in our final build, however, for our prototype, we can get away with simply using two 10kΩ resistors for an output of 2.5V.

The Fundamental Build:

Prototype Fingerprint Controller

Parts Required: JaycarAltronicsCore Electronics
1 × Arduino-Compatible NanoXC4414Z6372CE05101
1 × Fingerprint Sensor ModuleXC4636--
1 × Relay ModuleXC4419Z6325CE05137
4 × 10kΩ Resistors*RR0596R7058COM-11508
2 × 330Ω Resistors*RR0560R7040COM-11507
1 × 5mm Red LEDZD0150Z0800COM-12903
1 × 5mm Green LEDZD0170Z0801COM-12903
1 × 3-pin Male Pin HeaderHM3212P5430FIT0084
1 × 50x70mm PerfboardHP9550H0714ADA2670

Parts Required:

* Quantity shown, may be sold in packs. You’ll also need a breadboard and prototyping hardware.

Prototype Fritzing.

To get our fingerprint module up and running, we used an Arduino Nano, a breadboard and some prototyping hardware. Follow the fritzing diagram shown here to build a prototype of your own.


To get the device working, we first need to enrol the approved fingerprints to the device. This can be done using Arduino programming or via the Windows application.


We need to program the fingerprint sensor itself with the fingerprints we want to allow and their respective location.

The device can hold over 150 different fingerprints into its internal storage. To store these fingerprints, we need to save the fingerprint of the approved individuals, which is then stored to the device. The simplest way for us to do this is to scan them in. It is possible to use some Arduino software created by Adafruit to enroll the fingerprints, however, for the purpose of this project we will use the windows software as it allows us to quickly test and troubleshoot.

To use the Windows software, we need to be able to connect the fingerprint sensor to the computer. We found the easiest way to do this was to use an Arduino as a passthrough device.

Connect the fingerprint sensor to the Arduino Nano or UNO as shown here.

Enroll Fritzing.

Note: The TX of the sensor goes to the RX or the Arduino and the RX of the sensor to the TX of the Arduino.

You then want to upload a completely blank sketch to the Arduino, which will allow the Arduino to work as a serial passthrough by simply connecting directly to the serial input.

We then used the following code.

void setup(){
void loop(){

You next need to download and run the SY software demo software, which is available from:

This software will allow you to scan and upload images of your fingerprints to the sensor. To run it, connect the fingerprint sensor to the Arduino and connect the Arduino to the USB port on your PC. Take note of which COM port the Arduino is connected to.

In the SYNO CHIP software, select the open device button and select the correct COM port from the drop-down menu.

When connected correctly the display will read “Open device success!”.

In the enroll section, check the Preview tickbox option and select Enroll for a single print or CON Enroll for a continuous enroll process, which will start at a location and continuously add new fingerprints to the next location. For simplicity, we will just enroll one more fingerprint.

Clicking the Enroll button will open a prompt asking you to enter the address. This is the location the fingerprint will be stored and the result we will use later in our sketch. We will use the address location 1 to store this print. Type in the number 1 and press OK. If you’re already using this address, the program will prompt you to overwrite the existing print stored in this location or to select a different address.

The program will prompt you to press your finger against the sensor and display an image of the stored print. Note you will need to do this process of scanning and storing a fingerprint twice before the display reads “success to enroll!”.

Repeat this process of scanning and storing each of the fingerprints you plan to use in your project.

You also want to record whose fingerprints are stored in what location as the sketch can be programmed to do different things based on the person whose fingerprint was scanned. For example, you could have the program output a frequency specific to an individual or even output a serial string of data dependent on who was detected.

When you’re finished adding people you simply select the Exit button to leave the program.


The code for this project was sourced from the Adafruit fingerprint example, and then modified to suit our application. For our prototype, we have designed a simple fingerprint activated relay, which you can trigger a device that suits your needs.

The code is available from the resources section on our website. Our contribution to the code is essentially as described below. We have requested that when a fingerprint is compared successfully that the ID or address of that fingerprint be stored in a variable called result.

This allows us to have the program respond dependent on whose fingerprint is detected. However, for simplicity, we have it written so that if the program responds with a number between 1 and 5 (the number of fingerprints we had scanned in) the program will pull the pin connected to the relay module high.

if (result >0 && result <6){ 
  // if result is within expected range
  digitalWrite(green, HIGH);
  digitalWrite(red, LOW);
  digitalWrite(relay, HIGH);
  else {
    digitalWrite(green, LOW);
    digitalWrite(red, HIGH);
    digitalWrite(relay, LOW);
  if (count > 2) { 
  //resets state to low change 
  //this to suit need .5 sec each
    count = 0;
    result = 0;

We added a count to the code to switch the relay on momentarily. After the count, it resets the result back to the neutral state (0), which causes the relay to disengage.

You could remove this code if you want to toggle your relay instead, however, this would result in the relay staying on until an incorrect or unrecognised fingerprint is read.

if (count > 2) { 
  //resets state to low change this 
  //to suit need 0.5sec each
  count = 0;
  result = 0;

Testing and troubleshooting

When power is connected correctly to the circuit, the sensor module should illuminate blue. If your module does not illuminate, make sure that the VCC and GND connections are correct. Note that the sensor module needs 2 pins held at 3.3V for the unit to operate correctly.

If you're having issues connecting the sensor to the SynoChip software, double-check your RX and TX connections and reverse them if necessary.

You may also need to double-check which COM port you are connected to. You can do this using the device manager in Windows or just check using the Arduino IDE, which can be a lot easier. Under Tools in the Arduino IDE menu, there is a port selection. Your Arduino Nano will be on the selected port, assuming you just uploaded a sketch).

If you're having an issue where your microcontroller resets after actuating the solenoid, try putting a diode across the solenoid VCC and GND pins (anode to Vcc and the cathode to GND). This will solve back EMF issues as described later in this project.

Colour-Coded Wiring Harness

The fingerprint module we used in this project had a wiring harness with non conventional colours. i.e. red was not positive, nor was black GND. It's possible future stock could have different colour wiring. You can compare the module you have to the diagram we show you above.

The Main Build:

Fingerprint Controlled Solenoid

ADDITIONAL Parts Required:JaycarAltronicsCore Electronics
2 x 4.7kΩ Resistors*RR0588R7054COM-10969
1 × Tactile SwitchSP0600S1120FIT0179
Female Pin HeaderHM3230P5390PRT-00115
1 x DC Power JackPS0522P0622PRT-10785
1 x 1N4004 DiodeZR1004Z0109COM-14884
1 x 50x70mm PerfboardHP9550H0714ADA2670
4 x M3x8mm ScrewsHP0550--
1 × Mixed Jumper WiresWC6027P1017PRT-14284
1 × 50x70mm PerfboardHP9550H0714ADA2670
4 x M3x8mm ScrewsHP0550--
1 × Mixed Jumper WiresWC6027P1017PRT-14284

ADDITIONAL Parts Required:

OPTIONAL:JaycarAltronicsCore Electronics
1 x SolenoidSS0902J0902ADA1512


* Quantity shown, may be sold in packs. Hot glue, super glue, hookup wire and prototyping accessories may also be required.

We will now describe a build that turns the prototype into something more permanent using a perfboard and custom designed 3D printed enclosures. The enclosure for the fingerprint sensor is designed to be flush mounted into a wall or box, and includes two LEDs for lock and unlocked status. The second enclosure will house the electronics, which should be mounted away from the sensor to limit access to nefarious people who may try to defeat the system. They could, for example, manually apply 5V to the relay coil to open the lock if they could gain access.

The electronics enclosure has a single button, which can be used to trigger the relay/lock to let a person out of the building or room. It will also need a power jack to power the device and a port to connect the wires from the relay to the device you want controlled, in our case, a solenoid.


The electronics can easily be made by soldering the components onto a perfboard. Follow our images shown here and refer to the schematic if required to confirm any connections. You may notice a hole in the middle of the board. This is to allow the wires to travel out the back of the case if you plan to mount it onto a wall and want the wires hidden.


If you plan to install the project into the enclosure we recommend you swap the 90° angled header on the relay module with a straight header. This will allow the module to fit flush against the PCB. To do this, de-solder the existing header using solder braid or desoldering pump, and solder in a straight header.

Note: The NO and COM pins of the relay module are connected to the PCB using hookup wire. These two wires hold the 12V input power which powers the device you wish to actuate. When the relay is activated this allows 12V to flow through the relay, energising the device.


We used a 2-pin male pin header for the power input that would connect to the DC jack. This is routed to the Vin pin of the Arduino Nano, which is attached to the 5V and 3.3V regulators on the Arduino board. This can supply voltage to the Nano, the relay module and the fingerprint sensor.


When everything is soldered to the PCB you should have 10 wires exiting the enclosure via the rear. The table below shows the wiring we used in our build.

* The fingerprint sensor module has two wires that to connect to 3.3V. In our case, these were the blue and yellow wires.


Interestingly, when we tested our final build, we discovered an issue where the microcontroller would reset each time the solenoid actuated. Using our oscilloscope, we traced this resetting behaviour to back EMF. When the power was removed from the coil of the solenoid the energy stored in the device had nowhere to go resulting in the huge negative voltage spike you can see in the image below.

Note: That the oscilloscope is set to 10V and 80 nanoseconds per division.

The coil of the solenoid is essentially working as an inductor. When the relay is deactivated, the energy in the inductor (coil) results in a huge build-up of electrons at the relay connections. We can see that the transient response after power is removed from the solenoid coil lasted for around 1 microsecond with a maximum peak-to-peak voltage of over 55V. We suspected that this transient was the cause of our reset issue.

To rectify this we added a flyback diode across the solenoid inputs. This diode provides a direct path to ground, which enables the buildup of electrons to be dissipated when the relay disengages.

A general purpose 1N4004 diode was sufficient for this task. However, schottky diodes are generally the go-to device for this situation due to their faster response times.


Five parts make up the enclosures required for our project. Altogether, the parts take about six hours to print, at the various layer heights. Feel free to adjust the layer height of each part to suit your needs and the quality of your printer. You can download the .stl files from the resources section of our website.


The fingerprint lock part was printed on our Flashforge Creator Pro at a 200-micron layer height using Jaycar PLA. It is designed to print laying flat on the build platform and prints fine without supports. In this orientation, and at this layer height, it takes approximately one and a half hours to print.

The tolerances on this part are fairly tight as we want the sensor to be held firmly in the enclosure. We have added a pin to prevent the sensor from being removed easily, however, the tolerances still need to remain quite tight. Your printer tolerance may, of course, vary from ours and the part may be too tight when printing with your equipment. If you’re having any issues getting the part to sit correctly consider importing the part into Tinkercad and widening the sensor hole slightly.

Note: We did not design any mounting holes. It is designed to be surface mounted onto a wall or flat surface. You can simply glue the device in place, or a better option would be to screw it to the wall from behind so that there is no mounting hardware visible. i.e. making it more difficult to tamper with it. We left the mounting options open so you can decide how best to mount it for your application. Again, you can easily import the part into Tinkercad and make the required adjustments to suit your application.


The lock base holds the Arduino and the relay module. It was printed on our Flashforge Creator Pro using 3DFillies orange PLA+ at a 300-micron layer height. We designed the part to print flat on the build surface without supports and at this layer height and in this orientation, it took about 2.6 hours to print.


The lid is designed to friction fit over the lock base enclosure. It has a hole for the button that allows a person on the inside to leave the room. Like the Lock base enclosure, it was printed in 3DFillies orange PLA+ at a 300-micron layer height. In this orientation and layer height, it takes about one hour to print.


The pin is designed to prevent the fingerprint sensor from being pushed too far into the fingerprint lock enclosure, or to be pulled out exposing the electronics and enabling a person to attempt to bypass the sensor. It was printed on our Cocoon Create i3 3D printer at a 100-micron layer height. It takes about 30 mins to print. We chose black Flashforge PLA for our design.


The button is simply a small part that protrudes through the case and makes contact with the small tactile button below. This part allows a person on the inside of the room to be able to bypass the sensor and let themselves out. It was printed in Flashforge black PLA on our Cocoon Create i3 3D printer, which took 15 minutes to print at a 100-micron layer height.



The lock base is designed to fit a perfboard with the dimensions 50x70mm. This is screwed in place via the four mounting studs.

If you plan to mount this enclosure on a wall, you will need to drill a hole drilled into the centre of the perfboard, which allows the wires to run through the wall to the sensor.


As you can see in the images here, the 3D printed pin slots into the grooves moulded in the fingerprint sensor module to hold the module in place.

The LEDs should friction fit. You can use hot glue to help keep them in place if you wish.

We have used general purpose breadboard jumper wires in our project, however, you will need to hardwire your circuit depending on your application.


No doubt, many of you have now heard about the individual who was to able use a 3D printed fingerprint to fool the fingerprint sensor in the Samsung S10, or the case where Police in Michigan allegedly did the same with an iPhone. It’s obvious that fingerprint sensors are not foolproof like most security systems. Anyone with the right motivation and the right amount of technical expertise with access to modern technology is able to circumvent this technology.

We first thought we could use a printout of a fingerprint to test our project. Is it possible to fool one of these inexpensive modules with a photocopy or printout of a fingerprint? The good news is that our tests using a printout failed. We found the highest resolution fingerprints we could by searching the internet and even by scanning our own fingers. When pressing the printout to the sensor the sensor would simply not read them, which we assume is the optics in the sensor that relies on a precise focal distance. When using a flat 2D object, the sensor would seemingly view the entire piece of paper as one flat object, and not determine any ridges to represent a fingerprint.

If you are keen and want to go to the trouble, you could try 3D printing a fingerprint on your printer to see if you can fool the sensor.

You could monitor the RX and TX lines from the sensor, and replicate the signals as a means to bypass the sensor completely.

The images here show the sensor transmit (TX) and receive (RX) data when a correct fingerprint is recognised. It would be quite trivial to replicate this communication sequence, which hypothetically would result in the microcontroller responding by actuating the solenoid.

Of course, to do this you need to be able to monitor the RX and TX packets when a pre-approved fingerprint is applied to the sensor, which of course, presents a few challenges to the task of circumventing the security. All in all, we would argue the sensor is at least as effectively secure as any similarly styled sensor, which means, whilst it’s perfectly acceptable as a key to enter your house, etc., it’s not something you want to use as your only means of security for items of incredibly high value.


Our project triggers a relay, which in turn, actuates a solenoid. However, you’re able to modify this basic circuit to do any number of things.

Keep in mind that when a pre-approved fingerprint is detected, digital pin 5 is pulled to 5V, which activates the relay and whatever load you have attached to it. The Arduino has a maximum input voltage of 12V and a low input of 7V, which means the maximum input to this circuit and thus the load is 12V, and can’t be exceeded without risking damaging the microcontroller. This means that any load you wish to power must be 12V or lower.

One of the most obvious ways to modify this project would be to replace the solenoid with a 12V door strike, which can easily replace the existing locking mechanism of an existing door. These are available from electronics and hardware stores.

Of course, it’s also very simple to remove the relay module and have the device move a servo to a set position when a recognised fingerprint is detected. This would be ideal for smaller projects where, rather than protecting your house, you’re more concerned about protecting your stash of candy or other such smaller value items. To do this, you simply modify the code to move the servo to a set position when a result register is a number in the expected range. If you’re not sure on how to use servos with the Arduino development platform we recommend you take a look at some of our previous projects such as the Sensors and Servos Kid’s Basics, Grippy Robot Arm, Lolly Sorter or Servo Tester. You will find these on the projects page of our website.

CAUTION: A device designed to keep people out of an area is equally as good at keeping people inside of an area. If you’re planning on using this device as a means of ingress control, please ensure you implement a release on the inside that will easily work in an emergency. i.e. people can still exit if the power is lost, etc.