A simple Arduino to Nodejs serial communction program allowing user to unlock mac or start screensaver with a NFC tag.
Part of the code is forked from https://github.com/suhajdab/lan-unlock
Nodejs (https://nodejs.org/) and forever package (https://www.npmjs.com/package/forever) needs to be installed to run current setup. Note the global flag -g when installing forever.
Arduino Serial communication enabled Arduino.
NFC Module PN532 NFC RFID module.
This application requires your nfc tag uid, you can use the example files in PN532 to find out the id. The tag uid will then be displayed in HEX values: 0x84 0x48 0x12 0xFF 0x2B 0xE1. This would translate to a string in this application: 844812ff2be1 saved in the config.json, to be matched with your tag uid.
To use this application without changing much, you'll need to set Display login window as
to List of users
. It will only function when logged in.
- https://arduino.cc/en/Main/ArduinoBoardUno
- https://dangerousthings.com/shop/xnt-ntag216-2x12mm-glass-tag/
- https://dangerousthings.com/shop/simple-pn532/
- https://nodejs.org/
- https://arduino.cc/en/Main/Software
- https://github.com/elechouse/PN532
- Open
config-BLANK.json
and change the password to match your OSX password. Also add your tag uid to the list of uids and save asconfig.json
. - Add the current port to
nfc.port
(List ports in terminal withls -l /dev/*.usbmodem*
) 2 1/2. I've saved a nifty little script at https://gist.github.com/lanhed/dcb652c83f032fea31c9 that potentially could make the port selection automaticly. I just haven't had the time to implement it. But you could :) - Generate ssl certificates ( ex: https://www.selfsignedcertificate.com ) and place
local.cert
&local.key
in root folder. - Plug in your Arduino connected PN532 NFC RFID module to your computer and upload the Arduino sketch
- Open Automator and from there open
Start Unlock Deamon.app
- Change the path in the second line to match your installation directory (Do this to
Stop Unlock Deamon.app
as well). - Save
- Go to System Preferences >> User & Groups and click on Login Items tab
- Add
Start Unlock Deamon.app
and check the box to enable it at first login - Put your computer to sleep and scan your tag.
- Open
start-unlock-deamon.command
andstop-unlock-deamon.commmand
and change the path in the first line to match your installation directory. - Run
start-unlock-deamon.command
by double clicking it. - Put your computer to sleep and scan your tag.
Disclaimer: Use at your own risk!, I take no responsibility for any harm caused by the use of this software.
License: WTFPL
- Make the app auto discover port
- Make the application work even if you're not logged in.
- Make a menubar app to display application status, show denied users, start/stop the deamon.
- Installation script