cancel
Showing results for 
Search instead for 
Did you mean: 

Code Examples

MotooTanaka
Esteemed Contributor

The heat of the Year End and the New Year hustle has calmed down.

But I've been struggling with my private project, which is a Fingerprint Scanner, namely GT-521F32.

Anyway, finally I could come up with the initial working version.

Although we've already been familiar with a Fingerprint Scanner with iPhones and Smartphones,

I wanted to play with one. And I found a reasonable priced one.

Fingerprint Scanner - TTL (GT-521F32) - SEN-14518 - SparkFun Electronics

So I gave a try, since it is connected via UART, it seems to be easy to handle.

Well, communicating with module was easy, but control the device was another story (at least to me).

IMG_3318.JPG

The schematic looks like

schematic.JPG

According to the programming guide term, to register a finger print is "enroll".

Since finding 200 person sounds difficult, I used a few of my fingers to try.

I enrolled my left thumb as 0, left index as 1, right thumb as 2, right index as 3...

001-enroll.JPG

To enroll a finger, the device requires us to release and touch the finger 3 times.

Then we can identify a finger (print) if it's enrolled or verify if enrolled finger can be verified correctly.

002-verify.JPG

moto

20 Replies
Vasanth
Moderator
Moderator

Hello Moto san,

Thanks for contributing to the community .

Best Regards,
VRS

0 Likes
MotooTanaka
Esteemed Contributor

本サンプルは CQ出版 インターフェース 2019年4月号に

2019年4月号目次 | Interface – CQ出版

ふえる今どきセンサNote

その15 200個登録&認識できる指紋センサ

として掲載されました。

I contributed this sample project to a Japanese technical magazine

"Interface" Apr/2019 edition.

moto

0 Likes
abalc_2740841
New Contributor

Thanks for sharing the project. I tried to apply the project with psoc 4 pioneer kit ( CY8CKIT-042) and I got two errors :

ERROR: region RAM overflowed with stack

collect2.exe: error: ld returned 1 exit status

The command 'arm-none-eabi-gcc.exe' failed with exit code '1'.

Could you tell me what is wrong. Thanks

0 Likes
MotooTanaka
Esteemed Contributor

Hi,

In general 042 has very limited memory size

FYI

CY8CKIT-042 SRAM  4KB Flash  32KB

CY8CKIT-044 SRAM 16KB Flash 128KB

CY8CKIT-046 SRAM 32KB Flash 256KB

Anyway, I found a few problems to compile my project with CY8CKIT-042

(1) UART module does not support byte mode, I just set it off

(2) SRAM overflow, CY8CKIT-042 has only 4KB instead of 16KB of CY8CKIT-044

So, I tried to reduce the size of buffer for string and command.

And I could compile the project.

But I have not tested the code, because I left the sensor at my home,

so if you don't mind would you test it with your system?

I assigned

UART (for PC) rx: P4[0] tx: P4[1]

Note: Please jumper these to the on board PSoC 5LP P12[7], P12[6]

