How do I send this Serial Command (as 1 packet)?

I know this seems like the last question I had, but it's actually a different device and a different topic!

I am trying to send Serial commands to the Nitgen Fingerprint Scanner module over Serial. I got it from Sparkfun (Fingerprint Scanner - SEN-08839 - SparkFun Electronics).

Thankfully there is documentation on the Comm Protocol (http://www.sparkfun.com/datasheets/Sensors/Biometric/EN-FIM-ComProtocol-v1.75.pdf) and this is all I am trying to send to the Fingerprint Scanner:

This is my code (the portion that is hopefully sending the command):

    SerialFPS.print(0x7E, BYTE);
    
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x01, BYTE);
    
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x01, BYTE);

Is this code performing what is required (what you see in that image?)?

Grr! So frustrated....must be nearing a breakthrough!

Thanks again for the help.
Scott

This is the rest of my code if it's relevant:

#include <SoftwareSerial.h>

int rxPin = 2;
int txPin = 3;
int ledPin = 13;

SoftwareSerial SerialFPS = SoftwareSerial(rxPin, txPin);
long millisStart = 0;
byte aryBytes[300] = "";
int byteReceivedGPS = -1;

void setup() {
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  pinMode(ledPin, OUTPUT);

  Serial.begin(9600);
  SerialFPS.begin(9600);

  for (int i=0;i<300;i++){       // Initialize a buffer for received data
    aryBytes[i]=' ';
  }

}

void loop()
{
  {
    digitalWrite(ledPin, HIGH);

    SerialFPS.print(0x7E, BYTE);
    
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x01, BYTE);
    
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x00, BYTE);
    SerialFPS.print(0x01, BYTE);

    millisStart = millis();
    int intReceivedBytes = 0;

    while(intReceivedBytes < 1){
      // Keep checking to see if Serial is available
      intReceivedBytes = Serial.available();
            
      // Timeout after 3 seconds
      if(millis() > (millisStart + 3000)){
        break;
      }
    }
    
    Serial.print("Waited ");
    Serial.print(millis() - millisStart);
    Serial.println("ms");

    digitalWrite(ledPin, LOW);

    // Get incoming serial data
    if(intReceivedBytes > 0){

      int intStoredBytes = 0;

      // Store the incoming packets
      for (int i=0; i < intReceivedBytes; i++){
        //Serial.print(i);
        //Serial.print("=");
        //Serial.println(Serial.read());
        aryBytes[i]=Serial.read();
        intStoredBytes++;
      } 

      Serial.print("Bytes: ");
      Serial.println(intStoredBytes);

      // Repeat serial data received
      for (int i=0; i<intStoredBytes; i++){
        Serial.print(aryBytes[i], HEX);
        Serial.print(",");
      }

      Serial.println();
    }

    delay(1000);

  }
}

I think you should send

SerialFPS.print(0x7E, BYTE);
SerialFPS.print(0x01, BYTE);
SerialFPS.print(0x00, BYTE);
SerialFPS.print(0x00, BYTE);
SerialFPS.print(0x00, BYTE);
SerialFPS.print(0x00, BYTE);
SerialFPS.print(0x01, BYTE);

It looks like your transmitted packet is right, but it also looks like you are trying to read the response on Serial (rather than SerialFPS). Is that correct?

Mikal

I don't think the sent package is corret. Acording to the small table at the bottom of the picture you should send 7 bytes, you are sending 25.

The first byte is 7E (HEX)
The remaining 6 are all given in binary.

@Mikal: Well observed - yes, Serial is correct.

@MikMo: You might be right about sending 7 packets and not 25. But as for the binary part, I'm not certain.

This is what it says in the documentation: "For checking serial connection, use “Request Connection” command (the command I am trying to send). For explanation on real packet data, assume that the device has 10 users in DB. The following figure shows the sequence of packets, and the contents of packets."

The response that the FPS should give is this...7 packets, whose contents are as follows:
7E - 00 00 00 01 - 00 00 00 01 - 00 00 00 0A - 00 00 00 00 - 00 00 00 00 - 00 00 00 0C

It's hard for me to explain, since I don't have a full understanding of it yet. Perhaps you can have a quick perusal over the Comm Documentation yourself? http://www.sparkfun.com/datasheets/Sensors/Biometric/EN-FIM-ComProtocol-v1.75.pdf

Thank you both for your time. I really appreciate it. :slight_smile:
Scott

Hi Scott,

I see why its not clear to you, that documentation is very poor. The section explaining packet structure looks like nonsense.

It does seem 00 00 00 01 is not one but four bytes, so you may be correct about 25 bytes in total.

Good luck

I think I have discovered a monumental flaw in what I have been doing here. I am trying to get the Arduino to talk to the Fingerprint Scanner, where the Arduino has a 5V logic level. I've just realised that this Fingerprint Scanner is running at 3.3V.

Am I correct in assuming that this will mean no-talky-talky, no matter how hard I try? If that's the case, what can I do to switch the voltage level from 5V to 3.3 and back again. Can I use transistors or do I need to get fancier than that?

This is probably what I need, hey? http://www.sparkfun.com/commerce/product_info.php?products_id=8745

scotabug: did you manage to communicate with the Nitgen? I've recently began working on it and i haven't been able to send the Request Connection command, I also used the method you posted and it didn't work. I'm using a MAX232 to the the signal levels from TTL to rs232.

Could please tell me how did you send the commands? And at what baud rate does the nitgen work by default?

Thanks!

Hi all.
I am very new to arduino and electronics in general. My question is how do i connect the nitgen fingerprint sensor from sparkfun to the arduino board? And can i add fingerprints to the database without using a pc? Please help :cry: :cry:

Hi again.
Here is a bit more info. Apart from the nitgen fingerprint sensor from sparkfun i also bought an mlx to mlx connector Jumper Wire - MLX to MLX - SEN-08976 - SparkFun Electronics

How do i connect to a pc with this connector and an rs232 cable, what are the pin connections? Then how do i connect to the arduino. Please help, i have searched but have found no help, but it seems you guys have managed to. :-[
Thanks