Hi all,
Ben here - just getting started on my Arduino journey but have been messing around with all sorts of electronics for many years.
My first project is to create a fingerprint enabled lock.
Got the code all working nicely, fingerprints recognised, LCD display showing what I want & relay triggering (later to be connected to lock release).
One thing I cant work out.... when the Uno board powers up, the relay (connected to power & ground/pin 13 of digital pin set rapidly switches on & off 3 times, within a second. This happens everytime the board powers up (only once on power up) but obviously not very good for a lock application.
Any thoughts?
Thanks! 
int relayPin=13; //define a pin for LED
//triggered when fingerpint matches - outputs for relay
digitalWrite(13, HIGH); // turn the relay on (HIGH is the voltage level)
// delay while door lock is enabled
delay(8000);
//lock door and set LCD to red
digitalWrite(13, LOW); // turn the relay off by making the voltage LOW
No way around that. It's part of the bootloader. Use another pin.
Hope you haven't connected the relay directly to the pin; it more than likely uses too much current. And hope that you have used a so-called flyback diode.
Welcome. 
I don't see your pinMode statement - is that the complete code you've posted there?
As a noob (but who has some experience in electronics) let me guide you to a series of YouTube videos designed for Arduinites (my term for Arduino enthusiasts!) like you - if you like them, do subscribe, new ones weekly (ish). Subscriptions let me gauge interest. URL in the footer of this very post.
And please post your complete code. If that is your complete code then add that pinMode statement.
@sterretje - when you say 'Use another pin' do you mean I've inadvertently selected pin 13 which has some special behaviour? Would I not experience this on another pin.
@Ralph_S_Bacon - full code is below but most relates to the fingerprint reader & LCD. Tips welcome.
/***************************************************
==wiring
=Finger sensor
white - digital 3
yellow - digital 2
black - gnd
red - +5V
=RGB LCD
black - gnd
red - +5V
white - A4
yellow - A5
=Relay
gnd & pin 13
****************************************************/
// library included
#include <Wire.h>
#include "rgb_lcd.h"
#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>
rgb_lcd lcd;
int relayPin=13; //define a pin for LED
int getFingerprintIDez();
SoftwareSerial mySerial(2, 3);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
//setup routines - finger print reader
void setup()
{
Serial.begin(9600);
Serial.println("fingerprint reader test");
// set the data rate for the sensor serial port
finger.begin(57600);
if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
while (1);
}
Serial.println("Waiting for valid finger...");
//setup routines - LCD
{
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.setCursor(0,0);
lcd.print(" present finger ");
lcd.setCursor(0,1);
lcd.print(" shed is secure ");
lcd.setRGB(255, 0, 0); //set LCD to red
}
//setup routines - relay
pinMode(relayPin, OUTPUT);
}
//run time loops
void loop()
{
getFingerprintIDez();
}
uint8_t getFingerprintID() {
uint8_t p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image taken");
break;
case FINGERPRINT_NOFINGER:
Serial.println("No finger detected");
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
return p;
case FINGERPRINT_IMAGEFAIL:
Serial.println("Imaging error");
return p;
default:
Serial.println("Unknown error");
return p;
}
// OK success!
p = finger.image2Tz();
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image converted");
break;
case FINGERPRINT_IMAGEMESS:
Serial.println("Image too messy");
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
return p;
case FINGERPRINT_FEATUREFAIL:
Serial.println("Could not find fingerprint features");
return p;
case FINGERPRINT_INVALIDIMAGE:
Serial.println("Could not find fingerprint features");
return p;
default:
Serial.println("Unknown error");
return p;
}
// OK converted!
p = finger.fingerFastSearch();
if (p == FINGERPRINT_OK) {
Serial.println("Found a print match!");
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println("Communication error");
return p;
} else if (p == FINGERPRINT_NOTFOUND) {
Serial.println("Did not find a match");
return p;
} else {
Serial.println("Unknown error");
return p;
}
// found a match!
Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
}
// returns -1 if failed, otherwise returns ID #
int getFingerprintIDez() {
uint8_t p = finger.getImage();
if (p != FINGERPRINT_OK) return -1;
p = finger.image2Tz();
if (p != FINGERPRINT_OK) return -1;
p = finger.fingerFastSearch();
if (p != FINGERPRINT_OK) return -1;
// found a match!
//match outputs for LCD
lcd.setRGB(0, 255, 0); // set LCD to Green
lcd.setCursor(0,0);
lcd.print(" Thank you :) ");
lcd.setCursor(0,1);
lcd.print(" door is open ");
//match outputs for relay
digitalWrite(13, HIGH); // turn the relay on (HIGH is the voltage level)
// delay while door lock is enabled
delay(8000);
//lock door and set LCD to red
digitalWrite(13, LOW); // turn the relay off by making the voltage LOW
lcd.setRGB(255, 0, 0); // set LCD to red again
lcd.setCursor(0,0);
lcd.print(" present finger ");
lcd.setCursor(0,1);
lcd.print(" shed is secure ");
Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
return finger.fingerID;
}
Pin 13 had the built in LED attached to it on most boards. It flashes on power up.
Thanks @nathancamp
I will try swapping this to pin 12 then & the power up on/off should no longer be an issue? Or do all outputs switch on power-up?
Only pin 13 (as far as I know); simple to test 
Hi,
Try putting the pinMode statement as the first statement in your setup.
then immediately after the pinMode ( ,OUTPUT);
digitalWrite( , LOW);
At the moment you are declaring the output after a lot of other statements.
Tom... 
Thanks, will try this when back home.
Resolved by switching relay to pin 12.
It seems the LED on pin 13 which flashes at boot also triggers the output.
Thanks all, especially @sterretje
It's the same pin so it makes sense 
Hi,
Glad you are getting stuff working..!
A possible issue: what happens at initial power-up??
See this page: http://arduino-info.wikispaces.com/ArduinoPower
Search for "Active Low" to see why many relay modules are configured this way so that power-on does not cause any quick relay activations ..