Skip to main content

HiveMind NFC reader client

Project description

HiveMind NFC Sign-In Client

The NFC client software allows users to sign in to a cabinet using NFC cards.

This uses two Raspberry Pi Zero W systems, each with buttons and lights and a USB NFC card reader. One of these also connects to the cabinet via Ethernet and runs the stats client.

Hardware

Wiring

  • See https://pinout.xyz/pinout/io_pi_zero for the pin configuration. You will need to connect 12 wires - one power, one ground, and ten GPIO.
  • Lights should be connected from a GPIO pin to ground.
  • Buttons should be connected from a GPIO pin to power.
  • Make note of the pin number of each GPIO pin used. You will need the "Physical/Board" pin number (1-40).
  • Do not use pins 27 and 28. These are reserved.

Operating System Installation

  • On one Raspberry Pi, follow the Client Setup instructions. This one will use the Ethernet adapter and connect to the cabinet itself.
  • On the other system, follow the instructions in the Installing Raspberry Pi OS and Wireless Network Configuration sections.

Software Installation

sudo apt install python3-pip python3-venv libnfc-dev
python3 -m venv ~/nfc-client/venv
~/nfc-client/venv/bin/pip3 install nfcpy websocket-client requests RPi.GPIO

sudo tee /etc/udev/rules.d/50-usb-perms.rules <<EOF
SUBSYSTEM=="usb", ATTRS{idVendor}=="072f", ATTRS{idProduct}=="2200", GROUP="plugdev", MODE="0660"
EOF

sudo gpasswd -a pi plugdev
sudo gpasswd -a pi gpio
  • You may need to replace the values for ATTRS{idVendor} and ATTRS{idProduct} if using a different card reader. Check the output of lsusb.
  • todo: get client from pypi

Configuration File

In your home directory, create a file called nfc-config.json. Example contents:

{
    "pin_config": [
        { "player_id": 4, "button": 36, "light": 18 },
        { "player_id": 6, "button": 32, "light": 16 },
        { "player_id": 2, "button": 26, "light": 12 },
        { "player_id": 8, "button": 24, "light": 10 },
        { "player_id": 10, "button": 22, "light": 8 }
    ],
    "scene": "<scene name>",
    "cabinet": "<cabinet name>",
    "token": "<token>",
    "reader": "blue",
    "usb_device": "usb:072f:2200"
}
  • token is on the HiveMind admin page and is the same value used by the stats client's config file.
  • usb_device is the vendor and product ID of the card reader from the previous section.
  • reader is blue or gold.
  • pin_config should contain one entry per player station:
    • player_id is the ID of the station - for example, 2 is Blue Queen. From left to right, these are 4, 6, 2, 8, 10 on the blue side, and 3, 5, 1, 7, 9 on the gold side.
    • button and light are the pin numbers associated with the button and light for this station.

Run the Client

sudo tee /etc/systemd/system/hivemind-nfc-reader.service <<EOF
[Unit]
Description=HiveMind NFC Reader Service

[Service]
ExecStart=/home/pi/nfc-client/venv/bin/python3 /home/pi/nfc-client/client.py /home/pi/nfc-config.json
User=pi

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl start hivemind-nfc-reader
sudo systemctl enable hivemind-nfc-reader

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hivemind-nfc-reader-0.0.1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

hivemind_nfc_reader-0.0.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file hivemind-nfc-reader-0.0.1.tar.gz.

File metadata

  • Download URL: hivemind-nfc-reader-0.0.1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for hivemind-nfc-reader-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5df3d59855712af8f4bec78cb8156f7d0b546ecc2705a83c30ed2887cf0df18d
MD5 3efad23503101e669e05d6a155367b63
BLAKE2b-256 f2a3c7f3d116f9079b8bfb6231322eedb2e8faa1acc25cccac889652113104d6

See more details on using hashes here.

File details

Details for the file hivemind_nfc_reader-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: hivemind_nfc_reader-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for hivemind_nfc_reader-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa97611ee7eacc44f8b057dcfd5306fb39e9596e429ce4294ffeff09c1cc5f9e
MD5 c2ff3b157fbde75ef2ca4a3166bf47fe
BLAKE2b-256 f291775bf83d0b6a2a09937df7869a75f0ea33c56bb288cbe6a9fd9a3259f164

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page