[HELP] Biometric door lock

Can anyone help me with biometric door lock setup?

Components -

Board - Arduino uno FPS - GT-511C1R Lock - 12v Solenoid (powered by external 12v power supply) Relay - 5V Relay

I have successfully connected FPS with Arduino ,also added finger print into module but now not getting how to trigger relay using FPS to open lock for few seconds. Most of the tutorial are for old version of FPS or for 5v/servo motor.

Ps : I am completely newbie bought this stuff just 2 days ago and learnt few things from internet. Don't have much knowledge of programming .

Thank You :)

Do you have some code? Do you understand how it works? Can you show it?

Please provide links to the fps and the library that you use.

Yes, i have library and checked it via example but not getting how to turn on/off relay using FPS.

I have added my finger image using demo software

In the block where it says 'verified id', you can add a digitalWrite to activate the lock.

it worked :)

but its continuously running in loop.

how to limit that ? code based timeout or manual switch ? actually the fps gets very hot when on for continuously

Post [u]your[/u] code.

No idea about the fps getting hot. I might be able to do a little research when I'm behind a computer.

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

// set up software serial pins for Arduino's w/ Atmega328P's
// FPS (TX) is connected to pin 4 (Arduino's Software RX)
// FPS (RX) is connected through a converter to pin 5 (Arduino's Software TX)
FPS_GT511C3 fps(4, 5); // (Arduino SS_RX = pin 4, Arduino SS_TX = pin 5)

void setup()
{
	Serial.begin(9600); //set up Arduino's hardware serial UART
	delay(100);
	fps.Open();         //send serial command to initialize fps
	fps.SetLED(true);   //turn on LED so fps can see fingerprint
  pinMode(13, OUTPUT);

}

void loop()
{
	// Identify fingerprint test
	if (fps.IsPressFinger())
	{
		fps.CaptureFinger(false);
		int id = fps.Identify1_N();
				if (id <200)
		{//if the fingerprint matches, provide the matching template ID
			Serial.print("Verified ID:");
      digitalWrite(13, HIGH);
      Serial.println(id);
		}
		else
		{//if unable to recognize
			Serial.println("Finger not found");
		}
	}
	else
	{
    digitalWrite(13, LOW);
		Serial.println("Please press finger");
	}
	delay(5000);
}

loop() is continuously called; that is the intention.

Let’s say you want the lock to be activated for only 5 seconds. In the simplest way, you can use a delay.

In setup, make sure that the lock is not activated; this is just a good habit

void setup()
{
  ...
  ...
  digitalWrite(13, LOW);
  pinMode(13, OUTPUT);
}

Now you should also need to learn that using hard-coded pin numbers are difficult to maintain; if you ever want to change the pin, you need to change it in multiple places. That is why most code will contain lines that define or declare the pins; see the last line below.

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

// set up software serial pins for Arduino's w/ Atmega328P's
// FPS (TX) is connected to pin 4 (Arduino's Software RX)
// FPS (RX) is connected through a converter to pin 5 (Arduino's Software TX)
FPS_GT511C3 fps(4, 5); // (Arduino SS_RX = pin 4, Arduino SS_TX = pin 5)

const byte solenoidPin = 12;

I’ve changed the pin to pin 12 because pin 13 is the built-in led and is activated a few times when the bootloader is active; this will result in unwanted activation of the solenoid.

In setup() and loop() you can now use the ‘name’; shown for setup().

void setup()
{
  ...
  ...
  digitalWrite(solenoidPin, LOW);
  pinMode(solenoidPin, OUTPUT);
}

In loop(), modify the if section

    if (id < 200)
    { //if the fingerprint matches, provide the matching template ID
      Serial.print("Verified ID:");
      Serial.println(id);

      digitalWrite(solenoidPin, HIGH);
      delay(5000);
      digitalWrite(solenoidPin, LOW);
    }

You can also use a defined delay near the beginning of the code; e.g.

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

// set up software serial pins for Arduino's w/ Atmega328P's
// FPS (TX) is connected to pin 4 (Arduino's Software RX)
// FPS (RX) is connected through a converter to pin 5 (Arduino's Software TX)
FPS_GT511C3 fps(4, 5); // (Arduino SS_RX = pin 4, Arduino SS_TX = pin 5)

const byte solenoidPin = 12;
unsigned long unlockDuration = 5000UL;

and use it in loop()

    if (id < 200)
    { //if the fingerprint matches, provide the matching template ID
      Serial.print("Verified ID:");
      Serial.println(id);

      digitalWrite(solenoidPin, HIGH);
      delay(unlockDuration);
      digitalWrite(solenoidPin, LOW);
    }

You do not need to set the pin anywhere else in your code.

I suggest that you only switch the LED of the fps on before you need it, so in loop(). And next switch it off again when no longer needed. Something like below

void loop()
{
  fps.SetLED(true);  <-------------- led on so we can read
  delay(500);
  if (fps.IsPressFinger())
  {
    fps.CaptureFinger(false);
    int id = fps.Identify1_N();
    fps.setLED(false);  <-------------- led off, we do not need it any longer
    if (id < 200)

  ...
  ...
  }
  fps.SetLED(false);  <-------------- led off if IsPressedFinger() returns false
  delay(500);
}

This will switch the led on for 0.5 seconds during which the finger print can be scanned; you can vary the time. I’ve shown you earlier how to use a variable for the delay if needed.

I’m not familiar with the reader; so can’t further advise.

Now note that this code is blocking; when the solenoid is activated, the code can not do anything useful. If there is a need to do something else (e.g. read a button in those 5 seconds), you can change the code it to a millis() based apporach.

+1 Exactly what i was looking for :)

As i want to operate it by battery just in case if i forgot to turn power off , how to put arduino in deep sleep mode ? like if its power on for more than 5 minutes then automatically turn on deep sleep after 5 minutes

Though i'll add power switch and turn it only when i need to open door.

No experience with low power modes; I however do know that an Uno is not the most suitable candidate for that. Your best choice is probably a mini or pro-mini; both are missing the USB-to-TTL converter and some of the LEDs. The pro-mini is available in a 3.3V version as well.

sterretje: No experience with low power modes; I however do know that an Uno is not the most suitable candidate for that. Your best choice is probably a mini or pro-mini; both are missing the USB-to-TTL converter and some of the LEDs. The pro-mini is available in a 3.3V version as well.

Ok bro . thanks :)

Hello! I’m developing a biometric door lock using R305 sensor, but i would like to keep the light sensor off (stand-by) until put the finger on sensor. Anyone have an ideia to make it? Thanks!

BMGrillo:
Hello! I’m developing a biometric door lock using R305 sensor, but i would like to keep the light sensor off (stand-by) until put the finger on sensor. Anyone have an ideia to make it?
Thanks!

i guess for that you need infrared sensor

have a look at this project

I wanted to mention to use a reverse biased diode across coil of relay and drive relay with a NPN Q. You said relay, so I assume this is not a module with those protections in place.