Omegix/USB Auth 1.7

From Makers Local 256
Jump to: navigation, search

Your Status
Born On:
18:03, 9 May 2013 (CDT)
Last Updated:
10:18, 13 December 2013 (CDT)


The USB/NFC Authentication System (1.7) is a Raspberry Pi based system that reads NFC, RFID, and USB chip data (not files on the devices) to unlock an electric deadbolt.



  • Can read an USB stick and throw a relay to signal to open a door.
  • Can read a NFC tag and throw a relay to signal to open a door.
  • Can read a RFID tag and throw a relay to signal to open a door.
  • Upon detection of ID, can announce owner in an IRC channel.

In the News

End User Instructions

  1. Edit file
    1. Change the following line to use the LDAP server IP address: ld = ldap.initialize('ldap://')
  2. Edit BOTH files, AND
    1. Change the following line's "True" or "False" values depending on whether you would like the system to use a local whitelist: CHECK_LOCAL_WHITE_LIST = True
  3. Edit whiteList.xml
    1. copy and paste as many known <entry> areas as desired.
      1. <name> is the tag for the name of the ID owner
      2. <nfc> is the tag for both NFC and RFID IDs
      3. <iSerial> is the tag for USB IDs


  • Raspberry Pi
    • 16GB SD Memory Card
    • GPIO Breakout board (I used "Slice Of Pi" breakout board by IDT research)
    • Jumper Wire (For bringing a direct connection from the pre-regulated 5V rail to the GPIO breakout board for powering the NFC and Relay board.)
  • Relay board
  • NFC \ RFID Board
  • USB Power Supply
  • Ethernet Cable
  • Authetication Devices
    • NFC Badge (for positive identification testing)
    • NFC Badge (for negative identification testing)
    • USB Memory Stick Badge (for positive identification testing)
    • USB Memory Stick (for negative identification testing)
  • Project Enclosure


To Do

  1. Persistence Testing: Hook up unit to door, let it run for a week and leave NFC card and USB stick next to device for members of Makers Local 256 to randomly test
  2. Hook up magnetic reed switch (found on doors and windows) for users to test door closed sensing \ re-locking capability


To Do

  1. Tell root crontab to run willie with predefined configuration file
  2. Build transparent aluminum enclosure for circuit boards
  3. Build transparent aluminum enclosure for NFC\RFID reader board to mount on window of Door
  4. Code "Master RFID" and\or "Master USB" for adding new IDs to the whitelist, and\or generating an email to LDAP admin
  5. Hold peer review

Steps Taken

  1. Installed Raspbian on a 16GB SD memory card
  2. Followed this guide to get I2C available
    • Used this article to determine that I had a 256MB Model B RaspberryPi. This is important, because when checking i2cdetect I have to use "-y 0" instead of the "-y 1".
  3. This article is good too, it mentions to add the pi user to the i2c group so you don't have to run sudo all the time.
  4. Wiring
    • The raspberry pi has a voltage regulator that limits amperage consumption to 700ma. This was not enough to power the NFC reader and relay board from the GPIO, as well as have a USB inserted in the raspberry pi at the same time. To solve this problem I put a jumper wire from the high side of the regulator on the raspberry pi to the daughter board where the relay board and NFC reader board are connected for power.

Willie IRC Bot & Module

  1. Create directory ~/.willie/TextToSay
    • Alternatively, you can customize what directory to scan, and set this in the willie module
  2. Copy into willie/willie/modules
  3. make sure the permissions on are set correctly (chmod 777, or something like that)
  4. cd into the willie directory and run "python build"


  • Board suddenly stopped working, including no HDMI out. GPIO fuse is likely blown, but have not confirmed. This Guide has details on how to troubleshoot.
  • Was getting some bad errors "journal" errors when plugging in the usb stick. Power supply couldn't power the NFC reader, relays, and read usb at the same time. 800ma Was not enough. Need to figure out what the amp limits are on the traces for the raspberry pi
  • Ran into this error when running DannyO's (hubcitylabs) script:

quick2wire/", line 72, in transaction

   ioctl(self.fd, I2C_RDWR, addressof(ioctl_arg))
  • Problem Description: hubcitylab's script works on Rev1 RasbPi, doesn't work on Rev2
    • Solution: is hard coded to use "0" as the i2c_channel. This needs to be updated to "1" for Rev2 boards, or better yet, have it check which bus is in place and use the correct I2C bus location via detection.
    • Better Solution: the libraries downloaded with the git clone of the hikaru-gatekeeper are not the latest. make sure to download the latest libraries (quick2wire, py532, possibly others) independently to get code that will work on Rev2 raspberry pi boards
  • Rooted Galaxy S3, NFC reader still does not see phone. Mog suggested that an application might have to be running that will broadcast the NFC ID. --Omegix (talk) 21:13, 31 July 2013 (CDT)
    • When running NDEF Tools on my rooted (may not matter) GS3, the NFC ID was broadcast.
    • The Galaxy S4 (Four) writes a different NFC tag each scan.


Python Approach

Application Files

    • This is run by root user's crontab. It will start at boot, and the script crashes, restart it.
    • This is run by root user's crontab. It will start at boot, and the script crashes, restart it.
    • This is run by root user's crontab. It will start the Willie IRC bot at boot, and if it crashes, restart it.
  • /home/pi/.willie/Willie.cfg
    • Crontab won't know where to find the default config file, so this official configuration file must exist.
    • Script will scan for USB key being inserted, and if it's in the whitelist or LDAP, unlock the door.
    • Script will scan for NFC/RFID being detected, and if it's in the whitelist or LDAP, unlock the door.
    • Take in value, see if it's in the LDAP
    • Take in value, see if it's in the whitelist file, "whiteList.xml"
  • whiteList.xml
    • Configuration file holding plaintext values of permissible USB and NFC\RFID keys
    • Simple function to take in a string (name) and write a file to a directory containing "Unlocking for (name)." This is so the Willie IRC Module will have a file to detect and regurgitate the contents of into an IRC channel.

Testing Files

    • Script will continuously scan for new USB devices, and call ldap Check. If ldap check successful, call DoorUnlock.
    • same as, except for NFC (and RFID)
    • Throw pins high and low on the GPIO to trigger relays that will be tied to a powerbolt1000.
    • Monitor pins wired to reed switches to ensure door is closed before re-locking.
    • Pin Assignments
      • Relay for Door Unlock (IN1 on Keyes Relay Board): #23 on GPIO
      • Relay for Door Lock (IN2 on Keyes Relay Board): #24 on GPIO
  • ScanReedSwitch
    • Pin Assignments: #25 on GPIO
  • Willie IRC Bot Framework
    1. install from github, tarball may not be latest
      • Install Dependencies: sudo apt-get install python-lxml python-mysqldb python-tweepy python-feedparser python-enchant; sudo pip install pytz praw
    2. run sudo ./setup install to install modules

Perl Approach

  • Would have to write an PN532 driver in perl
  • Alternatively have perl call python scripts, python already has a PN532 driver written
  • Write a new ackis module for NFC monitoring