Skip to content

Sample implementation of a OPC-UA Server & Client running in Docker on two headless Raspberry Pi 4B

Notifications You must be signed in to change notification settings

FHatCSW/OPCUA-Sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OPCUA-Sample

Sample implementation of a OPC-UA Server & Client running in Docker on two Raspberry Pi 4B

Prepare Raspberries

Server

  • Create a Raspberry Pi with the latest Version of Raspberry Pi OS Lite (32 bit)
    • Set Hostname to opcua-server
    • Enable SSH
    • Set user:password (admin:foo123)
    • Set WiFi

Client

  • Create a Raspberry Pi with the latest Version of Raspberry Pi OS Lite (32 bit)
    • Set Hostname to opcua-client
    • Enable SSH
    • Set user:password (admin:foo123)
    • Set WiFi

Setup on Pi

General Setup Raspberry

  • Update & Upgrade

    sudo apt-get update
    sudo apt-get dist-upgrade
  • Install Git

    sudo apt install git
  • Install Docker

    sudo curl -fsSL https://get.docker.com | sh
  • Add a Non-Root User to the Docker Group

    • Add users to the Docker group
      sudo usermod -aG docker admin
    • Check if running
      groups ${USER}
  • Install Docker-Compose

    sudo apt-get install -y python3-pip
    sudo pip3 install docker-compose
    docker-compose version
  • Clone repository

    git clone https://github.com/FHatCSW/OPCUA-Sample.git
  • Install libxml2 and libxslt development package

    sudo apt-get install libxml2
    sudo apt-get install libxslt
  • Reboot Raspberry

    sudo reboot

Client

Got to directory

cd /home/admin/OPCUA-Sample/opcua-client

Start docker container

docker-compose up -d

Open your browser

http://opcua-client.local:8000

Define the server address and connect

opc.tcp://<IP OF THE RASPBERRY SERVER>:4840/freeopcua/server/

Server

Got to directory

cd /home/admin/OPCUA-Sample/opcua-server

Start docker container

sudo docker-compose up -d

Git

Useful commands

Stash all local changes on the Raspberry

git stash push --include-untracked

Docker

Useful commands

List all docker containers:

docker container ls -s

find all running docker processes

ps aux | grep docker

... or a certainer container

docker ps -a | grep <certain_container>

Shutdown a certain docker compose process:

docker-compose -f docker-compose<...>.yml down

remove a conatiner

docker rm -f influxdb

Code

Client

Server

https://github.com/FreeOpcUa/python-opcua/blob/master/examples/server-minimal.py

About

Sample implementation of a OPC-UA Server & Client running in Docker on two headless Raspberry Pi 4B

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages