How to Read RFID Signals with RevPi as Modbus RTU Master

In the following example, we use our RevPi Flat as a Modbus RTU master and connect an RFID card reader to it.

You require:

  • RevPi Flat
  • Slave
  • Suitable cables with D-Sub 9 connectors
  • Adapter (e.g. shop article 200018 or 200019)
  • Internet connection


  • You have installed a web browser on your PC (e.g. Chrome or Firefox).
  • Your RevPi Flat is connected to your network.

Connecting the Slave

  • Connect a USB socket to the adapter.
  • Connect the adapter to the slave via the D-Sub 9 socket.
  • Connect your RevPi Flat to the power supply.

Determining Modbus RTU Network Data

In order to configure the slave, we need some data in advance for addressing the slave via our RevPi Flat. We find this data in the user manual of our slave.

In this example, we use the RFID card reader “Iveno RFID MODBUS Reader RFID-MB-10” as slave.

  • Note the following data from the manual of your slave:

Data Type

Value (example data for the RFID card reader)



Baud rate


Data bits


Stop bits




Slave address


Modbus function

Read Holding Registers

Modbus Register Transponder code [0]


Modbus Register Transponder code [1]


Modbus Register Transponder code [2]


Modbus Register Transponder code [3]


Modbus Register Transponder code [4]


Enabling Modbus RTU Master Function

  • Open your web browser.
  • Enter the IP address of your RevPi Flat in the address bar of your browser.

The login window opens.


  • Log in with the username “admin”.
  • Enter your password. You can find it on the sticker on the side of your RevPi Flat.
  • Click on “Login”.

You can now see the current device status of your RevPi Flat.

  • Click on the “Services” tab.
  • Click on “Enabled” in the line Enable/Disable Modbus Master.
  • Click on the “Save All” button.


Tip: You can also activate the master function in the command line. Enter the following command: “sudo revpi-config enable pimodbus-master”


  • Click on the “Apps” tab.
  • Click on the start button behind the entry “PiCtory”.

PiCtory opens.

Configuring Modbus RTU Master

  • Open the folder “Virtual Devices” in the “Device Catalog”.
  • Select the Modbus RTU master.
  • Hold down the left mouse button and drag the Modbus RTU master onto your RevPi Flat.


Set the basic settings for your adapters in the “Device Data” window. This entry is optional. If you use a lot of devices and wish to process the data in another program later, then this entry can be very helpful.


Define the settings for the serial interface in the “Value Editor”. We have already determined the values for our slave from the user manual of the sensor:

  • device_path: USB device path (see lsusb -v and ls /dev/ttyU*)
  • baud_rate: 9600
  • parity: None
  • data_bits: 8
  • stop_bits: 1


  • Right-click on the Modbus RTU master on the configuration board.
  • A context menu opens.
  • Select the entry “Extended Data”.

An input mask opens.


Here, we set the Modbus commands. In this example, we need a command that reads the values of the RFID sensor. We have already determined the necessary information from the user manual of the sensor:

  • Slave Addr.: 1
  • Register Addr.: 1000
  • Quantity of Registers: 5

Saving the Configuration

  • Click on “File>Save”. This saves your file.


  • Click on “Tools>Reset Driver”. This activates the changes for the adapter.


Querying Values in the Process Image

  • Open the command line.
  • Enter the following command:

piTest -v Input_Word_1

You get the information about the location of your values in the process image:

variable name: Input_Word_1offset: 11length: 16bit

The values are in the process image from address 16 on. We need to read 10 bytes.


We enter the following command to see our values: “piTest -r 11,10,h”. If we now hold the RFID card to the card reader, we can observe the changing values in the process image.


piTest -r 11,10,h00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 0004 00 00 00 1b 00 87 00 2b 0004 00 00 00 1b 00 87 00 2b 0004 00 00 00 1b 00 87 00 2b 00[…]