I am having problems with coding a program that allows me to read RFID Tags with Pi4J on my Raspberry Pi 2 Model B.

I am totally new to Python and would prefer a program written in Java to save some data connected to an RFID Tag ID into a database.

The RFID module is properly connected to my Pi (According to the WiringPi pin-numbering).

I am not able to find any usefull resources on Google (Only Python or Arduino related stuff) so I hope this great community might be able to help me out. Is someone of you able to write a small code snippet for me which reads the ID of an RFID tag and then calls a method with this ID as a parameter? I would really appreciate your help as I am lost in this whole Python stuff. I couldn't even find any nice examples which help me figure out how Pi4J can read data from RFID modules (only via COM, my module is directly attached to the GPIO pins and not via USB/COM port).

Thanks in advance.


I am using a Mifare RC-522 module which is directly connected to the Raspberrys SPI GPIO-Pins.

  • I am working on a similar notion right at the moment. I found a Python library that worked great ... right now I am attempting to port it (slowly) to JavaScript. While I realize that this is not Java ... once ported to JavaScript and tested, it should be an easier task to port to Java. Would a JavaScript version be of use to you? – Kolban Jan 20 '16 at 0:49
  • Hello Kolban, that would be a great start :-) I also have the option to use PHP, so JavaScript is also a nice idea of implementing it! – Nico Enking Jan 20 '16 at 7:22
  • Can you tell us about the RFID hardware that you are using - I have a minor interest in that I have a USB RFID reader and I an having fun with that because it thinks it is a keyboard - and gets treated like one - which may not be optimum for my usage... 8-p – SlySven Jan 20 '16 at 9:18
  • Hello SlySven, I updated my question with further information of the module I am using. You can get it for ~6$ on Amazon: amazon.com/AllLife-Mifare-Reader-Proximity-Interface/dp/… – Nico Enking Jan 20 '16 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.