avatar

FutureInventions

Member Since: November 16, 2011

Country: United States

  • Product GPS-00574 | about 3 months ago

    Any way I can find one of these for the 4 wire connectors like the ones used on your fingerprint scanners?

  • Product TOL-11784 | about 3 months ago

    These are so insanely useful. I love mine! :)

  • Product SEN-11792 | about 9 months ago

    Yes, you do have to initialize the serial communication. I’ll write you a quick sketch to help you understand.

    byte highbyte = 0;
    byte lowbyte = 0; 
    
    word checksum = 0;
    
    byte highcheck = 0;
    byte lowcheck = 0;
    
    byte response = 0;
    
    
    
    word parameterin = 0;
    word checksumReply = 0;
    
    boolean communicationError = false;
    boolean checksumCorrect = true; 
    boolean ack = true;
    
    byte lbyte = 0;
    byte hbyte = 0;
    byte checklbyte = 0;
    byte checkhbyte = 0;
    
    const int transmitDelay = 500;
    
    
    void setup(){
      Serial2.begin(9600); 
      /* begins serial communication at 9600 baud rate (default) Also, I'm using the 2nd serial port on my Mega, if you have an
      uno, you might want to use Serial instead. If you have a Leonardo, you can use Serial1 which is separate from the serial
      used to communicate over USB. The uno only uses only one set of TX and RX to communicate, the same one it uses for
      USB. */
    }
    
    void loop(){
    scannerCommand(0x01, 0); //I have written a function for sending command packets. All you have to do is type in the command and the the parameter.
    waitForReply(); //I wrote this function to output the response of the device. checksumCorrect tells you if the checkSum matches the data sent. If it doesn't, there was an error. The variable parameterin is the parameter that the fingerprint scanner has sent the arduino. The variable ack tells whether the the scanner has sent an acknowledgemnt. If it is false, there has been an error, and you must check parameterin to see which error code has been sent. The variable communicationError tells if the arduino has read any bytes that are out of place. This should be false. Have a look at the function at the bottom for more info.
    
    //Now we have initialized the device by sending it the code to "open." You can write your own function to handle any of the responses I have detailed above.
    
    scannerCommand(0x12, 1); //command turns on the LED in the sensor.
    waitForReply(); //Again, you can do whatever you want with the variables here.
    
     //that's the end of this demo. If it worked properly, the light on the device should turn on.
    
    while( 1 == 1){} //This just ends the code without looping it.
    }
    
    //OK, now here are the functions I used.
    
    
    void scannerCommand(byte com, int param){ //This is the function that sends data to the device
      valueToWORD(param);
      calcChecksum(com, highbyte, lowbyte);
      Serial2.write(0x55);
      Serial2.write(0xaa);
      Serial2.write(0x01);
      Serial2.write(0x00);
      Serial2.write(lowbyte);
      Serial2.write(highbyte);
      Serial2.write(0x00);
      Serial2.write(0x00);
      Serial2.write(com);
      Serial2.write(0x00);
      Serial2.write(lowcheck);
      Serial2.write(highcheck);
    }
    
    void waitForReply(){ //This is the function that receives data from the device.
      communicationError = false;
      while(Serial2.available() == 0){}
      delay(transmitDelay);
      if(Serial2.read() == 0x55){
      } else {
        communicationError = true;
      }
    
      if(Serial2.read() == 0xAA){
      } else {
        communicationError = true;
      }
    
      if(Serial2.read() == 0x01){
      } else {
        communicationError = true;
      }
    
      if(Serial2.read() == 0x00){
      } else {
        communicationError = true;
      }
    
      lbyte = Serial2.read();
      hbyte = Serial2.read();
    
      parameterin = word(hbyte, lbyte);
    
      Serial2.read();
      Serial2.read();
    
      response = Serial2.read();
    
      if(response == 0x30){
        ack = true;
      } else {
        ack = false;
      }
      Serial2.read();
    
      checklbyte = Serial2.read();
      checkhbyte = Serial2.read();
    
      checksumReply = word(checkhbyte, checklbyte);
    
      if(checksumReply == 256 + lbyte + hbyte + response){
        checksumCorrect = true;
      } else {
        checksumCorrect = false;
      } 
    }
    
    void calcChecksum(byte c, byte h, byte l){ //Also uses this function I have shown above
      checksum = 256 + c + h + l; //adds up all the bytes sent
      highcheck = highByte(checksum); //then turns this checksum which is a word into 2 bytes
      lowcheck = lowByte(checksum);
    }
    
    void valueToWORD(int v){ //turns the word you put into it (the paramter in the code above) to two bytes
      highbyte = highByte(v); //the high byte is the first byte in the word
      lowbyte = lowByte(v); //the low byte is the last byte in the word (there are only 2 in a word)
    }
    

    I hope that helps! If you’re not familiar with functions, you should check here: http://arduino.cc/en/Reference/FunctionDeclaration

    I have tried it and it works. If you are using a different set of Serial pins, make sure to change Serial2 wherever it appears in the code. (You can use command F on a Mac or control F on a PC to easily replace them all if you didn’t already know) The baud rate also might be 115200 because I have a different model. So try that.

    I tested the code and it has worked for me.

    If you have any other questions, feel free to ask! I could also post my function for enrolling a finger if you want, but that will have to be modified since it is made to work with an LCD display. If you need help connecting the device to the serial pins of your arduino, let me know which one you have and I’ll let you know which pins should work.

    Good luck!

  • Product SEN-11836 | about 9 months ago

    Finally got this working on arduino! I’ll post some stuff when I’ve got a sketch working perfectly, but in the meantime here’s what I did:

    byte highbyte = 0;
    byte lowbyte = 0;
    byte command = 1;
    word checksum = 0;
    byte highcheck = 0;
    byte lowcheck = 0;
    
    //Here comes the part you want to put in void loop that sends the command to the device
    
      command = 0x12; //The command goes here. This is the command for the LED.
      valueToWORD(0); //This value is the parameter being send to the device. 0 will turn the LED off, while 1 will turn it on.
      calcChecksum(command, highbyte, lowbyte); //This function will calculate the checksum which tells the device that it received all the data
      Serial2.write(0x55); //Command start code 1
      Serial2.write(0xaa); //Command start code 2
      Serial2.write(0x01); // This is the first byte for the device ID. It is the word 0x0001
      Serial2.write(0x00); // Second byte of Device ID. Notice the larger byte is first. I'm assuming this is because the datasheet says "Multi-byte item is represented as Little Endian"
      Serial2.write(lowbyte); //writing the largest byte of the Parameter
      Serial2.write(highbyte); //Writing the second largest byte of the Parameter
      Serial2.write(0x00); //The datasheet says the parameter is a DWORD, but it never seems to go over the value of a word
      Serial2.write(0x00); //so I'm just sending it a word of data. These are the 2 remaining bytes of the Dword
      Serial2.write(command); //write the command byte
      Serial2.write(0x00); //again, the commands don't go over a byte, but it is sent as a word, so I'm only sending a byte
      Serial2.write(lowcheck); //Writes the largest byte of the checksum
      Serial2.write(highcheck); //writes the smallest byte of the checksum
    
    //Now for the functions
    
    void valueToWORD(int v){ //turns the word you put into it (the paramter in the code above) to two bytes
      highbyte = highByte(v); //the high byte is the first byte in the word
      lowbyte = lowByte(v); //the low byte is the last byte in the word (there are only 2 in a word)
    }
    
    void calcChecksum(byte c, byte h, byte l){
      checksum = 256 + c + h + l; //adds up all the bytes sent
      highcheck = highByte(checksum); //then turns this checksum which is a word into 2 bytes
      lowcheck = lowByte(checksum);
    }
    

    It’s pretty rough, but I hope this helps someone who was struggling with this as much as I was.

    If you’re not familiar with some of this:

    A byte stores 256 values. A word consists of 2 bytes, and a Dword consists of 4 bytes. The bytes to be sent here were represented in hexadecimal, which is base 16. A word can be split into 2 bytes to be sent. For example: 0x1234 is made up by the bytes 0x12 and 0x34. highByte(0x1234) = 0x12 and lowByte(0x1234) = 0x34.

    Hope this helps!

  • Product SEN-11792 | about 9 months ago

    I posted a quick explanation that should help if you’re still stuck. :)

  • Product SEN-11792 | about 9 months ago

    Finally got this working on arduino! I’ll post some stuff when I’ve got a sketch working perfectly, but in the meantime here’s what I did:

    byte highbyte = 0;
    byte lowbyte = 0;
    byte command = 1;
    word checksum = 0;
    byte highcheck = 0;
    byte lowcheck = 0;
    
    //Here comes the part you want to put in void loop that sends the command to the device
    
      command = 0x12; //The command goes here. This is the command for the LED.
      valueToWORD(0); //This value is the parameter being send to the device. 0 will turn the LED off, while 1 will turn it on.
      calcChecksum(command, highbyte, lowbyte); //This function will calculate the checksum which tells the device that it received all the data
      Serial2.write(0x55); //Command start code 1
      Serial2.write(0xaa); //Command start code 2
      Serial2.write(0x01); // This is the first byte for the device ID. It is the word 0x0001
      Serial2.write(0x00); // Second byte of Device ID. Notice the larger byte is first. I'm assuming this is because the datasheet says "Multi-byte item is represented as Little Endian"
      Serial2.write(lowbyte); //writing the largest byte of the Parameter
      Serial2.write(highbyte); //Writing the second largest byte of the Parameter
      Serial2.write(0x00); //The datasheet says the parameter is a DWORD, but it never seems to go over the value of a word
      Serial2.write(0x00); //so I'm just sending it a word of data. These are the 2 remaining bytes of the Dword
      Serial2.write(command); //write the command byte
      Serial2.write(0x00); //again, the commands don't go over a byte, but it is sent as a word, so I'm only sending a byte
      Serial2.write(lowcheck); //Writes the largest byte of the checksum
      Serial2.write(highcheck); //writes the smallest byte of the checksum
    
    //Now for the functions
    
    void valueToWORD(int v){ //turns the word you put into it (the paramter in the code above) to two bytes
      highbyte = highByte(v); //the high byte is the first byte in the word
      lowbyte = lowByte(v); //the low byte is the last byte in the word (there are only 2 in a word)
    }
    
    void calcChecksum(byte c, byte h, byte l){
      checksum = 256 + c + h + l; //adds up all the bytes sent
      highcheck = highByte(checksum); //then turns this checksum which is a word into 2 bytes
      lowcheck = lowByte(checksum);
    }
    

    It’s pretty rough, but I hope this helps someone who was struggling with this as much as I was.

    If you’re not familiar with some of this:

    A byte stores 256 values. A word consists of 2 bytes, and a Dword consists of 4 bytes. The bytes to be sent here were represented in hexadecimal, which is base 16. A word can be split into 2 bytes to be sent. For example: 0x1234 is made up by the bytes 0x12 and 0x34. highByte(0x1234) = 0x12 and lowByte(0x1234) = 0x34.

    Hope this helps!

  • Product SEN-11836 | about 10 months ago

    I’m having a lot of trouble getting this to communicate with the software. I first tried using it with the 5V FTDI cable (and a 5k resistor) with no results. (And reading the comments, rsp has noted that it will not work over serial with any of the software) Also, it seems that Sparkfun has the wrong pinout. On this page it says Vcc, GND, Tx, Rx whereas the data sheet says Vcc, GND, Rx, Tx. Hopefully It didn’t damage the device. Anyways, I tried it with different baud rates as well, because the video says 115200 and the site and datasheet say 9600. So I’m guessing the video was for the C3 model? I’m a little disappointed with the documentation here. I also tried a USB connection with the pins that rsp has given me: Pin 1 (square pad) = +5V (usually the red wire in a USB cable) Pin 2 = D- (white or yellow) Pin 3 = D+ (green) Pin 4 = Ground (black) Pin 5 = Shield (optional)

    But that doesn’t seem to work. Perhaps I need the right driver for it? When I plug it in, the light for the sensor blinks quickly and then the green status light flickers very dimly. The software doesn’t recognize it, and my computer doesn’t seem to recognize it either. :/

    I’m hoping to get it working with the software first so I can better understand how to properly operate it, but if not, I’ll just have to connect it to my arduino and play around with it from there.

  • Product SEN-11836 | about 10 months ago

    Thank you very much!

  • Product SEN-11836 | about 10 months ago

    Thanks so much! Also, do you know if the pads on the back are the same pinout as the connector on the front of the device? (Plus a square pad, I’m assuming that’s ground?)

  • Product SEN-11836 | about 10 months ago

    I want to hook this up with an Arduino. Is this what I need? https://www.sparkfun.com/products/8745

No public wish lists :(