# NFC Ring Password Helper

## Overview

https://www.youtube.com/watch?v=Gjf_s8TXLUM

Log in to your computer with a swipe of your hand!&nbsp;Use an NFC ring and reader to type in your password for you with an Arduino Leonardo, which can act like an HID keyboard.

Before you begin, take a look at the following prerequisite guides:

- [Adafruit PN532 RFID/NFC Breakout and Shield](../../../../adafruit-pn532-rfid-nfc)
- [Adafruit Guide to Excellent Soldering](../../../../adafruit-guide-excellent-soldering)

For this project, you will need:

- [Arduino Leonardo](https://www.adafruit.com/product/849)
- [Adafruit PN532 NFC/RFID Shield for Arduino](https://www.adafruit.com/product/789)
- [RFID/NFC Smart Ring in your size](https://www.adafruit.com/product/3041)
- [Basic soldering tools](../../../../adafruit-guide-excellent-soldering)
- [Micro USB cable](https://www.adafruit.com/products/2185)

![](https://cdn-learn.adafruit.com/assets/assets/000/030/491/medium800/rfid___nfc_nfc-password-helper-00.jpg?1455118275)

# NFC Ring Password Helper

## Assemble Circuit

![](https://cdn-learn.adafruit.com/assets/assets/000/030/492/medium800/rfid___nfc_nfc-password-helper-03.jpg?1455118331)

Solder header pins onto the[NFC shield as directed in its assembly guide](../../../../adafruit-pn532-rfid-nfc). Cut and rewire the IRQ pin to pin 6, as shown for use with Arduino Leonardo.

# NFC Ring Password Helper

## Code

![](https://cdn-learn.adafruit.com/assets/assets/000/030/495/medium800thumb/rfid___nfc_nfc-password-helper-05.jpg?1455120807)

Load up the Arduino code below onto your Arduino Leonardo and open up a serial monitor before scanning your tag. The tag identifier will print to the serial monitor when scanned and you can then paste it into the code and update your password.

Load up the updated code, which will now type your password (followed by an optional carriage return) into any field with focus when the proper NFC tag is read. Be careful to place the reader somewhere where it won't accidentally be triggered, or you could end up tweeting or emailing your administrator password by mistake!

```auto
//Largely based on Lewis Callaway's Instructable code:
// http://www.instructables.com/id/NFC-Computer-Unlocker

#include <Adafruit_PN532.h>
#include <Wire.h>
#include <SPI.h>

#define IRQ 6 // this trace must be cut and rewired to work on Leonardo
#define RESET 8

Adafruit_PN532 nfc(IRQ, RESET);

void setup() {
  Serial.begin(9600);
  nfc.begin();

  uint32_t versiondata = nfc.getFirmwareVersion();
  if (! versiondata) {
    Serial.print("Didn't find PN53x board");
    while (1); // halt
  }
  // Got ok data, print it out!
  Serial.print("Found chip PN5"); Serial.println((versiondata>>24) & 0xFF, HEX);
  Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC);
  Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);
 
  // configure board to read RFID tags
  nfc.SAMConfig();
  Keyboard.begin(); //initiate the keyboard
}

unsigned digit = 0;

void loop() {
  uint8_t 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)

  // wait for RFID card to show up!
  Serial.println("Waiting for an ISO14443A Card ...");

  // Wait for an ISO14443A type cards (Mifare, etc.). When one is found
  // 'uid' will be populated with the UID, and uidLength will indicate
  // if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight)
  success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);

  uint32_t cardidentifier = 0;
 
  if (success) {
    // Found a card!

    Serial.print("Card detected #");
    // turn the four byte UID of a mifare classic into a single variable #
    cardidentifier = uid[3];
    cardidentifier <<= 8; cardidentifier |= uid[2];
    cardidentifier <<= 8; cardidentifier |= uid[1];
    cardidentifier <<= 8; cardidentifier |= uid[0];
    Serial.println(cardidentifier);

    if (cardidentifier == 170923268) { //update with your RFID identifier!
      Keyboard.write('m');  //update with your password!
      Keyboard.write('y');
      Keyboard.write('p');
      Keyboard.write('a');
      Keyboard.write('s');
      Keyboard.write('s');
      Keyboard.write('w');
      Keyboard.write('o');
      Keyboard.write('r');
      Keyboard.write('d');
      Keyboard.write('\n'); // carriage return (ENTER key), remove if not desired
      delay(5000); //makes sure the password isn't repeated
    }
  }
}
```

# NFC Ring Password Helper

## Use it!

![](https://cdn-learn.adafruit.com/assets/assets/000/030/493/medium800/rfid___nfc_nfc-password-helper-01.jpg?1455118344)

Use the NFC shield's mounting holes and screws, or a piece of foam or velcro tape to affix the circuit to the underside of your desk. NFC has a very short range, so this may not work for you if your desk is extra thick or made of metal! Route the USB cable to your computer and practice logging in by waving your hand over the&nbsp;antenna!

![](https://cdn-learn.adafruit.com/assets/assets/000/030/494/medium800/rfid___nfc_nfc-password-helper-02.jpg?1455118358)

![](https://cdn-learn.adafruit.com/assets/assets/000/030/496/medium800thumb/rfid___nfc_nfc-password-helper-06.jpg?1455120864)


## Related Guides

- [Bluefruit TFT Gizmo ANCS Notifier for iOS](https://learn.adafruit.com/ancs-gizmo.md)
- [3D Printed Dragon Lamp](https://learn.adafruit.com/dragon-lamp.md)
- [CircuitPython Your Own Adventure](https://learn.adafruit.com/circuit-python-your-own-adventure.md)
- [PyPortal Weather Station](https://learn.adafruit.com/pyportal-weather-station.md)
- [Playing Arduboy Games on Arcada](https://learn.adafruit.com/playing-arduboy-games-on-arcada.md)
- [MIDI Solenoid Drummer](https://learn.adafruit.com/midi-solenoid-drummer.md)
- [Re-MakeCode the Classics: Arkanoid](https://learn.adafruit.com/re-makecode-the-classics-arkanoid.md)
- [Mini VOTE Keyboard](https://learn.adafruit.com/vote-keyboard.md)
- [Circuit Playground Express USB MIDI Controller and Synthesizer](https://learn.adafruit.com/cpx-midi-controller.md)
- [Daily UV Index PyPortal Display](https://learn.adafruit.com/pyportal-uv-index.md)
- [BLE Thermal "Cat" Printer with CircuitPython](https://learn.adafruit.com/ble-thermal-cat-printer-with-circuitpython.md)
- [Air Quality Sensor 3D Printed Enclosure](https://learn.adafruit.com/air-quality-sensor-silo-house.md)
- [Pulse Oximeter Wireless Data Logger](https://learn.adafruit.com/pulse-oximeter-wireless-data-logger.md)
- [Cleveland Museum of Art PyPortal Frame](https://learn.adafruit.com/cleveland-museum-of-art-pyportal-frame.md)
- [PyPortal Air Quality Display](https://learn.adafruit.com/pyportal-air-quality-display.md)
