Difference between revisions of "Doorbot"
m (→UR HID RFID Fobs) |
Brainsmoke (talk | contribs) m (→New Keypad) |
||
(64 intermediate revisions by 10 users not shown) | |||
Line 1: | Line 1: | ||
{{Project | {{Project | ||
− | + | |ProjectStatus=Finished | |
− | |ProjectStatus= | + | |ProjectNiche=Mechanics |
− | |ProjectNiche= | ||
|ProjectPurpose=Infrastructure | |ProjectPurpose=Infrastructure | ||
}} | }} | ||
− | + | ==Usage== | |
+ | [[File:Doorbot instructions.svg|thumb]] | ||
+ | === Entering the space: (normally) === | ||
− | + | # scan your fob | |
+ | # enter your pin | ||
+ | # press the bell button | ||
− | = | + | === Opening the door when in Open mode (RFID Reader LED is green) === |
− | |||
− | + | # press bell | |
+ | === Changing your pin: === | ||
− | '' | + | # scan your fob |
− | + | # enter 999 | |
− | + | # press bell | |
+ | # enter your current pin | ||
+ | # press bell | ||
+ | # <b>wait for the doorbot to make the the 'success' double beep</b> | ||
+ | # enter your new pin (min 4 characters) | ||
+ | # press bell | ||
+ | # repeat new pin | ||
+ | # press bell | ||
+ | === Resetting your pin when you have forgotten: === | ||
− | + | # Ask a doorbot maintainer (brainsmoke for now) to trigger a pin reset | |
+ | # scan your fob | ||
+ | # enter your new pin (min 4 characters) | ||
+ | # press bell | ||
+ | # repeat new pin | ||
+ | # press bell | ||
− | + | === Add a fob: === | |
− | + | # Trick a doorbot maintainer into starting an addkey procedure | |
+ | # scan your fob | ||
+ | # enter your new pin (min 4 characters) | ||
+ | # press bell | ||
+ | # repeat new pin | ||
+ | # press bell | ||
− | + | ==Administration== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | = | + | ===doorbot shell (doorsh.py)=== |
− | + | ssh doorbot@doorbot | |
− | + | Administration: | |
− | + | doorbot> list | |
+ | doorbot> enable <fobid> | ||
+ | doorbot> disable <fobid> | ||
+ | doorbot> delete <fobid> | ||
+ | doorbot> addkey # add key using key reader + pinpad | ||
+ | doorbot> addkey <fobid> <pin> # add key using doorbot shell only | ||
+ | doorbot> resetpin # reset pin using reader + pinpad | ||
+ | doorbot> resetpin <fobid> <pin> # reset pin using shell | ||
+ | doorbot> authmode # put doorbot in authentication mode (default at startup) | ||
+ | doorbot> openmode # put doorbot in open mode | ||
− | + | ===doorctl.py=== | |
− | + | ||
− | + | python doorctl.py initdb | |
+ | |||
+ | # import fob db using plain-text pin | ||
+ | # rfid authorised pin | ||
+ | python doorctl.py import-plain << EOF | ||
+ | 5431553 1 12345 | ||
+ | 5431554 1 12345 | ||
+ | 5431555 1 12345 | ||
+ | 5431556 1 12345 | ||
+ | EOF | ||
+ | |||
+ | python doorctl.py export # export fob db | ||
+ | |||
+ | python doorctl.py import # import fob db | ||
+ | |||
+ | python doorctl.py rfidlisten # print fob IDs of fobs being scanned | ||
+ | |||
+ | ==Design== | ||
+ | |||
+ | |||
+ | 5V 2A | ||
+ | _____||_____ [door sensor] 5V ___12V____ | ||
+ | | | | || | | | ||
+ | | |--usb--[Lock arduino]--opto--[relay] [door lock] | ||
+ | | Cubieboard | |__________| | ||
+ | | |--usb--[Auth arduino] | ||
+ | |____________| | | | ||
+ | | [HID reader] [keypad] | ||
+ | Earth | ||
+ | (for keypad) | ||
+ | |||
+ | ==Hardware== | ||
+ | |||
+ | ==Software== | ||
+ | |||
+ | === Cubieboard === | ||
+ | |||
+ | ==== udev persistence rules ==== | ||
+ | |||
+ | To get identifiable arributes: | ||
+ | |||
+ | udevadm info -p /class/tty/ttyUSB0 -a | ||
+ | |||
+ | |||
+ | SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="XXXXXXXX", SYMLINK+="ttyAUTH" | ||
+ | SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="XXXXXXXX", SYMLINK+="ttyLOCK" | ||
+ | |||
+ | |||
+ | ==== doorbotd.py / doorctl.py / doorsh.py ==== | ||
+ | |||
+ | https://github.com/techinc/doorbot | ||
+ | |||
+ | === Authentication arduino === | ||
+ | |||
+ | ==== source ==== | ||
+ | |||
+ | https://github.com/techinc/doorbot/blob/master/doorauth/doorauth.ino | ||
+ | |||
+ | ==== protocol ==== | ||
+ | |||
+ | Serial, 9600 baud | ||
+ | |||
+ | send: | ||
+ | |||
+ | LED ON\n | ||
+ | LED OFF\n | ||
+ | LED BLINK\n | ||
+ | BEEP\n (short beep) | ||
+ | DENIED\n (distorted sound) | ||
+ | GRANTED\n (double short beep) | ||
+ | |||
+ | receive: | ||
+ | |||
+ | RESET\n (arduino has reset) | ||
+ | KEY [0-9]\n (keypad press) | ||
+ | RFID [01]*\n (rfid scanned) | ||
+ | |||
+ | === Lock arduino === | ||
+ | |||
+ | ==== source ==== | ||
+ | |||
+ | https://github.com/techinc/doorbot/blob/master/doorlock/doorlock.ino | ||
+ | |||
+ | ==== protocol ==== | ||
+ | |||
+ | Serial, 9600 baud | ||
+ | |||
+ | send: | ||
+ | |||
+ | UNLOCK\n | ||
+ | LOCK\n | ||
+ | |||
+ | receive: | ||
+ | |||
+ | RESET\n (arduino has reset) | ||
+ | OPEN\n (door has opened) | ||
+ | CLOSED\n (door has closed) | ||
+ | |||
+ | === New Keypad === | ||
+ | [[File:mechpad1.jpg|thumb]] | ||
+ | |||
+ | Project page: [[mechpad]] | ||
+ | |||
+ | Serial, 9600 baud | ||
+ | |||
+ | keypad -> arduino | ||
+ | [0123456789CB] (keypresses) | ||
+ | [XYZW] (unused buttons to the right) | ||
+ | |||
+ | arduino -> keypad: | ||
+ | |||
+ | R (red swirl) | ||
+ | G (green swirl) | ||
+ | B (blue swirl) | ||
+ | S (sleep animation) | ||
+ | P (party mode / color wheel swirl) | ||
+ | |||
+ | ==== source ==== | ||
+ | |||
+ | https://github.com/techinc/mechpad | ||
+ | |||
+ | === Old Keypad === | ||
+ | |||
+ | The old keypad was replaced due to glitching :-( | ||
+ | Project page: [[matrixpad]] | ||
+ | |||
+ | ==== source ==== | ||
+ | |||
+ | https://github.com/techinc/matrixpad | ||
+ | |||
+ | === Temp. replacement keypad === | ||
+ | |||
+ | the new keypad code is: | ||
+ | made by beatskip, will post a schematic later this week | ||
+ | |||
+ | <pre> | ||
+ | #include <Arduino.h> | ||
+ | #include <Wire.h> | ||
+ | #include <Adafruit_TCA8418.h> | ||
+ | |||
+ | #define I2C_SDA 19 | ||
+ | #define I2C_SCL 18 | ||
+ | |||
+ | Adafruit_TCA8418 keypad; | ||
+ | |||
+ | #define ROWS 4 | ||
+ | #define COLS 3 | ||
+ | |||
+ | char keymap[COLS][ROWS] = {{'1', '4', '7', 'C'}, | ||
+ | {'2', '5', '8', '0'}, | ||
+ | {'3', '6', '9', 'B'}}; | ||
+ | |||
+ | void setup() { | ||
+ | Serial.begin(9600); | ||
+ | pinMode(10, OUTPUT); | ||
+ | pinMode(7, OUTPUT); | ||
+ | digitalWrite(10, HIGH); | ||
+ | digitalWrite(7, HIGH); | ||
+ | Wire.begin(I2C_SDA, I2C_SCL); | ||
+ | //run_i2c_scanner(); | ||
+ | |||
+ | |||
+ | if (! keypad.begin(TCA8418_DEFAULT_ADDR, &Wire)) { | ||
+ | Serial.println("keypad not found, check wiring & pullups!"); | ||
+ | while (1); | ||
+ | } | ||
+ | |||
+ | // configure the size of the keypad matrix. | ||
+ | // all other pins will be inputs | ||
+ | keypad.matrix(ROWS, COLS); | ||
+ | |||
+ | // flush the internal buffer | ||
+ | keypad.flush(); | ||
+ | Serial.println(); | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | void loop() | ||
+ | { | ||
+ | |||
+ | if (keypad.available() > 0) | ||
+ | { | ||
+ | // datasheet page 15 - Table 1 | ||
+ | int k = keypad.getEvent(); | ||
+ | bool pressed = k & 0x80; | ||
+ | k &= 0x7F; | ||
+ | k--; | ||
+ | uint8_t row = k / 10; | ||
+ | uint8_t col = k % 10; | ||
+ | |||
+ | if (pressed) | ||
+ | Serial.write(keymap[col][row]); | ||
+ | |||
+ | |||
+ | } | ||
+ | } | ||
+ | </pre> |
Latest revision as of 20:12, 15 December 2023
Projects | |
---|---|
Participants | Brainsmoke |
Skills | |
Status | Finished |
Niche | Mechanics |
Purpose | Infrastructure |
Contents
Usage
Entering the space: (normally)
- scan your fob
- enter your pin
- press the bell button
Opening the door when in Open mode (RFID Reader LED is green)
- press bell
Changing your pin:
- scan your fob
- enter 999
- press bell
- enter your current pin
- press bell
- wait for the doorbot to make the the 'success' double beep
- enter your new pin (min 4 characters)
- press bell
- repeat new pin
- press bell
Resetting your pin when you have forgotten:
- Ask a doorbot maintainer (brainsmoke for now) to trigger a pin reset
- scan your fob
- enter your new pin (min 4 characters)
- press bell
- repeat new pin
- press bell
Add a fob:
- Trick a doorbot maintainer into starting an addkey procedure
- scan your fob
- enter your new pin (min 4 characters)
- press bell
- repeat new pin
- press bell
Administration
doorbot shell (doorsh.py)
ssh doorbot@doorbot
Administration:
doorbot> list doorbot> enable <fobid> doorbot> disable <fobid> doorbot> delete <fobid> doorbot> addkey # add key using key reader + pinpad doorbot> addkey <fobid> <pin> # add key using doorbot shell only doorbot> resetpin # reset pin using reader + pinpad doorbot> resetpin <fobid> <pin> # reset pin using shell doorbot> authmode # put doorbot in authentication mode (default at startup) doorbot> openmode # put doorbot in open mode
doorctl.py
python doorctl.py initdb # import fob db using plain-text pin # rfid authorised pin python doorctl.py import-plain << EOF 5431553 1 12345 5431554 1 12345 5431555 1 12345 5431556 1 12345 EOF python doorctl.py export # export fob db python doorctl.py import # import fob db python doorctl.py rfidlisten # print fob IDs of fobs being scanned
Design
5V 2A _____||_____ [door sensor] 5V ___12V____ | | | || | | | |--usb--[Lock arduino]--opto--[relay] [door lock] | Cubieboard | |__________| | |--usb--[Auth arduino] |____________| | | | [HID reader] [keypad] Earth (for keypad)
Hardware
Software
Cubieboard
udev persistence rules
To get identifiable arributes:
udevadm info -p /class/tty/ttyUSB0 -a
SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="XXXXXXXX", SYMLINK+="ttyAUTH" SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="XXXXXXXX", SYMLINK+="ttyLOCK"
doorbotd.py / doorctl.py / doorsh.py
https://github.com/techinc/doorbot
Authentication arduino
source
https://github.com/techinc/doorbot/blob/master/doorauth/doorauth.ino
protocol
Serial, 9600 baud send: LED ON\n LED OFF\n LED BLINK\n BEEP\n (short beep) DENIED\n (distorted sound) GRANTED\n (double short beep) receive: RESET\n (arduino has reset) KEY [0-9]\n (keypad press) RFID [01]*\n (rfid scanned)
Lock arduino
source
https://github.com/techinc/doorbot/blob/master/doorlock/doorlock.ino
protocol
Serial, 9600 baud send: UNLOCK\n LOCK\n receive: RESET\n (arduino has reset) OPEN\n (door has opened) CLOSED\n (door has closed)
New Keypad
Project page: mechpad
Serial, 9600 baud keypad -> arduino [0123456789CB] (keypresses) [XYZW] (unused buttons to the right) arduino -> keypad: R (red swirl) G (green swirl) B (blue swirl) S (sleep animation) P (party mode / color wheel swirl)
source
https://github.com/techinc/mechpad
Old Keypad
The old keypad was replaced due to glitching :-( Project page: matrixpad
source
https://github.com/techinc/matrixpad
Temp. replacement keypad
the new keypad code is: made by beatskip, will post a schematic later this week
#include <Arduino.h> #include <Wire.h> #include <Adafruit_TCA8418.h> #define I2C_SDA 19 #define I2C_SCL 18 Adafruit_TCA8418 keypad; #define ROWS 4 #define COLS 3 char keymap[COLS][ROWS] = {{'1', '4', '7', 'C'}, {'2', '5', '8', '0'}, {'3', '6', '9', 'B'}}; void setup() { Serial.begin(9600); pinMode(10, OUTPUT); pinMode(7, OUTPUT); digitalWrite(10, HIGH); digitalWrite(7, HIGH); Wire.begin(I2C_SDA, I2C_SCL); //run_i2c_scanner(); if (! keypad.begin(TCA8418_DEFAULT_ADDR, &Wire)) { Serial.println("keypad not found, check wiring & pullups!"); while (1); } // configure the size of the keypad matrix. // all other pins will be inputs keypad.matrix(ROWS, COLS); // flush the internal buffer keypad.flush(); Serial.println(); } void loop() { if (keypad.available() > 0) { // datasheet page 15 - Table 1 int k = keypad.getEvent(); bool pressed = k & 0x80; k &= 0x7F; k--; uint8_t row = k / 10; uint8_t col = k % 10; if (pressed) Serial.write(keymap[col][row]); } }