{"id":21009717,"url":"https://github.com/lily-osp/rfid-access-control-system","last_synced_at":"2026-05-19T00:42:43.365Z","repository":{"id":112728646,"uuid":"536216145","full_name":"lily-osp/RFID-Access-Control-System","owner":"lily-osp","description":"This project is just one of many examples of how we can apply the use of google theachable machine.","archived":false,"fork":false,"pushed_at":"2023-10-10T15:46:42.000Z","size":19100,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-20T11:11:54.291Z","etag":null,"topics":["access-control","arduino","automation","computer-vision","nfc","rfid","security"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lily-osp.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-13T16:32:38.000Z","updated_at":"2024-08-21T11:01:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"3f99edca-cea0-4631-a0ec-0f8bbd5bb43b","html_url":"https://github.com/lily-osp/RFID-Access-Control-System","commit_stats":null,"previous_names":["lily-osp/rfid-access-control-system"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2FRFID-Access-Control-System","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2FRFID-Access-Control-System/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2FRFID-Access-Control-System/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2FRFID-Access-Control-System/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lily-osp","download_url":"https://codeload.github.com/lily-osp/RFID-Access-Control-System/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243431465,"owners_count":20289897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["access-control","arduino","automation","computer-vision","nfc","rfid","security"],"created_at":"2024-11-19T09:17:41.247Z","updated_at":"2026-05-19T00:42:43.328Z","avatar_url":"https://github.com/lily-osp.png","language":"C++","funding_links":["https://www.buymeacoffee.com/azzar"],"categories":[],"sub_categories":[],"readme":"# RFID Access Control System with additional outputs\n\nThis code uses an Arduino board, an RFID reader (MFRC522), and several components (LEDs, a relay, and an input switch) to control access to a certain area or device. The code reads the unique ID of an RFID tag and compares it to a pre-authorized tag. If the ID matches, access is granted and a green LED lights up, the relay turns on and the blue LED turns on. If the ID does not match, access is denied and the green LED remains off, the relay remains off and the blue LED remains off. Additionally, the code also reads the state of an input switch. If the switch is high, access is granted and the LEDs and relay will turn on. If the switch is low, access is denied and the LEDs and relay will remain off. The access control can be triggered by sending commands through the serial monitor.\n\ntranslation:\n- [indonesian](https://github.com/1999AZZAR/RFID-Access-Control-System/blob/master/readme_id.md)\n\n## Hardware\n\n- Arduino board (e.g. Uno, Mega, Nano)\n- MFRC522 RFID reader\n- RFID tags\n- Green LED\n- Red LED\n- Blue LED\n- Relay\n- Input switch\n- Jumper wires\n\n## Pin connections\n\n|MFRC522|Arduino|\n|-------|-------|\n|SDA    |10     |\n|SCK    |13     |\n|MOSI   |11     |\n|MISO   |12     |\n|IRQ    |not connected|\n|GND    |GND    |\n|RST    |9      |\n|3.3V   |3.3V   |\n\n|LED    |Arduino|\n|-------|-------|\n|Green   |2      |\n|Red |3      |\n|Relay |4     |\n|Input switch |5     |\n|Blue |6      |\n\n## Setting up the code\n\n1. Install the MFRC522 library in the Arduino IDE (Sketch \u003e Include Library \u003e MFRC522)\n2. Connect the RFID reader, LEDs, relay and input switch to the Arduino board according to the pin connections described above.\n3. Upload the code to the Arduino board.\n4. Open the serial monitor (Tools \u003e Serial Monitor) and set it to \"Newline\" and \"9600 baud\"\n5. Place an RFID tag on the reader, the tag's unique ID should be displayed in the serial monitor.\n6. In the code, update the content.substring(1) == \"99 46 87 8D\" line with the UID of the RFID tag you want to give access.\n7. Save the changes and upload the code to the Arduino board.\n8. Send the command \"1\" to the serial monitor to trigger the access control.\n9. Send the command \"2\" to the serial monitor to deny access.\n10. Send the command \"3\" to the serial monitor to turn off all the outputs.\n\n## Testing the code\n\n1. Put the authorized RFID tag on the reader, the input switch is high, then send the command \"1\" to the serial monitor. The green LED should turn on, the red LED should turn off, the relay should turn on and the blue LED should turn on for 3.5 seconds.\n2. Put the authorized RFID tag on the reader, the input switch is low, then send the command \"1\" to the serial monitor. The green LED should turn on, the red LED should turn on, the relay should turn off and the blue LED should turn off for 0.5 seconds.\n3. Put a non-authorized RFID tag on the reader, the input switch is high, then send the command \"1\" to the serial monitor. The green LED should turn on, the red LED should turn on, the relay should turn off and the blue LED should turn off for 0.5 seconds.\n4. Put a non-authorized RFID tag on the reader, the input switch is low, then send the command \"1\" to the serial monitor. The green LED should turn off, the red LED should turn on, the relay should turn off and the blue LED should turn off for 0.5 seconds.\n5. Send the command \"2\" to the serial monitor. The green LED should turn off, the red LED should turn on, the relay should turn off and the blue LED should turn off for 0.5 seconds.\n6. Send the command \"3\" to the serial monitor. All the outputs should turn off.\n\n## Note\n\n- You can add more RFID tags by adding more `else if` statements in the code and comparing their UIDs with the tag being read.\n- The delay times for access granted and denied can be adjusted to your desired duration.\n- The input switch can be replaced by any other input device that can be connected to the arduino like a button, a RFID reader, or a PIR sensor\n\n## Support\n\nYou can support me by buy me a coffee if u like to.\n\n\u003cdiv align=\"left\"\u003e\n\u003c!--   \u003ch4\u003eAnd you can also support me by \u003ca href=\"https://www.buymeacoffee.com/azzar\" target=\"_blank\"\u003ebuying me coffee\u003c/a\u003e\u003c/h4\u003e --\u003e\n  \u003ca href=\"https://www.buymeacoffee.com/azzar\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"height: 42px !important;width: 151.9px !important; margin-top: 50px !important;\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n## Additional use case\n\nThis project is just one of many examples of how we can apply the use of [google theachable machine](https://teachablemachine.withgoogle.com/). To use the project you can:\n\n1. flash the arduino 1 with first program\n2. flast the 2nd arduino with second program\n3. connect the 2nd arduino to the pc/laptop\n4. open [p5 serial control program](https://github.com/p5-serial/p5.serialcontrol/releases)\n5. connect to arduino serial pin\n6. open [p5.js web editor](https://editor.p5js.org/1999AZZAR/sketches/Te50F4Q3-)\n7. edit the serial port in p5.js web editor so it's now same with in p5 serial control\n8. run the p5.js web editor\n\n## Flowchart\n\n```mermaid\ngraph TD\nsubgraph device 1\nA1[Start Device 1] --\u003e B1[Setup Device 1]\nB1 --\u003e C1{New Card?}\nC1 -- No --\u003e B1\nC1 -- Yes --\u003e D1{Read Card}\nD1 -- Success --\u003e E1[Print UID]\nE1 --\u003e F1[Check Access]\nF1 -- Allowed --\u003e G1[Access Granted]\nG1 --\u003e H1{Continue?}\nH1 -- Yes --\u003e C1\nH1 -- No --\u003e I1[End Device 1]\nF1 -- Denied --\u003e J1[Access Denied]\nJ1 --\u003e H1\nG1 --\u003e K1[Set incontrol val]\nJ1 --\u003e K1\nend\nsubgraph device 2\nA2[Start Device 2] --\u003e B2[Setup Device 2]\nB2 --\u003e C2{Serial Available?}\nC2 -- No --\u003e G2[Delay]\nC2 -- Yes --\u003e D2[Read Serial]\nD2 --\u003e E2{Result}\nE2 -- '1' --\u003e F2{incontrol == HIGH?}\nF2 -- Yes --\u003e K2[Access Granted]\nK2 --\u003e G2[Delay]\nF2 -- No --\u003e L[Access Denied]\nL --\u003e G2[Delay]\nE2 -- '2' --\u003e H2{incontrol == HIGH?}\nH2 -- Yes --\u003e I2[Access Denied]\nI2 --\u003e G2[Delay]\nH2 -- No --\u003e J2[Access Denied]\nJ2 --\u003e G2[Delay]\nE2 -- '3' --\u003e M{incontrol == HIGH?}\nM -- Yes --\u003e N[Access Denied]\nN --\u003e G2[Delay]\nM -- No --\u003e O[Access Denied]\nO --\u003e G2[Delay]\nG2 --\u003e C2\nG2 --\u003e P[End Device 2]\n\nK1 --\u003e F2\nK1 --\u003e H2\nK1 --\u003e M\nend\n```\n\n## Gallery\n\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003c!-- Image Grid Gallery --\u003e\n\u003cdiv class=\"grid-gallery\" style=\"display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 5px; justify-items: center;\"\u003e\n\n\u003c!-- Image 1 --\u003e\n\u003cdiv\u003e\n  \u003cimg src=\"https://github.com/1999AZZAR/RFID-Access-Control-System/raw/master/pic/Slide1.jpg\" alt=\"Image 1\" style=\"height: 300px;\"\u003e\n\u003c/div\u003e\n\n\u003c!-- Image 2 --\u003e\n\u003cdiv\u003e\n  \u003cimg src=\"https://github.com/1999AZZAR/RFID-Access-Control-System/raw/master/pic/Slide2.jpg\" alt=\"Image 2\" style=\"height: 300px;\"\u003e\n\u003c/div\u003e\n\n\u003c!-- Image 3 --\u003e\n\u003cdiv\u003e\n  \u003cimg src=\"https://github.com/1999AZZAR/RFID-Access-Control-System/raw/master/pic/Slide3.jpg\" alt=\"Image 3\" style=\"height: 300px;\"\u003e\n\u003c/div\u003e\n\n\u003c!-- Image 4 --\u003e\n\u003cdiv\u003e\n  \u003cimg src=\"https://github.com/1999AZZAR/RFID-Access-Control-System/raw/master/pic/Slide4.jpg\" alt=\"Image 4\" style=\"height: 300px;\"\u003e\n\u003c/div\u003e\n\n\u003c!-- Image 5 --\u003e\n\u003cdiv\u003e\n  \u003cimg src=\"https://github.com/1999AZZAR/RFID-Access-Control-System/raw/master/pic/Slide5.jpg\" alt=\"Image 5\" style=\"height: 300px;\"\u003e\n\u003c/div\u003e\n\n\u003c!-- Image 6 --\u003e\n\u003cdiv\u003e\n  \u003cimg src=\"https://github.com/1999AZZAR/RFID-Access-Control-System/raw/master/pic/Slide6.jpg\" alt=\"Image 6\" style=\"height: 300px;\"\u003e\n\u003c/div\u003e\n\n\u003c!-- Image 7 --\u003e\n\u003cdiv\u003e\n  \u003cimg src=\"https://github.com/1999AZZAR/RFID-Access-Control-System/raw/master/pic/Slide7.jpg\" alt=\"Image 7\" style=\"height: 300px;\"\u003e\n\u003c/div\u003e\n\n\u003c!-- Image 8 --\u003e\n\u003cdiv\u003e\n  \u003cimg src=\"https://github.com/1999AZZAR/RFID-Access-Control-System/raw/master/pic/Slide8.jpg\" alt=\"Image 8\" style=\"height: 300px;\"\u003e\n\u003c/div\u003e\n\n\u003c!-- Image 9 --\u003e\n\u003cdiv\u003e\n  \u003cimg src=\"https://github.com/1999AZZAR/RFID-Access-Control-System/raw/master/pic/Slide9.jpg\" alt=\"Image 9\" style=\"height: 300px;\"\u003e\n\u003c/div\u003e\n\n\u003c!-- Image 10 --\u003e\n\u003cdiv\u003e\n  \u003cimg src=\"https://github.com/1999AZZAR/RFID-Access-Control-System/raw/master/pic/Slide10.jpeg\" alt=\"Image 10\" style=\"height: 300px;\"\u003e\n\u003c/div\u003e\n\n\u003c!-- Image 11 --\u003e\n\u003cdiv\u003e\n  \u003cimg src=\"https://github.com/1999AZZAR/RFID-Access-Control-System/raw/master/pic/Slide11.jpeg\" alt=\"Image 11\" style=\"height: 300px;\"\u003e\n\u003c/div\u003e\n\n\u003c!-- Image 12 --\u003e\n\u003cdiv\u003e\n  \u003cimg src=\"https://github.com/1999AZZAR/RFID-Access-Control-System/raw/master/pic/Slide12.jpeg\" alt=\"Image 12\" style=\"height: 300px;\"\u003e\n\u003c/div\u003e\n\n\u003c/div\u003e\n\u003c/html\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flily-osp%2Frfid-access-control-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flily-osp%2Frfid-access-control-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flily-osp%2Frfid-access-control-system/lists"}