Hardware Reference
In-Depth Information
Putting It All Together
With the new input and authentication blocks written, the next step is to use them in the
main function.
Update the main function to use the new classes by changing the authInput and
authenticator variable initialisations to
authInput = RfidInput()
authenticator = RfidFileAuthenticator()
Run the program and bring a tag that is listed in tags.txt near the reader. he program will
print
reading from tags.txt file
waiting for tag
1c477cd5
checking if 1c477cd5 is valid
tag found belonging to: Andrew
unlock, wait and relock
Rerun the program and check that a tag that is not listed in tags.txt doesn't open the
door. If your program works successfully, you need to add a while loop to the main func-
tion so that you do not have to keep running it each time a tag is presented. Do this by wrap-
ping the if statement with an unconditional while loop, as shown here:
while(True):
if(authenticator.check(authInput.getInput())):
doorController.send_open_pulse()
Testing the Program and Fitting the Lock
Now is the time to test the complete program. Run the program and check that the electric
door lock is locked. Wave a valid tag at the reader and check that the door lock unlocks for a
few seconds and then relocks. Wave the valid tag again to check whether the sequence is
repeated. Finally, use an invalid tag and make sure that the door doesn't open.
If the system appears to work, it's time to it the electric lock to the door and the tag reader.
You should secure the wiring running to the door lock; otherwise, an attacker could tamper
with it to unlock it. As mentioned earlier, it's a good idea to be able to manually unlock the
Search WWH ::




Custom Search