Connect your component together as shown in the schematics:
- connect 1Sheeld with Arduino
- connect AND gate with 1sheeld like in attached picture
- connect transistor with AND gate
- 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:
Now test1-Press on A Button on Keypad shield to record your special knock
- Press on A Button on Keypad shield to record your special knock
- Press on B Button when you want to open your door "now it records your knock"
- Final Press on C Button to open your door "note C button compares between your record one and your knock when you open the door "