NFC Ring Lock Box by Nairod785



  • Share
    and activate subtitles


  • Community Helper

    Excellent, that's great! Very cool!



  • Here is my sketch

    #include <Servo.h>
    #include <Wire.h>
    #include <PN532_I2C.h>
    #include <PN532.h>
    
    PN532_I2C pn532i2c(Wire);
    PN532 nfc(pn532i2c);
    
    Servo myservo;  // create servo object to control a servo
    int pos=1; // variable to store the servo position
    
    void setup() {
      nfc.begin();
      nfc.SAMConfig(); // configure board to read RFID tags 
    } 
    
    void loop() {
      if(pos==1){
        myservo.attach(3);  // attaches the servo on pin 3 to the servo object "Digital 3"
        myservo.writeMicroseconds(2000);
        pos=2;
        delay(400);
      }
      if(pos==3){
        myservo.attach(3);  // attaches the servo on pin 3 to the servo object "Digital 3"
        myservo.writeMicroseconds(580);
        pos=4;
        delay(400);
      }
      if(pos==2){
        myservo.detach();
      }
      if(pos==4){
        myservo.detach();
        delay(2000);
      }
      String ringUid;
      boolean success;
      uint8_t uid[] = {0, 0, 0, 0, 0, 0, 0};  // Buffer to store the returned UID
      uint8_t uidLength; // Length of the UID (4 or 7 bytes depending on ISO14443A card type
      success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, &uid[0], &uidLength);
    
      if (success & uidLength==7) {
    
        for (uint8_t i=0; i<7; i++){
          ringUid += String(uid[i], HEX);
        }
        if (ringUid=="hexadecimal number of inlay n°1" || ringUid=="hexadecimal number of inlay n°2"){
          if(pos!=4){
            pos=3;
          }
          if(pos==4){
            pos=1;
          }
        }
      }
    }


  • Very cool.



  • I'll post a link of the instructable and the final video in the next few weeks!



  • This idea very much interests me. Slightly different use than what I have in mind, but this I dig. Well done and thanks for giving me a fall project to brainstorm on.



  • I'll release a Tutorial in few days... sory for being late



  • TUTORIAL !
    http://www.instructables.com/id/NFC-Ring-Lock-Box/
    Here you are !
    Tell me if I need to change something.
    Maybe you want me to explain the sketch ?
    A video to show how it works in real time?


  • Community Helper

    Lokks good @Nairod785!



  • So cool! I really like this kind of project, great job :D