I have a board for the RDM6300 which can read RFID tags. I could successfully test the board using an ESP32. Here is the micropython code:

from machine import UART, Pin
import time

uart = UART(1, 9600)
uart.init(9600, bits=8, parity=None, stop=1, rx=9, tx=10)

pin = Pin(26, Pin.OUT)
def flashLED():


while True:
    b = uart.read()
    if not b == None:

So whenever a tag is read I flash an LED. This works just fine. So now I want to attach the board to my RaspberryPi Zero.

I did enable the serial interface using sudo raspi-config. Also I disabled the terminal over that port. I did reboot after changing that.

After reboot I do see the following instances for the serial connection:

 $ ls /dev/ -lia | grep serial
 217 lrwxrwxrwx  1 root root           5 Jul 25 12:11 serial0 -> ttyS0
 196 lrwxrwxrwx  1 root root           7 Jul 25 12:11 serial1 -> ttyAMA0

I added pi to the group dialout:

sudo adduser pi dialout

When I do cat /dev/serial0 then the prompt is "captured" while cat /dev/serial1 exists immediately.

Now I found a script that reads from the UART like so:

import serial
from time import sleep

ser = serial.Serial("/dev/serial0", baudrate = 9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=10)

while True:
    rx_data =ser.readline()

I had to run the script using sudo since otherwise I would get the following error:

/dev/serial0: [Errno 16] Device or resource busy: '/dev/serial0'

Please note that I tried both /dev/serial0 and /dev/serial1 respectively.

The output of the RDMBoard is connected to RX of the Pi (namely Pin 15). I tried pin 14 too.

I don't get any data back when reading from my serial stream. As you can see I did try a few different things but it seems that I'm stuck. Any help would be greatly appreciated!

Update: While I got it working now (see my answer below) I'm still curious on how to get this working using the serial interface.

  • Your question is unclear. I don't have a PiZero (and you have tagged your question with pi-zero-w), but in Raspberry Pi OS /dev/serial0 is the default serial port (on pins 8,10 - BCM 14,15) but is not enabled by default.
    – Milliways
    Jul 25, 2021 at 11:42
  • @Milliways: You're right it's GPIO14 not Pin 14 and 15 resp. Apart from this the question is basically how I can read data from my sensor that uses UART but I assumed that would be clear. I'll revise my question if there is anything I can add. I did look at the official RPi UART Configuration document but it's a bit unclear as to which gpios ought to be used.
    – Besi
    Jul 25, 2021 at 20:16

1 Answer 1


I did manage to read the sensor using pigpio rather than the builtin serial interface:

sudo apt-get update
sudo apt-get install pigpio python-pigpio python3-pigpio
sudo pigpiod # start the pigpio daemon

Now I can connect the sensor to a given GPIO pin (I used GPIO24) and read the data:

import sys
import time
import difflib
import pigpio


        pi = pigpio.pi()
        pi.set_mode(RX, pigpio.INPUT)
        pi.bb_serial_read_open(RX, 9600, 8)

        print("DATA - SOFTWARE SERIAL:")
        while 1:
                (count, data) = pi.bb_serial_read(RX)
                if count:


This results in the following output when holding a tag near the RFID reader:


I had to connect the RDM device to 5V rather than 3V3 in order for it to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.