Skip to content

Latest commit

 

History

History
132 lines (83 loc) · 7.64 KB

README.md

File metadata and controls

132 lines (83 loc) · 7.64 KB

LARP hackable RFID lock

Code, circuits and 3D printable enclosures for a 'hackable' RFID lock prop usable in LARP or similar events.

Design goals

  • Cheap! You need one per door, LARPs often have lots of doors.
  • Ubiquitous hobbyist hardware, nothing custom/rare
  • Easy to build and solder
  • Reads easily and cheaply available MIFARE Classic RFID cards.
  • Clear visual and audible feedback when presenting a card. Two LEDs and a piezo buzzer are the current candidates rather than a display.
  • Multiple software options (local card database, on-card authorisation, MQTT server etc.) for validating cards An authorisation library that use a bitmask on the card these has now been written.
  • Multiple 'hacking' options by physical interaction or smartphone/tablet connection
  • Easy to reset to defaults before/during/after events, no reprogramming/rebuilding. Have settled on 'double reset detector' as it's a reasonably well supported library and this uses no more pins.
  • Power by USB charger or batteries
  • Batteries will be removable AAs, as they easy to buy and change, because you will forget to charge them at some point
  • Battery life of ~48 hours for 'weekend' games, this may be hard to manage without using deep sleep during periods of long inactivity or programmed time out hours. Ideally, some method of monitoring battery voltage and warning of low battery, probably just a voltage divider read by the analogue input.

Proposed 'hacking' methods

  • Connect to local Wi-Fi hotspot with a phone/tablet and play a simple mini-game to gain control, perhaps 'Simon says' or 'whack-a-mole'
  • Use one or two buttons to enter a code, probably using Tap Code, perhaps issued at game start or discovered in play. A 'tap code' library has now been written for this purpose.
  • Connect a physical dongle/wire handed to 'hackers' at game start or discovered in play
  • Connect a USB cable and interact through a UART interface. Requires a laptop and a bit of coaching for the players, would be really but great for 'style'
  • 'Hack' the MQTT server it connects to for authorising cards (out of scope at present)
  • Maybe combinations of the above depending on the level of difficulty and time needed

Bill of materials

Here are links to the specific modules you need for this build. The LEDs can be swapped out for pretty much any old LED or combined into a single RGB one.

Wemos D1 mini microcontroller ~£3.00

MFRC522 SPI RFID reader/writer ~£2.50

10mm red LEDs ~£3.50 for 50

10mm green LEDs £6.50 for 50

100 ohm resistors

3xAA switched battery box ~£?

10mm LED bezels ~£4.65 for 5 (optional, for looks)

Passive buzzer module ~£2.20 (optional)

Button (optional)

Wiring

The WeMos D1 mini has just enough pins free for this prop. Use the following wiring. You will need several connections to GND of the D1 mini so solder one wire then join the others to that.

  • Red LED anode (long lead) to pin D2 of the D1 mini
  • Red LED cathode (short lead) to GND
  • Green LED anode (long lead) to pin D4 of the D1 mini
  • Green LED cathode (short lead) to GND
  • RFID MOSI to pin D7 of the D1 mini
  • RFID MISO to pin D6 of the D1 mini
  • RFID SCK (CLK) to pin D5 of the D1 mini
  • RFID SDA (CS) to pin D8 of the D1 mini
  • RFID RST (Reset) to pin D3 of the D1 mini The MFRC522v2 library uses software reset.
  • D0 of the D1 mini looped to RST of the D1 mini. This is to allow deep sleep for power saving.
  • Battery holder + (red wire) to 5V of the D1 mini
  • Battery holder - (black wire) to GND

Optional buzzer

  • Buzzer + to 5V of the D1 mini
  • Buzzer - to GND
  • Buzzer I/O to pin D1 of the D1 mini

Optional button

  • Connect one terminal to GND
  • Connect one terminal to RX of the D1 mini

Here's a shot of all this being tested on a breadboard.

Getting started

Download and install a local copy of the Arduino IDE to your computer. I only have a PC so all instructions will be Windows-centric, but iOS should be broadly similar.

From a fresh install, the Arduino IDE does not support ESP8266 boards like the WeMOS D1 mini, follow the instructions here to install support for ESP8266.

Download a copy of the library as a .zip from GitHub and save it somewhere you'll be able to find it. This includes all the code and the STLs for 3D printing.

Install the library by choosing Sketch->Include Library->Add .ZIP Library in the Arduino IDE.

Plug in your D1 mini to your computer, wait for any drivers to install and select the board as "LOLIN(WEMOS) D1 R2 & mini". This menu can be quite a big/deep menu so look carefully.

Select the port for your board, it should come up as COMX, if it doesn't show anything then it is likely there is an issue with the driver for the board.

Now you can check if your LEDs, buzzer and RFID reader work OK. Find the examples for the 'LarpHackableRfidLock' library under File->Examples->LarpHackableRfidLock and choose the 'test' example. This will open another Arduino IDE window.

In this new window, click the 'arrow' in the toolbar to compile and upload the test sketch to the D1 mini.

If it uploads without errors then it should flash the red and green LEDs and sound the buzzer. If you bring a MIFARE Classic RFID card towards the reader, it should sound a different tone. If this all happens, congratulations, the hardware is all working!

The test sketch also puts out debugging information over the Serial Monitor. If you'd like to see this, you can open it from the Tools->Serial Monitor menu. You will need to set the speed of the Serial Monitor to 115200 baud in the bottom right hand corner, it may have defaulted to 9600 baud.

Cases

There are STLs for several styles of case

  • 3xAA battery holder, USB connector exposed
  • 3xAA battery holder, USB connector hidden
  • 4xAA battery holder, USB connector exposed
  • 4xAA battery holder, USB connector hidden

Why is this an Arduino Library when it's a really plans for a prop?

Doing this makes it easier for coding novices. They can install the 'library' into an unused copy of the Arduino IDE and it will also install the dependencies and give them a dropdown list of any different versions of the software under 'Examples'.

There are no plans to add it to the main Arduino Library list as it is a bit niche.