Go Down

Topic: Write template on Fingerprint sensor R305/R307 (Read 4028 times) previous topic - next topic

nimit393

Hi Guys,

Used the "show_fingerprint_template" function on adafruit library to get the fingerprint templates of fingerprint stored in the module...489byte each. However, i am unable to write these templates on other sensor. Motive is to avoid duplicate enrollmet of fingerprint on multiple sensor. Once I enroll on one device..I want to extract the template and write the same onto other sensors...let me know who this can be done.

J-M-L

Hello - Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums.
Bonjour Pas de messages privés SVP, postez dans le forum directement pour que ça profite à tous

nimit393

Thanks for the documentation.
However for testing purpose...how can i use the serial monitor on arduino to directly type the commands and check weather the sensor responds in the way its intended?

J-M-L

#3
Oct 01, 2018, 08:49 am Last Edit: Oct 01, 2018, 08:52 am by J-M-L
how can i use the serial monitor on arduino to directly type the commands and check weather the sensor responds in the way its intended?
Well, by writing such a program... ;)

(There are many test examples in the library)
Hello - Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums.
Bonjour Pas de messages privés SVP, postez dans le forum directement pour que ça profite à tous

nimit393

Well...none of them are helpful in writing template back to device. Neither do i see that library has functions defined to get the part of the code working for writing a template.

J-M-L

#5
Oct 07, 2018, 07:29 pm Last Edit: Oct 07, 2018, 07:30 pm by J-M-L
Well...none of them are helpful in writing template back to device. Neither do i see that library has functions defined to get the part of the code working for writing a template.
sure, library might be incomplete but what is not helpful in section 6? you can extend the library...

Quote
6.2.3 Download the image: DownImage
Description: to download image from upper computer to Img_Buffer. Refer to 1.1.1 for more about the image buffer.
Hello - Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums.
Bonjour Pas de messages privés SVP, postez dans le forum directement pour que ça profite à tous

nimit393

I am not aware how the library is sending out commands in hex...if you can let me know who I can directly type  in commands in hex over serial, then that would be helpful in creating and extending the existing library for writing template.
In short if I can directly type serially, then i can observe how the sensor is reacting and verify weather the commands sent by my is correct or not.

J-M-L

I am not aware how the library is sending out commands in hex...if you can let me know who I can directly type  in commands in hex over serial, then that would be helpful in creating and extending the existing library for writing template.
It's in the code of the library.
Code: [Select]
#if ARDUINO >= 100
  #define SERIAL_WRITE(...) mySerial->write(__VA_ARGS__)
#else
  #define SERIAL_WRITE(...) mySerial->write(__VA_ARGS__, BYTE)
#endif

#define SERIAL_WRITE_U16(v) SERIAL_WRITE((uint8_t)(v>>8)); SERIAL_WRITE((uint8_t)(v & 0xFF));

#define GET_CMD_PACKET(...) \
  uint8_t data[] = {__VA_ARGS__}; \
  Adafruit_Fingerprint_Packet packet(FINGERPRINT_COMMANDPACKET, sizeof(data), data); \
  writeStructuredPacket(packet); \
  if (getStructuredPacket(&packet) != FINGERPRINT_OK) return FINGERPRINT_PACKETRECIEVEERR; \
  if (packet.type != FINGERPRINT_ACKPACKET) return FINGERPRINT_PACKETRECIEVEERR;

#define SEND_CMD_PACKET(...) GET_CMD_PACKET(__VA_ARGS__); return packet.data[0];

And see how SEND_CMD_PACKET is used for various cases.

To send stuff from your computer you need either a terminal app that lets you send binary or write your own small app (using Processing for example)
Hello - Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums.
Bonjour Pas de messages privés SVP, postez dans le forum directement pour que ça profite à tous

nimit393

I do not completely understand the commands...a bit difficult to understand.

Menawhile, using Coolterm to test weather my commands are correct or not. Sending EF01FFFFFFFF0100041700001C as hex...the sensor is not responding. What might be the issue?

J-M-L

