HOWTO Program a key

From i3Detroit
Jump to: navigation, search


We use EM4100 125khz RFID tags.


There are three formats for the data in our flavour of RFID:

  1. 1 26 bit decimal number, just a number, written on keyfobs
  2. 2 16 bit decimal numbers, <5 digits>:<5 digits>, currently (2022-07-29) in the CRM and written on the cards.
  3. the number but as hex It's what is in the spreadsheet right now.

Converting formats

Thanks to Evan for the blog post and Google Sheet documenting this!

  • To go from hex to decimal: echo 0x05094D8 | perl -nle 'print hex'
    • 0x is optional
  • To go from 2 16 bit to decimal: echo 80:38104 | perl -laF/:/ -e 'print (($F[0] << 16) + $F[1])'
  • To go from decimal to 2 16 bit:echo 5280984 | perl -ne 'printf "%03d:%05d\n", $_ >> 16, $_ & 0xFFFF'
  • Decimal to hex: echo 5280984 | perl -nle 'printf "0x%X\n", $_'

New Keypad

Since April 2020 adding new keys and changing the status of existing ones is handled through a remote interface on McClellan.

Debugging new keys

mosquitto_sub -h -v -t "#" | grep door

  • The current door code doesn't acknowledge new keys, so you're just looking to be sure the door is online.
  • Then test the key, and see if it says unknown user or not.
  • I *think* a key that is not programmed will act differently than a wrong pin but I'm not 100% sure if that's the current door firmware or mainline esp-rfid.

Adding a new key

1. SSH into mcclellan

Look at the help: /opt/door-management/ -h

You're actually going to run something like /opt/door-management/ add <key> <name> <pin>

Please remember that if the name has a space to quote it so it's not two separate arguments.

Talk to Mtfurlan (talk) 19:48, 12 July 2022 (EDT)

Removing a key

Not currently supported, sorry.