The system includes a full access control system from Amazon including a motion detector, manual exit button, magnetic lock, power supply, and a keypad/rfid reader but we also added our own relay switch and a raspberry pi to handle all of the processing. The system can work on it's own if the internet goes down, but mainly works as a connected IoT system. The keypad reader can be put into a reader mode, which bypasses it's internal processor and outputs a Wiegand 26 signal via two data lines to the raspberry pi, where it authenticates users based on an access key lookup table.
The keypad has two modes: Standalone and Reader. In standalone the keypad uses it’s own microcontroller to determine whether it should trigger it’s internal relay to open the door. In reader mode it sends data via two pins using the wiegand 26 protocol. Wiegand 26 is a common format for most access control systems. Data is sent on the low edge of a signal. When the signal is LOW, D0 sends a ‘0’ and D1 sends a ‘1’. When no data is being sent, both lines are pulled HIGH (usually 5v). The format consists of a leading parity bit, 8 bits of a facility code, 16 bits of ID code, and a trailing parity bit. The leading parity bit is calculated from the first 12 bits of data, and the trailing parity bit is calculated from the last 12 bits of data. There are many libraries and code examples available for the Wiegand 26 format, including python, C, arduino, and more. However there were no Java examples, and since Android Things runs Android, I had to implement my own which can be found here.
The system also has an Android Application used for managing access keys, creating pins, provisioning rfid cards, selecting boom music, and more.
Using the Spotify Web API, users can select a 30 second clip of a track that plays every time they walk in the door.