5

I am trying to connect a R305 v1.6 fingerprint scanner with my Raspberry Pi2 Model B.

Sensor: http://www.sunrom.com/p/finger-print-sensor-r305

I am using pyfingerprint module which supports ZFM-20 fingerprint scanner.

Library: https://github.com/bastianraschke/pyfingerprint

Now after successful installion when I run the example, it says

The fingerprint sensor could not be initialized!

Exception message: The fingerprint sensor port "/dev/ttyUSB0" was not found!

I tried seeing the tty ports using the command dmesg | grep tty, and this the output I get when the sensor is connected:

[    0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2709.boardrev=0xa21041 bcm2709.serial=0x2377eadd smsc95xx.macaddr=B8:27:EB:77:EA:DD bcm2708_fb.fbswap=1 bcm2709.uart_clock=3000000 bcm2709.disk_led_gpio=47 bcm2709.disk_led_active_low=0 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
[    0.001458] console [tty1] enabled
[    0.097506] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 83, base_baud = 0) is a PL011 rev2
[    2.061340] systemd[1]: Starting system-getty.slice.
[    2.065794] systemd[1]: Created slice system-getty.slice.

I am unable to decipher where the error is. Is it that the library is not supported with this fingerprint module, or is there some other error.

PS - I also have disabled login shell over serial, as I saw in this tutorial: http://www.instructables.com/id/Read-and-write-from-serial-port-with-Raspberry-Pi/

Update 1: I am connecting the fingerprint scanner using the gpio pins, Ground, 5V, TDX and RX, since it communicates via TTL serial. As I connect the Ground and 5V pins to the scanner, the scanner lights blink. That's the only activity seen on the scanner. I have also tried another scanner, and this too gives the same problem while integration.

  • How are you connecting the fingerprint sensor to the Pi? – joan May 5 '16 at 21:44
  • @joan I am connecting it using the gpio pins, Ground, 5V, TXD and RXD. When I connect the ground and the 5V, the fingerprint sensor's light blinks for about half a sec. I have updated the question description as well. – Sahil Arora May 5 '16 at 21:50
  • The program you are using to read the sensor is assuming it is a USB serial dongle on /dev/ttyUSB0. You need to tell the program the sensor is connected to /dev/ttyAMA0 (the UART attached to the GPIO). – joan May 5 '16 at 22:29
  • 1
    Also be aware that the Pi's GPIO are 3V3 only. It is not safe to expose them to 5V. You need to check that the sensor is not feeding 5V into the Pi RX GPIO. – joan May 5 '16 at 22:34
  • @joan Thanks a lot man. It worked! But it's unable to recognize the finger, any idea where to change? – Sahil Arora May 5 '16 at 22:47
2

Thanks to Joan for solving the problem.

First and foremost, you need a library to run your fingerprint sensor.I found one here: https://github.com/bastianraschke/pyfingerprint

Follow the instructions to install the library in your pi. Then connect your fingerprint scanner to the raspberry using the GPIO ports. You can find what ports corresponds to what in the fingerprint sensor manual. In my case, I was using a Sunrom R305 fingerprint scanner.

The manual for this can be found here: http://www.sunrom.com/p/finger-print-sensor-r305

Next is to disable login shell over serial. Find all the steps here for the same here: http://www.instructables.com/id/Read-and-write-from-serial-port-with-Raspberry-Pi/

You are almost done. The above link will solve almost all the problems. Next up is check the serial port available with your pi. Put this command on the terminal of your pi: dmesg | grep tty.

You'd get a message like this:

[    0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2709.boardrev=0xa21041 bcm2709.serial=0x2377eadd smsc95xx.macaddr=B8:27:EB:77:EA:DD bcm2708_fb.fbswap=1 bcm2709.uart_clock=3000000 bcm2709.disk_led_gpio=47 bcm2709.disk_led_active_low=0 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
[    0.001458] console [tty1] enabled
[    0.097506] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 83, base_baud = 0) is a PL011 rev2
[    2.061340] systemd[1]: Starting system-getty.slice.
[    2.065794] systemd[1]: Created slice system-getty.slice.

Here it shows that my port is ttyAMA0. Yours may be something else. Go to this folder in your library: /usr/share/doc/python-fingerprint/examples/.

It contains all the files for running the fingerprint scanner. Open one file, for instance example_search.py. There is a try block in every file, something like this:

try:
    f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)

    if ( f.verifyPassword() == False ):
        raise ValueError('The given fingerprint sensor password is 
wrong!')

This code is basically trying to connect to your fingerprint scanner. It assumes that the port you are using is /dev/ttyUSB0. In my case, the port was /dev/ttyAMA0. So you just need to replace /dev/ttyUSB0 in all the python codes to /dev/tty****, where **** is your port(AMA0 in my case). Then save the file and run it, and it should work.

  • Awesome man, Can you also add connection you made with GPIO. [Pic would be nice] – Gaurav Dave May 18 '16 at 12:46
  • @GauravDave You can refer to the Sunrom manual in the link provided. It has a picture with the ports, which wire corresponds to which port. Then connect the same with raspberry pi GPIO ports. You can find which pins is for which on google images. It would do. Hope that helps. – Sahil Arora May 18 '16 at 21:28
  • I too have a R305, but it has total of 6 pins and in the link there are only 4. So, I'm bit confused. – Gaurav Dave May 19 '16 at 4:51
  • @GauravDave The R305 I have looks the same as that in the manual. Mine is v1.6. Check the manual if yours looks the same as well(or is v 1.6). Maybe it's a newer version of the R305. Anyways, you will still be able to find it's manual, because companies don't manufacture such components without a manual. – Sahil Arora May 19 '16 at 7:46
  • Mine is ZFM60_BAK_V1.4 – Gaurav Dave May 19 '16 at 9:06
0

I used it with a Serial to USB converter (CP2102) The python script will detect the /dev/ttyUSBx port as valid.

  • Yes it will then recognize it as a USB device. Since I did not have a Serial to USB, I had to change the port to AMA. – Sahil Arora Feb 16 '17 at 5:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.