You know it is good when you don’t need to touch for turning on any light or opening any door. So you can use RFID cards for this touchless scenario. In this post I’m gonna give you MicroPython code for this project. First what you need
1xRaspberry Pi Pico
1xPn532 RFID Card Reader
1×220 Ohn Resistor
Jumber Cables and MicroUsb Cables.
First connect PN532 SDA and SCL pins to Raspberry Pi Pico GPIO pin 8 and pin 9. Also connect LED with resistor to pin 17.
After that open Thonny Editor and paste code below.
import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522
reader = SimpleMFRC522()
led_pin = 17 # change this to the pin number connected to the LED
# set up the GPIO pin for the LED
id, text = reader.read()
# turn on the LED
# turn off the LED and clean up the GPIO pins
As you can see code you need to install mfrc522 library. You can install this with pip. Every time you read your RFID card, LED will open. And if you take your card away from PN532 card reader LED will turn off.