CIRCUIT DIAGRAM :- https://hackster.imgix.net/uploads/image/file/22993/F73TCBVI03OBRLO.LARGE.jpg?w=580&h=435&fit=max&fm=jpg&s=c92fd0d80a9bf8eb0660b2497bd05787
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.
SOURCE CODE – https://codebender.cc/sketch:56684#Untitled_Project.ino