I was going to replace the door to my office / workshop / lab. They’re outside doors. I definitely want an electric lock and RFID reader. I open these doors many times a day.
For prototype I used:
Arduino Mega (Uno is also applicable)
Ethernet Shield W5100
RFID Reader RC522
https://github.com/wutu/pimatic-mqtt
Wiring: https://github.com/miguelbalboa/rfid#pin-layout
Sketch: https://gist.github.com/wutu/387bfeb40890d33659044629ffb216dd
Add device to Pimatic:
{
"attributes": [
{
"name": "UID",
"topic": "mh/gf/tech/lab/plc/rfid/uid",
"type": "string",
"messageMap": {},
"acronym": "UID"
}
],
"xAttributeOptions": [],
"id": "rc522-rfid-reader",
"name": "RC522 RFID Reader",
"class": "MqttSensor"
}
Then just add a rule which controls actuators (lock, relay etc.).
{
"id": "door-unlock",
"name": "Door unlock",
"rule": "when $rc522-rfid-reader.UID changes and $rc522-rfid-reader.UID = \"s3c78tdh\" or $rc522-rfid-reader.UID = \"cb634xs5\" then log \"unlock door\"",
"active": true,
"logging": true
}
Sketch has a button (internal opening?) and LED. I do not use them, for now.
P.S. It’s odd that my reader only works if I have do not wiring the power. (3.3V). Suddenly it works