Connect your component together as shown in the schematic
1-connect 1Sheeld with Arduino
2-connect AND gate with 1sheeld like in attached picture
3-connect transistor with AND gate
4-connect relay with transistor
For more security, We use AND gate. Since, any one can use the Push button shield in the application and try all the pins to open the door. So, we have to let the output from more than 1 Pin in the Arduino and then collect them all using AND gate.
You will find the code here.
Test and Have Fun
1- Press on A Button on Keypad shield to record your special knock
2- Press on B Button when you want to open your door ” now it record your knock “
3- Final Press on C Button to open your door “note c button compare between your record one and your knock when you open the door “