In compliance with high industry standards

Browse our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteria

Raspberry & PROFINET: How to set communication on Linux

Industrial Ethernet Communication Protocols



PROFINET (Process Field Networkis a network standard for Industrial Automation based on open Ethernet and non-propietary for automation.

The Raspberry PLC has two Ethernet ports, and its own OS from the Raspberry, Raspbian, Linux.

Let's go to learn how to run the p-net Profinet device stack and its sample application on a Raspberry PLC!

Odoo text and image block


 How to check Ethernet 

configuration in Raspberry PLC

Raspberry PLC

family products

Read >>

TouchBerry Pi

family products

Read >>

How to program Raspberry PLC

interrupt inputs with Python

Read >>

Raspberry PLC

family products

Read >>

TouchBerry Pi

family products

Read >>



  1. 1x Raspberry PI

  2. 1x Raspberry PLC 

  3. Ethernet/USB Hub

  4. Rasperry power cable - USB C type

  5. 2x Ethernet cables


PROFINET is the international open Ethernet industrial standard of PROFIBUS & PROFINET (pi) for automation

  • PROFINET uses the TCP/IP and LO standards, isPROFI real-time Ethernet, and allows investment protection with the integration of fieldbus systems.See how >>

  • ProFiNet IO (Input Output): Developed real-time (RT) and real-time isochronous (IRT) communication with the decentralized periphery. The names RT and IRT are limited to describing the properties in time for communication in ProFiNet IO. 

The PROFINET concept offers modular mode structure so that users can select cascade connection themselves. They differ essentially due to the type of data exchange to meet the requirements, partly very high speed.

With PROFINET, communication without discontinuities from the management level to the field level is possible. On the other hand, it meets the great demands imposed by industry, e.g. ex. wiring and connection system suitable for industrial environment, real time, motion control in isochronous mode, non-propritary engineering, etc.

PROFINET was developed with aim of fostering a process of convergence between industrial automation and the information management platform for corporate management and global corporate networks. It applies to Ethernet-based distributed automation systems that integrate existing fieldbus systems, for example PROFIBUS, but without modifying them.

Odoo text and image block

Notes to advanced users

The IO-device sample application can be running on:

  • Raspberry Pi

  • Any Linux OS

  • An embedded board running an RTOS, such as RT-kernel


The sample_app directory in the p-net repository contains the source code for this tutorial. It also contains a GSD file which tells the IO-controller how to communicate with the IO-device. Those parts of the sample application that are dependent on whether you run Linux or an RTOS are located in src/ports.

Install dependencies

First of all, connect your Raspberry Pi to Internet via LAN or WiFi to be able to download some packages. See how >>
Then, in order to compile p-net on Raspberry Pi, you need a recent version of cmake. Install it:

sudo apt update
sudo apt install snapd
sudo reboot
sudo snap install cmake --classic

Verify the installed version:

cmake --version

Download and compile p-net

Install git to download p-net:

sudo apt install git

Create a directory called profinet:

mkdir /home/pi/profinet
cd /home/pi/profinet

Clone the repository with submodules. Then create and configure the build:

git clone --recurse-submodules
cmake -B build -S p-net
cmake --build build --target install

Notes to advanced users

If you already cloned the repository without the --recurse-submodules flag, then run in the p-net folder

git submodule update --init --recursive

Alternate cmake command to also adjust some settings:


Depending on how you installed cmake, you might need to run snap run cmake instead of cmake.

Run the sample application

Go to the /home/pi/profinet/build directory:

cd /home/pi/profinet/build

Enable the Ethernet interface and set the initial IP address:

sudo ifconfig eth0 netmask up

Execute the sample application:

sudo ./pn_dev -v -v -v -v

From the Raspberry PLC

Configure the Ethernet interface from the Raspberry PLC and set the initial IP address:

sudo ifconfig eth0 netmask up

Download the tshark package:

sudo apt update
sudo apt install -y tshark

Add a new system group called tshark:

sudo groupadd tshark

Add current user to a tshark group:

sudo usermod -a -G tshark $USER

To make changes to take effect, logout and login to Raspberry Pi. After you are reconnected, check tshark version:

tshark --version

To start capturing packets on default network interface with tshark, simply execute this command:

sudo tshark

To identify which network interfaced are available to the tshark, run the following command:
tshark -D

We can use -i option to capture packets on specific network interface

sudo tshark -i eth0

Get the results

Odoo image and text block
Odoo image and text block


LLDP or Link Layer Discovery Protocol is used by PROFINET to determine and manage neighborhood relationships between PROFINET devices. LLDP uses the special multicast MAC address: 01-80-C2-00-00-0E and the Link layer Ethernet II and IEEE 802. 1Q and Ethertype 0x88CC (PROFINET). Finally, the port number is non relevant:

Odoo image and text block

Autostart on boot

 If you want pnet to run when the Pi is turned on, or re-booted, first enable the serial port console by writing the line


in the file /boot/config.txt 

Go to /etc/dhcpcd.conf and include these lines to set a static ip:

interface eth0
static ip_address=

Then, you can enable the service to autostart by running the  following commands:

sudo cp /home/pi/profinet/p-net/src/ports/linux/pnet-sampleapp.service /lib/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable pnet-sampleapp.service

 Start service:

sudo systemctl start pnet-sampleapp.service

To see the status of the process, and the log output:

sudo systemctl status pnet-sampleapp.service
journalctl -fu pnet-sampleapp

Finally, reboot to apply the changes and get your service running!

Do you want to know more? Learn how to trigger alarms using PROFINET & CODESYS!  Check out >>

Looking for your ideal PLC?

Take a look at this product comparison with other industrial controllers Arduino.

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.

Industrial PLC controller comparison >>

Do you want more information?

Just fill the form!

Tell me more!