# 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)


## Featured Products

### Adafruit PN532 NFC/RFID Controller Shield for Arduino + Extras

[Adafruit PN532 NFC/RFID Controller Shield for Arduino + Extras](https://www.adafruit.com/product/789)
We've taken our popular Adafruit PN532 breakout board and turned it into a shield - the perfect tool for any 13.56MHz RFID or NFC application. The Adafruit NFC shield uses the PN532 chip-set (the most popular NFC chip on the market) and is what is embedded in pretty much every phone or...

Out of Stock
[Buy Now](https://www.adafruit.com/product/789)
[Related Guides to the Product](https://learn.adafruit.com/products/789/guides)
### Arduino Leonardo ATmega32u4 with headers

[Arduino Leonardo ATmega32u4 with headers](https://www.adafruit.com/product/849)
 **Note:** This product is&nbsp; **discontinued,** but you can purchase the [Seeeduino Lite](https://www.adafruit.com/product/3228), which is an equivalent alternative that can be used instead.

The Arduino Leonardo is a microcontroller board based on...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/849)
[Related Guides to the Product](https://learn.adafruit.com/products/849/guides)
### RFID / NFC Smart Ring - Size 7 - NTAG213

[RFID / NFC Smart Ring - Size 7 - NTAG213](https://www.adafruit.com/product/2801)
What did Lord Sauron, when forging the One Ring in the fires of Mount Doom&nbsp;forget to include in his all powerful ring? What did he forget to leave out of the&nbsp;ring impervious even to dragon fire, designed to rule over all free peoples of Middle Earth in perpetuity -&nbsp;a...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2801)
[Related Guides to the Product](https://learn.adafruit.com/products/2801/guides)
### RFID / NFC Smart Ring - Size 8 - NTAG213

[RFID / NFC Smart Ring - Size 8 - NTAG213](https://www.adafruit.com/product/2802)
What did Lord Sauron, when forging the One Ring in the fires of Mount Doom&nbsp;forget to include in his all powerful ring? What did he forget to leave out of the&nbsp;ring impervious even to dragon fire, designed to rule over all free peoples of Middle Earth in perpetuity -&nbsp;a...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2802)
[Related Guides to the Product](https://learn.adafruit.com/products/2802/guides)
### RFID / NFC Smart Ring - Size 9 - NTAG213

[RFID / NFC Smart Ring - Size 9 - NTAG213](https://www.adafruit.com/product/2803)
What did Lord Sauron, when forging the One Ring in the fires of Mount Doom&nbsp;forget to include in his all powerful ring? What did he forget to leave out of the&nbsp;ring impervious even to dragon fire, designed to rule over all free peoples of Middle Earth in perpetuity -&nbsp;a...

In Stock
[Buy Now](https://www.adafruit.com/product/2803)
[Related Guides to the Product](https://learn.adafruit.com/products/2803/guides)
### RFID / NFC Smart Ring - Size 10 - NTAG213

[RFID / NFC Smart Ring - Size 10 - NTAG213](https://www.adafruit.com/product/2804)
What did Lord Sauron, when forging the One Ring in the fires of Mount Doom&nbsp;forget to include in his all powerful ring? What did he forget to leave out of the&nbsp;ring impervious even to dragon fire, designed to rule over all free peoples of Middle Earth in perpetuity -&nbsp;a...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2804)
[Related Guides to the Product](https://learn.adafruit.com/products/2804/guides)
### RFID / NFC Smart Ring - Size 11 - NTAG213

[RFID / NFC Smart Ring - Size 11 - NTAG213](https://www.adafruit.com/product/2805)
What did Lord Sauron, when forging the One Ring in the fires of Mount Doom&nbsp;forget to include in his all powerful ring? What did he forget to leave out of the&nbsp;ring impervious even to dragon fire, designed to rule over all free peoples of Middle Earth in perpetuity -&nbsp;a...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2805)
[Related Guides to the Product](https://learn.adafruit.com/products/2805/guides)
### RFID / NFC Smart Ring - Size 12 - NTAG213

[RFID / NFC Smart Ring - Size 12 - NTAG213](https://www.adafruit.com/product/2806)
What did Lord Sauron, when forging the One Ring in the fires of Mount Doom&nbsp;forget to include in his all powerful ring? What did he forget to leave out of the&nbsp;ring impervious even to dragon fire, designed to rule over all free peoples of Middle Earth in perpetuity -&nbsp;a...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2806)
[Related Guides to the Product](https://learn.adafruit.com/products/2806/guides)

## Related Guides

- [Collin's Lab: RFID](https://learn.adafruit.com/collins-lab-rfid.md)
- [Babel Fish](https://learn.adafruit.com/babel-fish.md)
- [Adafruit PN532 RFID/NFC Breakout and Shield](https://learn.adafruit.com/adafruit-pn532-rfid-nfc.md)
- [3D Printed Camera Case for MEMENTO](https://learn.adafruit.com/memento-3d-case.md)
- [Make a Zelda Master Sword with the RP2040 Prop-Maker Feather](https://learn.adafruit.com/master-sword-rp2040.md)
- [Chatty Light-Up Circuit Playground Express Mask](https://learn.adafruit.com/chatty-light-up-cpx-mask.md)
- [Brain Machine](https://learn.adafruit.com/brain-machine.md)
- [Bajoran AirPods](https://learn.adafruit.com/bajoran-airpods.md)
- [Plush Game Controller](https://learn.adafruit.com/plush-game-controller.md)
- [Custom 3D Hat Graphics](https://learn.adafruit.com/custom-3d-hat-graphics.md)
- [Myo Armband Teardown](https://learn.adafruit.com/myo-armband-teardown.md)
- [3D Printed Frame for Adafruit IS31FL3741 LED Glasses](https://learn.adafruit.com/3d-printed-frame-for-led-glasses-is31fl3741.md)
- [Zipper Switch](https://learn.adafruit.com/zipper-switch.md)
- [Make it Glow: NeoPixel and LED Diffusion Tips & Tricks](https://learn.adafruit.com/make-it-glow-neopixel-and-led-diffusion-tips-tricks.md)
- [Color Mixing QT Py Cuff Bracelet](https://learn.adafruit.com/color-mixing-qt-py-cuff.md)
