RFID with Raspberry Pi through Node-Red

I want to connect RFID with Raspberry Pi Through node-red. While it is working fine with python code.

What hardware are you using?

rfid-rc522 and raspberry pi 3 b+

Try these:

rfidreader.py.txt (3.1 KB)

[{"id":"be3bb97a.4463e8","type":"daemon","z":"95c8fec3.f7779","name":"RFIDReader","command":"python","args":"-u /home/pi/rfidreader.py","cr":true,"redo":true,"op":"string","x":287,"y":210.49998474121094,"wires":[["a458aa0b.479e68","36982250.6f416e"],[],[]]}]
1 Like

Thanks for your kind reply. I tried but I got an error as shown in picture.

Try this library, the one I use has some pins changed, and make sure it matches the pins you use.

MFRC522.py.txt (10.1 KB)

1 Like

Thanks for your again reply, I am using the following tutorial with your sent files. https://developer.ibm.com/recipes/tutorials/reading-rfid-mifare-cards-into-watson-iot-platform-using-your-raspberry-pi-3/
And connecting pins on exact same positions. But still got an error. error

What if you remove the old library files and do sudo pip3 install mfrc522? I don't think python MFRC522.py installs the library.

1 Like

Thanks for your kindness Miss. Tobia. I got the modified files from following link https://github.com/mxgxw/MFRC522-python/commit/52507f18514bd4259c3e34886587ac2f95b13cb4#diff-928e81e8826acacbcb72f6dcde038977
New update files are : MFRC522.py.txt (11.4 KB) rfidreader.py.txt (3.6 KB)

Great. Beware that the RPi will run at about 25% CPU with that rfidreader.py exec node. I'm sure it's possible to change the rfidreader.py file so that it runs differently, pausing a few seconds in between but I haven't tried to change it. Maybe someone else knows how to.

1 Like

Hi, it is working fine but I need to attach LED with an RFID reader and for that, I am using function node to convert python to json as mentioned in the picture


And still, RFID working fine but shows an error of function node.

When you get an error like that the first thing to do is to also connect a debug node to show what is going into the function node in order to see what it is working on. Once you know that then consider what you think the function JSON.parse() will do with whatever you are feeding it.

Is this the same student project as in the similar thread going on at the same time?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.