So you are sending a handshake

- are you sure baud rates are set correctly?
- can you check if your module address is really 0xFFFFFFFF ? (this is the default but can be changed)

Hello - Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums.
Bonjour Pas de messages privés SVP, postez dans le forum directement pour que ça profite à tous

nimit393

Yes..I am sending standard handshake message with blank sketch loaded on arduino uno. Using Coolterm to send Hex data over serial bus.

nimit393

Baud rate used is 9600 and password  is standard 0xFFFFFFFF.

J-M-L

#12
Oct 14, 2018, 09:08 am Last Edit: Oct 14, 2018, 12:00 pm by J-M-L
Baud rate used is 9600 and password  is standard 0xFFFFFFFF.
- default baud rate is 57600 (N=6)
- 0xFFFFFFFF is not a password but the Chip address

How did you wire things? Blank sketch does not do anything

Here is how to proceed if you have a module that looks like mine (otherwise adjust wires):

Wire this way:


Connect Vcc to your Arduino 5V, GND to GND, Sensor Tx to Arduino Rx for Serial3,, Sensor Rx to Arduino Tx for Serial3 - the two other wires don't need to be connected

Upload this code to an Arduino Mega (to have 2 hardware Serial):
Code: [Select]
#define fingerSerial Serial3

void setup() {
  Serial.begin(115200);
  fingerSerial.begin(57600);
  delay(1000);  // one second delay to let the sensor 'boot up'
}

void printHex2Digit(byte b)
{
  if (b <= 0xF) Serial.print("0");
  Serial.print(b, HEX);
}

void loop() {
  static unsigned long tSerial = 0;
  static unsigned long tFinger = 0;

  while (Serial.available()) {
    int r = Serial.read();
    if (millis() - tSerial >= 100) Serial.print(F("\nSending to Sensor: "));
    tSerial = millis();
    printHex2Digit((byte) r);
    if (r != -1) fingerSerial.write((byte) r);
  }

  while (fingerSerial.available()) {
    if (millis() - tFinger >= 100) Serial.print(F("\nReceived from Sensor: "));
    tFinger = millis();
    int r = fingerSerial.read();
    if (r != -1) printHex2Digit((byte) r);
  }
}


Open CoolTerm and connect at 115200 bauds to your Arduino
Open the SendString panel from the Connection menu
paste in that window the EF01FFFFFFFF0100041700001C handshake message
send that HEX message



if all is wired appropriately you will see in the serial terminal
Sending to Sensor: EF01FFFFFFFF0100041700001C
Received from Sensor:EF01FFFFFFFF07000300000A


if you decode the received message: EF01FFFFFFFF07000300000A

EF01 --> Start Header
FFFFFFFF --> Adder
07 --> Acknowledge packet
0003 --> length including command packets, data packets and 2 bytes Checksum
00 --> DATA = Port operation complete
000A --> Checksum 7 + 3 + 10 = 0x0A, all correct

this is indeed the expected confirmation message as per the documentation (chapter 6.1.1)
Hello - Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums.
Bonjour Pas de messages privés SVP, postez dans le forum directement pour que ça profite à tous

nimit393

Hey,

The code posted by you works. Thanks a million for the help.

I was assuming that the default baud must be 9600 which was incorrect.

Also I used blank sketch to pass through the serial commands which did not work...what might be the issue?...because I did not authenticate with password first?

Earlier the connections for Rx and Tx of fingerprint sensor were directly connected to Rx Tx of the board...effectively connecting it to UART of my laptop.


J-M-L

#14
Oct 14, 2018, 12:50 pm Last Edit: Oct 14, 2018, 12:51 pm by J-M-L
Great

 the bank sketch would work by  kinda bypassing Serial and connecting directly to pins 0 and 1... of course need to cross cables TX to RX and RX to TX and the challenge is the default 57600 bauds... a small program such as the one I wrote reads from one side and sends it to the other
Hello - Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums.
Bonjour Pas de messages privés SVP, postez dans le forum directement pour que ça profite à tous

Go Up