FPS rx: P3[0] tx[ P3[1], ICPCK P2[7]

moto

0 Likes
sualc_2707881
New Contributor

Hi, thanks for having the time to make some changes to the code!

I actually tried it but still getting some errors as shown in the attached screenshot. It seems that it is not enrolling my finger ID.

All I want is to enroll my fingerprint ID. Then, the FPR will wait for my fingerprint to be scanned. Whenever it accepts it, a servo motor should spin so the door can be unlocked. The following is the code I wrote for spinning the servo motor:

#include "project.h"

int main(void)

{

    PWM_Servo_Start();

  

    int i = 12000;

    while (i == 12000)

    {

        PWM_Servo_WriteCompare(i);

        i++;

        CyDelay(504);

        if (i > 12000)

        {

            PWM_Servo_WriteCompare(0);

        }

    }

}

Also, the project of controlling the servo motor is attached here.FPR Errors Screenshot.PNG

0 Likes
MotooTanaka
Esteemed Contributor

Dear Salom-san,

I must apologize you about this,

when I tried to build and  run this project on CY8CKIT-042,

I noticed that the program is running out the memory.

although it could be built, almost no working space was left

in the SRAM.

So I'm afraid that this program can not be run on CY8CKIT-042.

Please consider using CY8CKIT-044 or CY8CKIT-046 kind of boards.

Best Regards,

27-Apr-2019

Motoo Tanaka

0 Likes
MotooTanaka
Esteemed Contributor

Dear Salom-san,

I have just posted a sample program of using SG-90.

TSoC CY8C4146LQI-S433 基板 サーボ SG-90 サンプル

Although description is in Japanese, I hope that the project and pictures can be a hint for you.

Best Regards,

27-Apr-2019

Motoo Tanaka

0 Likes
sualc_2707881
New Contributor

Thank you very much for this modification. I managed to get it working on my friend's 44 kit.

I also tried using the arduino with the same fingerprint scanner and could get it working.

I wonder what would be the reason that it works well on the arduino but not on my CY8CKIT-042 kit even though the arduino has 2k bytes of SRAM while the CY8CKIT-042 kit has 4k bytes of SRAM! Is it something that has to do with the code efficiency which would cause a high usage in the SRAM? or what would be the reason?

I am new to the PSoC and Arduino world.

Thank you again for your input. I really appreciate it.

Salom,

0 Likes
MotooTanaka
Esteemed Contributor

Dear Salom-san,

Reading your message, I checked the Arduino sample.

In their sample, they have not implemented all template and Image related functions,

which I tried to implement in my version, not fully tested though.

The template itself require 498 byte, which is already 1/4 of Arduino memory,

so probably it was impossible for Aruduino.

Meantime, if all you need to do is same thing with what Arduino version does,

we may be able to remove all these functions, which should reduce required memory a lot.

Attached is my project modified for CY8CKIT-042 and removed all template related functions

along with "template" data.

It could be built, but as we are in the middle of 10 days national holidays in Japan

and unfortunately I don't have the sensor with me right now,

I could not test it, so please let me know if it works for you or not.

Best Regards,

2-May-2019 2:41AM (JST)

Motoo Tanaka

0 Likes
sualc_2707881
New Contributor

Happy holiday!

Your latest edit works! I connected the fingerprint scanner and servo motor and got them to work.

The issue I am running into is that I am restricted with sending commands and communicating with the fingerprint through the terminal. I tried to edit the functions in main.c so I can have the fingerprint to be working all the time and waiting for my fingerprint ID without the need to use the terminal. But I end up getting some code errors!

Please check the attached project that has the servo motor code with it.

Thank you again!

0 Likes
MotooTanaka
Esteemed Contributor

Dear Salom-san,

It seems that you are almost there!

I touched up your code a little as

(1) I added following functions

  int doServo(void) ;

  void run_servo(int x) ;

  void stop_servo(void) ;

(2) doServo is now added in the command list

  so if you enter "servo" to the prompt, the program will enter in servo mode.

  As I made this mode an infinite loop, you need push reset button to exit from this loop.

You may be register a special finger and let the loop exit if that finger is identified.

(3) As usual, I could not test the program, I only could make sure that the program is compile-able.

Hoping that this can be a little hint for you 😉

moto

chascha
New Contributor

Hi!

Is there any way i could port over this component to my PSoC5 CY8C5888LTI-LP09768 specifically

If theres any way that would be possible i would appreciate it!

0 Likes
chascha
New Contributor

I do have the 52 version of the FPS

0 Likes
MotooTanaka
Esteemed Contributor

Hi,

I tried with CY8CKIT-059 (and a CY8CKIT-044 as a 3.3V and 5.0V power supply).

 

Schematic

Note: FPS_TX (P3[1]) of CY8CKIT-059 should not be connect directly to the RX of RU94V.

I used 3 x 1kOhm resisters to divide the 5V signal to (around) 3V signal.

Since RU94V's TX and ICPCK are output, I just decided to go with it,

but it would be nicer if you can apply level shifter (5V<->3.3V) between all these signals.

002-schematic.JPG

Pins

003-Pins.JPG

Tera Term log

001-TeraTerm-log.JPG

moto

Len_CONSULTRON
Honored Contributor II

moto-san,

I'm very interested in your finger-print project. 

Question:  I thought the SIO port (Port 12) on the PSoC5 has a level shifter without need for external resistors.  The PSoC5LP is one of the few offerings from Cypress with this feature.   Bravo to the IC designers!

I added a VDAC8 set to 3.3V as a vref for the SIO pins.

I changed the FPS_RX, FPS_TX and ICPCK pins to pins on port 12 to make use of the Input and Output level shifting.

I've attached a modified version of your project with these changes if you're interested.

Len_CONSULTRON_1-1619439981788.png

Once I can buy a GT-521F32 I plan to try your project.   I'm a little tight on funds.  The possibilities!!!  

Do you think the comm interface to the FPS makes sense as a component?

Len
"Engineering is an Art. The Art of Compromise."
MotooTanaka
Esteemed Contributor

Dear Len-san,

I tried your trick.

Although I have a little concern about P12[0] as it has a pull-up

I went ahead and tried.

Yes, it worked OK.

Still CY8CKIT-044 (or other external power supply of  3.3V (and 5V)) was required,

at least we could save 3 resistors 😉

moto

0 Likes
Len_CONSULTRON
Honored Contributor II

moto-san,

Thanks for the feedback.

Yes.  On the CY8CKIT-059, P12[0] has a switched pull up on the KitProg board.  It is switched through a FET using port P2[6] on the KitProg.   I've never checked if P2[6] was active only when the KitPRog I2C mode was enabled.

I made a slight change to the project I sent you.  I moved FPS_RX from P12[0] to P12[3].  There were no complaints from the Application build phase.  This should eliminate the pullup on the KitProg.

If you still would like to use P12[0] here's some thoughts:

Either way, a 2.2K ohm pullup on would limit any possible reverse current into the FPS_RX output of the FPS to <0.7mA.   Usually not enough to cause latchup conditions especially since this is configured as an output on the FPS.

If you wanted to avoid the pullup, you could place both the PSoC inputs (FPS_RX and ICPCK) on GPIO pins but configured as LVTTL level inputs.  With LVTTL, the Vih threshold is 2.0 (min) and the Vil is 0.8V (max).  The PSoC output would still have to stay on the SIO with the Vref at 3.3V.

I can't wait until I can get this FPS for myself.  I've always wanted to upgrade my home security system.  

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
chascha
New Contributor

Hi!

Thanks alot for doing this!

I have one more question though!

Could you post a picture of the circuit setup?

 

Thanks!

0 Likes
MotooTanaka
Esteemed Contributor

Hi

Picture

IMG_4723.JPG

Circuit Diagram (or something like that)

004-schematic.JPG

Note: As CY8CKIT-059 does not have 3.3V out, 

I used CY8CKIT-044 as a power supply.

moto

P.S. I'm going to try Len-san's trick later... 😉

0 Likes
Len_CONSULTRON
Honored Contributor II

moto-san,

This could be very useful in a biometric-based security system!

 

Len
"Engineering is an Art. The Art of Compromise."