Skip to content

nygma2004/RFID_Wiegand_MQTT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RFID Access Control

This ESP8266 sketch communicates with a Wiegand RFID reader and keypad. Ket features:

  • Connect ot local MQTT server
  • Send RFID, iButton codes over to MQTT
  • Collect keypad presses and until # is pressed and send as a pin code over MQTT
  • Block RFID, iButton readings and pin code entries too close to each other
  • Neopixel LED provides visual feedback which is controller over MQTT
  • Read ibutton keycards using a ibutton (one wire) reader
  • Use A0 input as a digital input (e.g. state of the gate, garage door)
  • 4 relay outputs to control gates, garage doors, lights, etc.

Prototype Project

You don't necessarily have to use the RFID and the iButton reader, you can choose which one you like better. The RFID reader communicates using the Wiegand protocol therefore other readers would be usable as well (only tested with this model).

Hardware

This sketch uses a ESP8266, NodeMCU or Wemos D1 Mini.

Wiring

ESP GPIO ESP PIN Weigand Reader NeoPixel iButton reader 4CH Relay board
12 D6 green (D0)
13 D7 white (D1)
GND black GND Yellow, Black GND
5V 5V Vcc
14 D5 DataIn
16 D0 IN1
5 D1 IN2
0 D3 IN3
2 D4 IN4
4 D2 Red

Besides this the Weigand reader also need a +12V DC supply connected to the red wire.

Overall project design

This is my first video on the project, which explains how the Arduino sketch and the Node-Red flow works:

Project explanation

My follow-up video with the final PCB design:

PCB prototype

Security Considerations

Keep in mind that the RFID readers that I got for this RFID reader and rewriteable RFID tags. So this does not prevent somebody getting hold of your tags and making a copy. Therefore I would recommend to include additional security measure in your overall solution. I am definitely going to add a camera watching the area where the reader is, so I can get an image when somebody uses the reader. And definitely control devices that would not anyone to get into the house (e.g. open the passanger gate, or car gate, but not disable the alarm or open the garage door). But this is up to you, just keep the security limitations in mind.

Node-Red Functions

This device is designed to be used with a Home Automation system in a background. I intentionally left the ESP code simple, just to collect data and pass it own. I wanted to control the access on the logic in the background, so even if somebody gains access to the ESP the logic on the EPS is not controlling access on the system. Of course this is still not a high security solution. Some of the key features of the Node-Red flow

  • Storing user and user accesses: RFIDs, iButton codes and PINs. Users can identify themselves with either RFID, iButton or PIN code.
  • Access control check is the user is blocked or not, restricted in day of the week or time of the date against the current date and time: user can be restricred to certain days, or time of the day
  • Users can have 2 factor identification (actually two identification steps) where the user need RFID and PIN code as well
  • Solution can also idetify events, which is similar to users: multiple IDs, days of week and time restriction, but the event can also request a user identification when the user after entering the PIN/RFID for the event also needs to enter his PIN/RFID and the user access level is checked against system's access level.
  • Access logging with success identifications and also errors/failed identification
  • Access log reports

Node-Red flow can be downloaded here: https://flows.nodered.org/flow/2f9c31009af651823796c4a97a8dfda4

NeoPixel light

I am using a single pixel neopixel LED (WS2812B) to provide visual status. This can blink in different patterns: long green when code accepted, 2 red blinks when rejected, and 3 yellow blinks when 2 factor authentication required. These light patterns are sent from Node-Red to the topicLight topic. And the payload has to be in this format: {"color1":"red","color2":"black","blink1":500,"blink2":500,"duration":2000}, this will make the neopixel to blink for 2000 (duration) miliseconds, alternating between red (color1) and black/off (color2), with red for 500 miliseconds (blink1) and black/off for 500 miliseconds (blink2). Accepted colors are coded in function SetLEDColor, currently only black, yellow, red, green, blue supported.

Relay outputs

The code supports 4 relay outputs, which can be controlled topicRelay1, topicRelay2, topicRelay3, topicRelay4 topics. These accept 0 or 1 in the payload. Relay output 1 and 2 also supports a pulse mode (short on pulse) to control garage doors, gates, etc. This is activated by topicPulse1 and topicPulse2 topic, by sending 1 in the payload.

Input

The input works are a digital input and changed to the state is posted to the topicInput topic, with payload either 0 or 1. I am planning to use this as a feedback if the garage or gate is open or not.

PCB

I designed a PCB which is available on my PCBWay Project Page: https://www.pcbway.com/project/shareproject/RFID__iButton_MQTT_Access_Control.html

PCB

PCB

PCB

Please watch my second video (see above) which explains the how you wire the different components to the PCB.

PCB schematic: https://github.com/nygma2004/RFID_Wiegand_MQTT/blob/main/pcb/Schematic_RFID_2021-03-26.pdf

About

RFID Wiegand MQTT Access

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages