FINGERPRINT SENSOR with ARDUINO MEGA

FPS-GT511C3 was working nicely with my arduino uno.
but now i need to connect it with ARDUINO mega.
i tried with same procedure , but it is not working
what change i should do in code and connection?

/* 
	FPS_Enroll.ino - Library example for controlling the GT-511C3 Finger Print Scanner (FPS)
	Created by Josh Hawley, July 23rd 2013
	Licensed for non-commercial use, must include this license message
	basically, Feel free to hack away at it, but just give me credit for my work =)
	TLDR; Wil Wheaton's Law
*/


#include "FPS_GT511C3.h"
#include "SoftwareSerial.h"

// Hardware setup - FPS connected to:
//	  digital pin 4(arduino rx, fps tx)
//	  digital pin 5(arduino tx - 560ohm resistor fps tx - 1000ohm resistor - ground)
//		this brings the 5v tx line down to about 3.2v so we dont fry our fps

FPS_GT511C3 fps(4, 5);

void setup()
{
	Serial.begin(9600);
	delay(100);
	fps.Open();
	fps.SetLED(true);

	Enroll();
}


void Enroll()
{
	// Enroll test

	// find open enroll id
	int enrollid = 0;
	bool usedid = true;
	while (usedid == true)
	{
		usedid = fps.CheckEnrolled(enrollid);
		if (usedid==true) enrollid++;
	}
	fps.EnrollStart(enrollid);

	// enroll
	Serial.print("Press finger to Enroll #");
	Serial.println(enrollid);
	while(fps.IsPressFinger() == false) delay(100);
	bool bret = fps.CaptureFinger(true);
	int iret = 0;
	if (bret != false)
	{
		Serial.println("Remove finger");
		fps.Enroll1(); 
		while(fps.IsPressFinger() == true) delay(100);
		Serial.println("Press same finger again");
		while(fps.IsPressFinger() == false) delay(100);
		bret = fps.CaptureFinger(true);
		if (bret != false)
		{
			Serial.println("Remove finger");
			fps.Enroll2();
			while(fps.IsPressFinger() == true) delay(100);
			Serial.println("Press same finger yet again");
			while(fps.IsPressFinger() == false) delay(100);
			bret = fps.CaptureFinger(true);
			if (bret != false)
			{
				Serial.println("Remove finger");
				iret = fps.Enroll3();
				if (iret == 0)
				{
					Serial.println("Enrolling Successfull");
				}
				else
				{
					Serial.print("Enrolling Failed with error code:");
					Serial.println(iret);
				}
			}
			else Serial.println("Failed to capture third finger");
		}
		else Serial.println("Failed to capture second finger");
	}
	else Serial.println("Failed to capture first finger");
}


void loop()
{
	delay(100000);
}

You forgot the link to the hardware.

Your library uses the SoftwareSerial library to connect to the sensors UART. On the Mega you cannot use pins 4 and 5 for the SoftwareSerial because they don't support the PinChange interrupt. As the RX pin you should use one of the following: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68) or A15 (69).

On the Mega it would be much more reliable to use one of the hardware serial interface instead of the clunky software emulation. The necessary changes in the library are small and easy to take.
Remove the line

_serial.listen();

Remove the initialization of _serial in the Constructor and then replace "_serial" by "Serial1" in the rest of the file (if you take that hardware interface).

what about pin for TX?

pylon:
Your library uses the SoftwareSerial library to connect to the sensors UART. On the Mega you cannot use pins 4 and 5 for the SoftwareSerial because they don't support the PinChange interrupt. As the RX pin you should use one of the following: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68) or A15 (69).

On the Mega it would be much more reliable to use one of the hardware serial interface instead of the clunky software emulation. The necessary changes in the library are small and easy to take.
Remove the line

_serial.listen();

Remove the initialization of _serial in the Constructor and then replace "_serial" by "Serial1" in the rest of the file (if you take that hardware interface).

thank you for this post! I just change my port to A8 and A9 and it now works like a charm!

#include "FPS_GT511C3.h"
#include "SoftwareSerial.h"

// Hardware setup - FPS connected to:
//	  digital pin 4(arduino rx, fps tx)
//	  digital pin 5(arduino tx - 560ohm resistor - fps tx - 1000ohm resistor - ground)
//		this voltage divider brings the 5v tx line down to about 3.2v so we dont fry our fps

FPS_GT511C3 fps(A8, A9);

void setup()
{
	Serial.begin(9600);
	fps.UseSerialDebug = true; // so you can see the messages in the serial debug screen
	fps.Open();
}


void loop()
{
	// FPS Blink LED Test
	fps.SetLED(true);
	delay(1000);
	fps.SetLED(false);
	delay(1000);
}

pylon:
Your library uses the SoftwareSerial library to connect to the sensors UART. On the Mega you cannot use pins 4 and 5 for the SoftwareSerial because they don't support the PinChange interrupt. As the RX pin you should use one of the following: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68) or A15 (69).

On the Mega it would be much more reliable to use one of the hardware serial interface instead of the clunky software emulation. The necessary changes in the library are small and easy to take.
Remove the line

_serial.listen();

Remove the initialization of _serial in the Constructor and then replace "_serial" by "Serial1" in the rest of the file (if you take that hardware interface).

I tried the same on teensy 3.2 with hard luck:( Please can you provide with the edited library files?

can i use fingerprint scanner without the use of personal computer or laptop???
what i mean is that it works directly with arduino uno,,Is that possible????..
thank you!

akashmittal:
I tried the same on teensy 3.2 with hard luck:( Please can you provide with the edited library files?

Here you can see an implementation: