GrovePi + Grove - 125KHz RFID Reader + Python


I bought a Raspberry Pi in combination with the GrovePi+
Now I’m trying to make the Grove - 125KHz RFID Reader to work in Python.

I’m super new to programming. Many attempts to find a good tutorial/sample code online has lead to nothing.
If I’m correct, the module should be plugged into the RPISER port of the GrovePi+.

I also found this forum topic:

but the provided example seems to be for Arduno. I’m using a Raspberry Pi

I’m using the following:

  • Raspberry Pi 3
  • GrovePi+
  • Grove - 125KHz RFID Reader

Hi @jeroen_schuiten,

We don’t have example programs for the Grove RFID Reader at the moment.

Please give us a day or two to come up with a solution for you.
We will reach back to you.

Does this sound good to you?

Thank you!

Hi @jeroen_schuiten,

As I don’t have a Grove RFID Reader on my hands I can only give you a “rough” estimation of what you should have.
You will need to have the pyserial package installed in order to use the following python script.
In this script, when I message is received on the serial line, it’s gets printed in the console and then the program ends.

import serial
import time

rpiser = serial.Serial('/dev/ttyAMA0', baudrate=9600, timeout=0)

while rpiser.inWaiting() == 0:

serial_data = rpiser.readline()

I think this script should work for your needs.

Thank you!

I realize this is an old post but if someone could help that would be great.

I have a Raspberry Pi B+ connected to Grove - 125kHz RFID Reader(UART) via a GrovePi Board on RPISER. I have used the above code but replaced /dev/ttyAMA0 with /dev/ttyS0.

I want the python3 code to continually check for a tag and print the tag id when found.

At the moment I am getting inconsistent and unuseable results.

============== RESTART: /home/pi/mygrovepi/ ==============
============== RESTART: /home/pi/mygrovepi/ ==============
Traceback (most recent call last):
  File "/home/pi/mygrovepi/", line 7, in <module>
    while rpiser.inWaiting() == 0:
  File "/usr/lib/python3/dist-packages/serial/", line 572, in inWaiting
    return self.in_waiting
  File "/usr/lib/python3/dist-packages/serial/", line 456, in in_waiting
    s = fcntl.ioctl(self.fd, TIOCINQ, TIOCM_zero_str)
OSError: [Errno 5] Input/output error
============== RESTART: /home/pi/mygrovepi/ ==============
============== RESTART: /home/pi/mygrovepi/ ==============
============== RESTART: /home/pi/mygrovepi/ ==============

Hi @anwar,

That looks like a problem with the serial port not being picked up. May I suggest you check this tutorial on setting up the serial port on the Raspberry Pi? It’s very useful and I use it sometimes too:

Let me know if you make this thing work.

Thank you!

Hi Robert,

Thank you for your reply. This was an interesting article and I decided that because I am not using Bluetooth in my project I would add the following lines to my config.txt file

enable_uart=1 # this was already set by me


then I ran the test code shown below. It seems to be okay but the print statement returns the word string not the id of the tag. I am not familiar with python, can you advise how I can get the tag id?

Kind regards


import serial

For PiB+ 2, Zero use:

ser = serial.Serial(’/dev/ttyAMA0’, 9600, timeout=1)

For Pi3 use

#ser = serial.Serial(’/dev/ttyS0’, 9600, timeout=1)

while True:

string =

if len(string) == 0:

print (“Please wave a tag”)


string = string[1:11] # Strip header/trailer

print (“string”),string

if string == ‘E0043DBB52’:

print (“hello Joe, what do you know?”)

I am having issues using this code with a Raspberry pi 4 and a Grove 125kHz reader. Before actually reading the tag, the first few attempts result in many printed strings looking like 'x80\x00\xf8 etc.
After some time and some attempts, the RFID ID does get read, but then never again. The system seems to fail to read it again.
Has anyone else encountered this issue before?
Thanks for any help!

1 Like

How is it connected? i2c? Serial?

Can you provide a sample of the code you are using?