{"id":24732619,"url":"https://github.com/gonzalo123/rpi_nfc","last_synced_at":"2025-10-10T01:32:44.134Z","repository":{"id":66582164,"uuid":"84737738","full_name":"gonzalo123/RPi_nfc","owner":"gonzalo123","description":"Raspberry Pi NFC tag reader","archived":false,"fork":false,"pushed_at":"2017-04-16T17:24:34.000Z","size":6,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-03T12:12:28.183Z","etag":null,"topics":["iot","python","raspberry-pi"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/gonzalo123.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":"2017-03-12T15:51:46.000Z","updated_at":"2024-06-27T23:34:19.000Z","dependencies_parsed_at":"2023-06-02T01:15:48.707Z","dependency_job_id":null,"html_url":"https://github.com/gonzalo123/RPi_nfc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gonzalo123/RPi_nfc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gonzalo123%2FRPi_nfc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gonzalo123%2FRPi_nfc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gonzalo123%2FRPi_nfc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gonzalo123%2FRPi_nfc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gonzalo123","download_url":"https://codeload.github.com/gonzalo123/RPi_nfc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gonzalo123%2FRPi_nfc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002406,"owners_count":26083374,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["iot","python","raspberry-pi"],"created_at":"2025-01-27T17:53:08.577Z","updated_at":"2025-10-10T01:32:44.129Z","avatar_url":"https://github.com/gonzalo123.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Raspberry Pi NFC tag reader\n======\n\nThe idea that I have got in my mind is use NFC tags to open doors. In this project I want to use a Raspberry Pi 3\n\n# Hardware:\n* Raspberry Pi 3\n* RFID/NFC Sensor MFRC522 (http://playground.arduino.cc/Learning/MFRC522)\n* 3 LEDS\n* 4 Resistors\n* 1 Push button\n\n# Wiring:\n* RC522 VCC  \u003e RP 3V3\n* RC522 RST  \u003e RPGPIO25\n* RC522 GND  \u003e RP Ground\n* RC522 MISO \u003e RPGPIO9 (MISO)\n* RC522 MOSI \u003e RPGPIO10 (MOSO)\n* RC522 SCK  \u003e RPGPIO11 (SCLK)\n* RC522 NSS  \u003e RPGPIO8 (CE0)\n* RC522 IRQ  \u003e RPNone\n\n# Software\nI'm going to use two Python Scripts. One to control NFC reader\n\n```python\nimport RPi.GPIO as gpio\nimport MFRC522\nimport sys\nimport time\n\nMIFAREReader = MFRC522.MFRC522()\nGREEN = 11\nRED = 13\nYELLOW = 15\nSERVO = 12\n\ngpio.setup(GREEN, gpio.OUT, initial=gpio.LOW)\ngpio.setup(RED, gpio.OUT, initial=gpio.LOW)\ngpio.setup(YELLOW, gpio.OUT, initial=gpio.LOW)\ngpio.setup(SERVO, gpio.OUT)\np = gpio.PWM(SERVO, 50)\n\ngood = [211, 200, 106, 217, 168]\n\ndef servoInit():\n    print \"servoInit\"\n    p.start(7.5)\n\ndef servoOn():\n    print \"servoOn\"\n    p.ChangeDutyCycle(4.5)\n\ndef servoNone():\n    print \"servoOn\"\n    p.ChangeDutyCycle(7.5)\n\ndef servoOff():\n    print \"servoOff\"\n    p.ChangeDutyCycle(10.5)\n\ndef clean():\n    gpio.output(GREEN, False)\n    gpio.output(RED, False)\n    gpio.output(YELLOW, False)\n\ndef main():\n    servoInit()\n    while 1:\n        (status, TagType) = MIFAREReader.MFRC522_Request(MIFAREReader.PICC_REQIDL)\n        if status == MIFAREReader.MI_OK:\n            (status, backData) = MIFAREReader.MFRC522_Anticoll()\n            gpio.output(YELLOW, True)\n            if status == MIFAREReader.MI_OK:\n                mac = []\n                for x in backData[0:-1]:\n                    mac.append(hex(x).split('x')[1].upper())\n                print \":\".join(mac)\n                if good == backData:\n                    servoOn()\n                    gpio.output(GREEN, True)\n                    time.sleep(0.5)\n                    servoNone()\n                else:\n                    gpio.output(RED, True)\n                    servoOff()\n                    time.sleep(0.5)\n                    servoNone()\n                time.sleep(1)\n                gpio.output(YELLOW, False)\n                gpio.output(RED, False)\n\nif __name__ == '__main__':\n    try:\n        main()\n    except KeyboardInterrupt:\n        print 'Interrupted'\n        clean()\n        MIFAREReader.GPIO_CLEEN()\n        sys.exit(0)\n```\n\nAnd another one to control push button\n\n```python\nimport RPi.GPIO as gpio\nimport time\n\ngpio.setwarnings(False)\ngpio.setmode(gpio.BOARD)\nBUTTON = 40\nGREEN = 11\nRED = 13\nYELLOW = 15\n\ngpio.setup(GREEN, gpio.OUT)\ngpio.setup(RED, gpio.OUT)\ngpio.setup(YELLOW, gpio.OUT)\n\ngpio.setup(BUTTON, gpio.IN, pull_up_down=gpio.PUD_DOWN)\ngpio.add_event_detect(BUTTON, gpio.RISING)\ndef leds(status):\n    gpio.output(YELLOW, status)\n    gpio.output(GREEN, status)\n    gpio.output(RED, status)\n\ndef buttonCallback(pin):\n    if gpio.input(pin) == 1:\n        print \"STOP\"\n        leds(True)\n        time.sleep(0.2)\n        leds(False)\n        time.sleep(0.2)\n        leds(True)\n        time.sleep(0.2)\n        leds(False)\n\ngpio.add_event_callback(BUTTON, buttonCallback)\nwhile 1:\n    pass\n```\n\n# Demo\n[![Raspberry Pi NFC tag reader](http://img.youtube.com/vi/IUGeVg7DE9Q/0.jpg)](https://www.youtube.com/watch?v=IUGeVg7DE9Q)\n# References:\n* https://github.com/mxgxw/MFRC522-python\n* https://www.sunfounder.com/wiki/index.php?title=How_to_Use_an_RFID_RC522_on_Raspberry_Pi\n* http://fuenteabierta.teubi.co/2013/07/utilizando-el-lector-nfc-rc522-en-la.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgonzalo123%2Frpi_nfc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgonzalo123%2Frpi_nfc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgonzalo123%2Frpi_nfc/lists"}