Getting Started with Fingerprint Sensor Integrated SM630

Fingerprint authentication is faster, safer and more secure as compared with other types of security authentication, and that’s why fingerprint authentication has widely been used in security applications nowadays. SN-FPR-SM630 (also known as Fingerprint Sensor Integrated SM630) is one of the fingerprint verification modules available in Cytron store. It consists of an optical fingerprint sensor, a high performance digital signal processor and Flash memory. There are various functions we can do with the sensor, i.e. add fingerprint to database, delete fingerprint from database, search fingerprint from database, empty fingerprint database, etc. In this tutorial, I will explain how to interface this sensor with MCU, i.e. CT-Uno.

Hardware Required

  1. CT-Uno,
  2. SN-FPR-SM630 Fingerprint Sensor,
  3. Jumper wires.

Software Required

  1. Arduino IDE, in this tutorial I will use version 1.6.5,

 

Hardware Connection

The SN-FPR-SM630 fingerprint sensor come with a 4-pins cable, and the pin configuration are shown as below:

001

I reserved the hardware serial port (pin 0 and pin 1) so I can display the result on Serial Monitor. In this tutorial, I used SoftwareSerial library, and the SN-FPR-SM630 fingerprint sensor is connected with CT-Uno by following configuration:

SN-FPR-SM630 Fingerprint SensorCT-Uno
Tx10
Rx11
Power Supply –GND
Power Supply +5V

Communication Packet

The communication packet is the communication code between MCU and SN-FPR-SM630 fingerprint sensor. The packet consists of:

Packet head + Packet flag + Packet length + Packet content + Check sum

The packet is started with 0x4D 0x58, which is the packet head, followed by packet flag. The packet types and their corresponding packet flag are tabulated in table below:

Command packet0x10
Data packet0x20
Last packet0x21
Response packet0x30

The packet length is the length of the packet content while the packet content contains the command code or the response code. You can refer to user manual of SN-FPR-SM630 fingerprint sensor for more details of packet length and packet content. Let’s take ‘add fingerprint’ command as an example, if we want to add an fingerprint at position 0 of database, the packet content is started with 0x40 and followed by position code, hence the combination of the packet will be

Packet head   Packet flag   Packet length   Packet content   Check sum   
0x4D 0x580x100x030x40 0x00 0x000xF8

As shown in table above, check sum is actually the sum from packet head to packet content:

Check sum = 0x4D + 0x58 + 0x10 + 0x03 + 0x40 + 0x00 + 0x00 = 0xF8

Besides, check sum only takes the last two digit of the sum from packet head to packet content. For example, if the sum = 0x148, then the check sum is 0x48. 

Coding

Firstly, I declared a serial baud rate of 57600 bps as the SN-FPR-SM630 fingerprint sensor is sending communication packet in this baud rate. 

Serial.begin(57600);

The communication packet can be treated as a buffer, and obviously its size is larger than one byte, therefore I used the syntax Serial.write(buf, len) to send the communication packet to the SN-FPR-SM630 fingerprint sensor. buf is the communication packet and len is the length or size of the communication packet. 

byte addFingerPrint0[] = {0x4D, 0x58, 0x10, 0x03, 0x40, 0x00, 0x00, 0xF8};
Serial.write(addFingerPrint0, sizeof(addFingerPrint0));

If you do not mention the size of the packet, len, you will receive an error during compiling as the default setting of the syntax Serial.write(val) only allow Arduino to send one byte data at that moment. 

SN-FPR-SM630 fingerprint sensor will responds when it receives communication packet from MCU. The response communication packet can be various, according to situation. Table below shows the possible response communication packet sent by the sensor. 

SituationResponseCommunication packet
Sensor receive communication packet correctly Receive correct0x4D 0x58 0x30 0x01 0x01 0xD7
The communication packet contain errorParameter error0x4D 0x58 0x30 0x02 0x40 0x35 0x4C

After SN-FPR-SM630 fingerprint sensor responds receive correct, user is required to press his/her fingerprint for the first time. The sensor will responds as operation successful after processing the first fingerprint. After that, user is required to press his/her fingerprint again. The sensor will responds as operation successful if there is no problem during processing. Table below shows the possible response communication after processing fingerprint. 

SituationResponseCommunication packet
Sensor able to process fingerprint without any problem Operation successful0x4D 0x58 0x30 0x02 0x40 0x31 0x48
Fingerprint quality is poorFingerprint processing failure0x4D 0x58 0x30 0x02 0x40 0x34 0x4B
First and second fingerprints are not matchFingerprint processing failure0x4D 0x58 0x30 0x02 0x40 0x34 0x4B
No finger pressing within 10 secondsTime-out0x4D 0x58 0x30 0x02 0x40 0x33 0x4A

Syntax memcmp() is used to compare the communication packet received with communication packet above. Let’s the communication packet be respond and the communication packet to be compared be receiveCorrect, if the respond is matched with receiveCorrect, the result will be 0. 

byte receiveCorrect[] = {0x4D, 0x58, 0x30, 0x01, 0x01, 0xD7}; 
int a; 
for(byte x=0; x<6; x++) 
{
    while(Serial.available() == 0) { }; 
    respond[x] = Serial.read(); 
    a = memcmp(receiveCorrect, respond, sizeof(receiveCorrect); 
    if (a == 0) 
    {Serial.println(“Receive Correct!”);
else { Serial.println(“Error!”);}

}

That’s all for the techniques used in coding. You can apply same technique for other commands, i.e. delete fingerprint, search fingerprint, etc. Besides, you can refer to the user manual for possible response communication packets for each commands. The attached is the full source code for ‘add fingerprint’ command. 

Arduino .ino file: SM630_AddFinger

If you have further doubts, please continue discuss in our technical forum.  

Buy

,

Related Post

Attendance Record System

Attendance Record System

Fingerprint Reader Integrated SM630 with SM630 PC Demo GUI

Interfacing Fingerprint Reader Integrated SM630 with Arduino Uno

One thought on “Getting Started with Fingerprint Sensor Integrated SM630

Leave a Reply

Your email address will not be published. Required fields are marked *