Raspberry Pi: Difference between revisions

From Axel Public Wiki
Jump to navigation Jump to search
 
(42 intermediate revisions by the same user not shown)
Line 1: Line 1:
Following these instructions, you can turn your Raspberry PI B or B+ into a complete IEC-61131 PLC.
Following these instructions, you can turn your Raspberry PI B or B+ into a complete IEC-61131 PLC.
__TOC__
__TOC__
=== PLC runtime features and components ===
{|class="wikitable"
! Feature
! Description and notes
|-
| PLC runtime
|
* Full IEC 61131-3 standard supported, object oriented programming included
* Multitasking PLC, highest priority task @1ms cycle time
* Configurable tasks and application memory resources (code and data)
Detailed runtime features list in the paragraph below
|-
| HMI
| PageLab HMI runtime
|-
| SoftScope
| Real-time acquisition runtime, 1ms sample time
|-
| EtherCAT master
| Full featured EtherCAT master with LogicLab integrated configurator and online diagnostics and network scan. ESI import
If enabled, physical ethernet port is used, standard TCP/IP protocols rely on WiFi network
|-
| CANopen master/slave
| (requires CAN hardware interface) Full-featured CANopen master and slave stacks with LogicLab integrated configurator, EDS import
|-
| Modbus TCP master/slave
| Modbus TCP master and slave stacks with LogicLab integrated configurator, device descriptor editor utility
|-
| Modbus RTU master/slave
| (requires RS485 hardware interface) Modbus RTU master and slave stacks with LogicLab integrated configurator, device descriptor editor utility
|-
| PLC tags (variables) access
| Two options available:
* Axel LLSymbol library (optimized and easy option)
* OPC-UA server
|-
| WEB server
| Integrated WEB server with WEB API for PLC variables and parameters access
|-
| MQTT
| MQTT/MQTTS library and engine with LogicLab integrated configurator, SLL connection and certificates management supported
|}
=== Supported PLC runtime features ===
* PLC application in machine executable code
* Object-oriented programming supported
* Hot swap download: allowing you to download the new application without halting the current execution
* Floating point support: for optimized floating point operations
* Extended string support: for optimized string operations
* Extended math support: for optimized math operations
* Relocatable code: for optimized memory usage
* Source code download and upload: allowing you to download the project source code on the target and to retrieve it in a second moment
* On-line debug: advanced debug instrument which allow you to see current symbols value directly inside the editor
* Triggers and graphic triggers debugging instruments
* Breakpoints and step debug
* Synchronous I/O forcing
* Dynamic check of stack integrity
* Dynamic check of array validity
* Dynamic check of pointers validity
=== Hardware Setup ===
=== Hardware Setup ===
The LLExec PLC runtime has been tested on Raspberry PI Model B and B+, Raspberry PI 2 model B and Raspberry PI 3 model B, with I/O expansions PIFace or PIFace Digital 2, depending on the model of Raspberry PI.
The LLExec PLC runtime has been tested on Raspberry PI Model B and B+, Raspberry PI 2 model B, Raspberry PI 3 model B, Raspberry PI 4 model B, with or without I/O expansions PIFace or PIFace Digital 2, depending on the model of Raspberry PI.
The runtime PLC runs even without I/O expansion, it can be used to drive standard fieldbus modules, following the Modbus TCP standard. It can be used to drive Modbus RTU devices as well, but you need an external and supported (by raspbian) RS485 to USB device.
The runtime PLC runs even without I/O expansion, it can be used to drive standard fieldbus modules, following the Modbus TCP standard or EtherCAT (only for Raspberry PI 3 and 4). It can be used to drive Modbus RTU devices as well, but you need an external and supported (by raspbian) RS485 to USB device.
It also requires an SD or uSD at least 8GB to program the modified Raspbian  
It also requires an SD or uSD at least 8GB to program the modified Raspbian  
image.
image.
Line 10: Line 69:
You can proceed in two alternative ways:
You can proceed in two alternative ways:
* '''(3)''' Program a SD or uSD card with a full Raspbian image, already configured to run LLExec PLC runtime.
* '''(3)''' Program a SD or uSD card with a full Raspbian image, already configured to run LLExec PLC runtime.
* '''(4)''' Install LLExec PLC runtime on a standard Raspbian image.
* '''(4)''' Install LLExec PLC runtime on a standard Raspbian image (we don't support EtherCAT on this type of installation).
Follow one of the two options, then go to section '''(5)''' Get the free licence
 
=== Hardware Setup ===
The LLExec PLC runtime has been tested on Raspberry PI Model B and B+, Raspberry PI 2 model B, Raspberry PI 3 model B, Raspberry PI 4 model B, with or without I/O expansions PIFace or PIFace Digital 2, depending on the model of Raspberry PI.
The runtime PLC runs even without I/O expansion, it can be used to drive standard fieldbus modules, following the Modbus TCP standard or EtherCAT (only for Raspberry PI 3 and 4). It can be used to drive Modbus RTU devices as well, but you need an external and supported (by raspbian) RS485 to USB device.
It also requires an SD or uSD at least 8GB to program the modified Raspbian
image.
 
=== Software Setup ===
You can proceed in two alternative ways:
* '''(3)''' Program a SD or uSD card with a full Raspbian image, already configured to run LLExec PLC runtime.
* '''(4)''' Install LLExec PLC runtime on a standard Raspbian image (we don't support EtherCAT on this type of installation).
Follow one of the two options, then go to section '''(5)''' Get the free licence
Follow one of the two options, then go to section '''(5)''' Get the free licence


Line 16: Line 87:
The image is used to program an SD card, containing:
The image is used to program an SD card, containing:
* the Raspbian distribution
* the Raspbian distribution
* a modified version of the kernel that allows more accurate timing when used with PIFace I/O expansions and only on Raspberry PI models 1.
* the LLExec PLC runtime preconfigured
  Note: if you are using Raspberry PI 2 or 3, this kernel is not needed.
* optional realtime Kernels for RPI3 and 4.
* the LLExec PLC runtime
This image can be used to control three flavours of the runtime:
* Base: It support standard PLC functionality, without realtime nor EtherCAT support.
* EtherCAT: It support the EtherCAT fieldbus but non the realtime kernel, so it can't be used to drive Distributed Clock enabled EtherCAT slaves.
* OSADL: It have a patched Kernel with PREEMT_RT patch and a specific runtime setup, this full support EtherCAT with Distributed Clock.
The Image comes with scripts that can change the flavour of the image,<br>
every flavour needs different licenses.<br>
In this page we consider the Base flavour, more information about EtherCAT and OSADL flavour can be obtained at the pages:
https://www.axelsw.it/pwiki/index.php/Raspberry_Pi_EtherCAT
  https://www.axelsw.it/pwiki/index.php/Raspberry_Pi_OSADL_EtherCat
 


=== Download image ===
=== Download image ===
You can download the file '''rasppi_190613_raspbian_plc_nodered.rar''' from our site at url:
You can download the '''image file''' from our site at url:
  http://www.axelsoftware.it/pwiki/pub/rasppi_191030_raspbian_plc_nodered.rar
  https://www.axelsoftware.it/download/#runtimes
{| role="presentation" class="wikitable mw-collapsible mw-collapsed"
 
| SHA-256
Download the ''Full RaspberryPi image with LLExec and Node-RED'' file
|-
| BE824DA9C066CF502EF5A58D45CAA86E36ABD057E3AA23287D8E41157FBDF35E
|}


=== Unzip the image ===
=== Unzip the image ===
Line 33: Line 110:


=== Program an SD or uSB (at least 8 GB) ===
=== Program an SD or uSB (at least 8 GB) ===
Using the preferred utility (eg. Win32DiskImager), write rasppi.img into an  
Using the preferred utility (eg. Win32DiskImager, download from [https://sourceforge.net/projects/win32diskimager/files/latest/download here]), write rasppi.img into an  
SD card or uSD.
SD card or uSD.


=== Login into the system ===
=== Login into the system ===
Login as user '''pi''', password '''axel'''
Login as user '''pi''', password '''axel'''


== Install LLExec PLC runtime on a standard Raspbian image ==
== Install LLExec PLC runtime on a standard Raspbian image ==
Line 70: Line 146:


=== Configure the network ===
=== Configure the network ===
Change the file '''/etc/network/interfaces''' in order to assign your preferred IP address.
The Raspberry PI Image comes with a default IP address.<br>
You can use LogicLab to change the IP address as described in the following paragraphs.<br>
Note that you don't need to be in the same subnet of the default IP address, to select the IP with LogicLab.


== Installation and first use of LogicLab ==
== Installation and first use of LogicLab ==
=== Downloads of LogicLab Automation Suite ===
=== Downloads of LogicLab Automation Suite ===
Go to our website '''[http://www.axelsoftware.it axelsoftware.it]''',
Go to our website '''[http://www.axelsoftware.it axelsoftware.it]''',<br>
In the '''Downloads''' section expand the list '''Software -> LogicLab Automation Suite'''
In the '''Downloads''' section expand the list '''Software -> LogicLab Automation Suite'''<br>
Download the file '''LogicLab Automation Suite'''
Download the file '''LogicLab Automation Suite'''


Line 81: Line 159:


=== Launch LogicLab ===
=== Launch LogicLab ===
Press '''New Project'''
Press "Scan Network".<br>
Select target '''Raspberry Pi 1.1'''
Your Raspberry PI with its IP address will be showed.<br>
Press the circular button near the IP address to change the IP to your choice.<br>
Press the button "+" under the column "New prj.<br>
Give the project a name and press the '''OK''' button.
Give the project a name and press the '''OK''' button.
* From the menu '''On-line''' select '''Setup communication'''.
* From the menu '''On-line''' select '''Setup communication'''.
Select the protocol '''GDB''', then press the '''Properties''' button.
Select the protocol '''GDB''', then press the '''Properties''' button.
 
* Check the IP address and confirm.
* Change the IP address, with your Raspberry PI one and confirm.
 
* Choose '''Connect''' from the menu '''Online''':
* Choose '''Connect''' from the menu '''Online''':
If everything went correctly, you should see the green word '''Connected''' on
If everything went correctly, you should see the green word '''Connected''' on
Line 98: Line 175:
After this time is expired, is required to reboot the Raspberry PI.<br><br>
After this time is expired, is required to reboot the Raspberry PI.<br><br>
To obtain a full license you can ask for:
To obtain a full license you can ask for:
*<b>Free licenses</b> that will be offered ONLY after presenting a detailed description of the purpose of the license.If you need it for <u>educational purpose</u> please introduce you, your school and your class project including teacher references.<br><b>PLEASE NOTE: any incomplete request will be denied</b>.
*'''Free licenses''' that will be offered ONLY after presenting a detailed description of the purpose of the license. If you need it for <u>educational purpose</u> please introduce you, your school and your class project including teacher references.<br><b>PLEASE NOTE: any incomplete request will be denied</b>.<br>If the request meets all the requirements, Axel will send you a product key to activate your license trough the "Raspberry PI" node in the Resources panel of LogicLab.
*Commercial license: please ask for a quotation.<br><br>
*'''Commercial license''': please ask for a quotation.<br><br>


To request a license you need first to retrieve your HardwareID. On LogicLab switch to the tab "Resources", then click on the root node "Raspberry PI".
To request a license you need first to send an email to support@axelsw.it.<br>
This will open a window,
if the device is connected, you will see "Status: Not licensed".
Please click '"Read"' on HardwareID field,
then sent that string to support@axelsw.it.<br>
<br>


== Extend runtime ==
Please consult the page [[Raspberry Pi Dev]]


=== More informations ===
== More information ==
For more information you can consult the online manual,
=== About LogicLab ===
or follow our tutorials available in the news section of the website or on  
For more information you can consult the online manual, or follow our tutorials available in the news section of the website or on YouTube by following the link below:
YouTube by following the link below:
  https://www.youtube.com/user/Axelsrl
  https://www.youtube.com/user/Axelsrl


== In case of troubles: save a Log File ==
=== In case of troubles: save a Log File ===
In the case of any trouble, you can save the log file, this file can be sent to '''support@axelsw.it'''
In the case of any trouble, you can save the log file, this file can be sent to '''support@axelsw.it'''
Steps:
Steps:
Line 128: Line 201:
* send us the log file you saved
* send us the log file you saved


== Extend runtime ==
=== Supported PLC runtime features ===
Please consult the page [[Raspberry Pi Dev]]
* PLC application in machine executable code
* Object-oriented programming supported
* Hot swap download: allowing you to download the new application without halting the current execution
* Floating point support: for optimized floating point operations
* Extended string support: for optimized string operations
* Extended math support: for optimized math operations
* Relocatable code: for optimized memory usage
* Source code download and upload: allowing you to download the project source code on the target and to retrieve it in a second moment
* On-line debug: advanced debug instrument which allow you to see current symbols value directly inside the editor
* Triggers and graphic triggers debugging instruments
* Breakpoints and step debug
* Synchronous I/O forcing
* Dynamic check of stack integrity
* Dynamic check of array validity
* Dynamic check of pointers validity


== Support ==
== Support ==

Latest revision as of 16:37, 10 January 2024

Following these instructions, you can turn your Raspberry PI B or B+ into a complete IEC-61131 PLC.

PLC runtime features and components

Feature Description and notes
PLC runtime
  • Full IEC 61131-3 standard supported, object oriented programming included
  • Multitasking PLC, highest priority task @1ms cycle time
  • Configurable tasks and application memory resources (code and data)

Detailed runtime features list in the paragraph below

HMI PageLab HMI runtime
SoftScope Real-time acquisition runtime, 1ms sample time
EtherCAT master Full featured EtherCAT master with LogicLab integrated configurator and online diagnostics and network scan. ESI import

If enabled, physical ethernet port is used, standard TCP/IP protocols rely on WiFi network

CANopen master/slave (requires CAN hardware interface) Full-featured CANopen master and slave stacks with LogicLab integrated configurator, EDS import
Modbus TCP master/slave Modbus TCP master and slave stacks with LogicLab integrated configurator, device descriptor editor utility
Modbus RTU master/slave (requires RS485 hardware interface) Modbus RTU master and slave stacks with LogicLab integrated configurator, device descriptor editor utility
PLC tags (variables) access Two options available:
  • Axel LLSymbol library (optimized and easy option)
  • OPC-UA server
WEB server Integrated WEB server with WEB API for PLC variables and parameters access
MQTT MQTT/MQTTS library and engine with LogicLab integrated configurator, SLL connection and certificates management supported

Supported PLC runtime features

  • PLC application in machine executable code
  • Object-oriented programming supported
  • Hot swap download: allowing you to download the new application without halting the current execution
  • Floating point support: for optimized floating point operations
  • Extended string support: for optimized string operations
  • Extended math support: for optimized math operations
  • Relocatable code: for optimized memory usage
  • Source code download and upload: allowing you to download the project source code on the target and to retrieve it in a second moment
  • On-line debug: advanced debug instrument which allow you to see current symbols value directly inside the editor
  • Triggers and graphic triggers debugging instruments
  • Breakpoints and step debug
  • Synchronous I/O forcing
  • Dynamic check of stack integrity
  • Dynamic check of array validity
  • Dynamic check of pointers validity

Hardware Setup

The LLExec PLC runtime has been tested on Raspberry PI Model B and B+, Raspberry PI 2 model B, Raspberry PI 3 model B, Raspberry PI 4 model B, with or without I/O expansions PIFace or PIFace Digital 2, depending on the model of Raspberry PI. The runtime PLC runs even without I/O expansion, it can be used to drive standard fieldbus modules, following the Modbus TCP standard or EtherCAT (only for Raspberry PI 3 and 4). It can be used to drive Modbus RTU devices as well, but you need an external and supported (by raspbian) RS485 to USB device. It also requires an SD or uSD at least 8GB to program the modified Raspbian image.

Software Setup

You can proceed in two alternative ways:

  • (3) Program a SD or uSD card with a full Raspbian image, already configured to run LLExec PLC runtime.
  • (4) Install LLExec PLC runtime on a standard Raspbian image (we don't support EtherCAT on this type of installation).

Follow one of the two options, then go to section (5) Get the free licence

Hardware Setup

The LLExec PLC runtime has been tested on Raspberry PI Model B and B+, Raspberry PI 2 model B, Raspberry PI 3 model B, Raspberry PI 4 model B, with or without I/O expansions PIFace or PIFace Digital 2, depending on the model of Raspberry PI. The runtime PLC runs even without I/O expansion, it can be used to drive standard fieldbus modules, following the Modbus TCP standard or EtherCAT (only for Raspberry PI 3 and 4). It can be used to drive Modbus RTU devices as well, but you need an external and supported (by raspbian) RS485 to USB device. It also requires an SD or uSD at least 8GB to program the modified Raspbian image.

Software Setup

You can proceed in two alternative ways:

  • (3) Program a SD or uSD card with a full Raspbian image, already configured to run LLExec PLC runtime.
  • (4) Install LLExec PLC runtime on a standard Raspbian image (we don't support EtherCAT on this type of installation).

Follow one of the two options, then go to section (5) Get the free licence

Program a SD or uSD card with a full Raspbian image, already configured to run LLExec PLC runtime

The image is used to program an SD card, containing:

  • the Raspbian distribution
  • the LLExec PLC runtime preconfigured
  • optional realtime Kernels for RPI3 and 4.

This image can be used to control three flavours of the runtime:

  • Base: It support standard PLC functionality, without realtime nor EtherCAT support.
  • EtherCAT: It support the EtherCAT fieldbus but non the realtime kernel, so it can't be used to drive Distributed Clock enabled EtherCAT slaves.
  • OSADL: It have a patched Kernel with PREEMT_RT patch and a specific runtime setup, this full support EtherCAT with Distributed Clock.

The Image comes with scripts that can change the flavour of the image,
every flavour needs different licenses.
In this page we consider the Base flavour, more information about EtherCAT and OSADL flavour can be obtained at the pages:

https://www.axelsw.it/pwiki/index.php/Raspberry_Pi_EtherCAT
https://www.axelsw.it/pwiki/index.php/Raspberry_Pi_OSADL_EtherCat


Download image

You can download the image file from our site at url:

https://www.axelsoftware.it/download/#runtimes

Download the Full RaspberryPi image with LLExec and Node-RED file

Unzip the image

Use the preferred utility to decompress the archive (eg. WinRAR)

Program an SD or uSB (at least 8 GB)

Using the preferred utility (eg. Win32DiskImager, download from here), write rasppi.img into an SD card or uSD.

Login into the system

Login as user pi, password axel

Install LLExec PLC runtime on a standard Raspbian image

With this procedure you can install the runtime Exec in a existing Raspberry PI Raspbian image. With this procedure you will have less precise timings when using PIFace I/O expansions and Raspberry PI models 1.

Download the runtime

You can download the latest PLC runtime from our website axelsoftware.it from the Downloads section.

In the Downloads section expand the list Software -> Runtimes and please select LLExec for RaspberryPI (Linux ARM)

Unzip the runtime

Use the preferred utility to decompress the archive (eg. WinRAR)

Copy the entire directory plc on Raspberry PI

Copy in the default path that is /data/plc , and make sure the file LLExec has execute permissions.

Create a standard startup script

As an example the included LLExecDaemon can be used, and hook it to the init sequence. This script will change the current directory to /data/plc and launch the file ./LLExec, with root permissions - required.

sudo cp /data/plc/LLExecDaemon /etc/init.d
sudo ln -s /etc/init.d/LLExecDaemon /etc/rc5.d

Enable SPI driver (optional)

This step is necessary only if you use a PIFace expansion card. Run the command

sudo raspi-config

Click the Advanced options Choose the A6 SPI and press Yes for the SPI interface to be enabled at startup.

Configure the network

The Raspberry PI Image comes with a default IP address.
You can use LogicLab to change the IP address as described in the following paragraphs.
Note that you don't need to be in the same subnet of the default IP address, to select the IP with LogicLab.

Installation and first use of LogicLab

Downloads of LogicLab Automation Suite

Go to our website axelsoftware.it,
In the Downloads section expand the list Software -> LogicLab Automation Suite
Download the file LogicLab Automation Suite

Install the setup

Launch LogicLab

Press "Scan Network".
Your Raspberry PI with its IP address will be showed.
Press the circular button near the IP address to change the IP to your choice.
Press the button "+" under the column "New prj.
Give the project a name and press the OK button.

  • From the menu On-line select Setup communication.

Select the protocol GDB, then press the Properties button.

  • Check the IP address and confirm.
  • Choose Connect from the menu Online:

If everything went correctly, you should see the green word Connected on the status bar in the lower right corner of LogicLab

Demo mode and licensing

The LLExec runtime will run in demo-mode: this means that is fully operational for 30 minutes.
After this time is expired, is required to reboot the Raspberry PI.

To obtain a full license you can ask for:

  • Free licenses that will be offered ONLY after presenting a detailed description of the purpose of the license. If you need it for educational purpose please introduce you, your school and your class project including teacher references.
    PLEASE NOTE: any incomplete request will be denied.
    If the request meets all the requirements, Axel will send you a product key to activate your license trough the "Raspberry PI" node in the Resources panel of LogicLab.
  • Commercial license: please ask for a quotation.

To request a license you need first to send an email to support@axelsw.it.

Extend runtime

Please consult the page Raspberry Pi Dev

More information

About LogicLab

For more information you can consult the online manual, or follow our tutorials available in the news section of the website or on YouTube by following the link below:

https://www.youtube.com/user/Axelsrl

In case of troubles: save a Log File

In the case of any trouble, you can save the log file, this file can be sent to support@axelsw.it Steps:

  • login into the Raspberry PI
  • acquire root priviledges
sudo -s
  • go to directory /data/plc
  • launch ./AlTracePrint LLExec
  • press s
  • insert the preferred filename
  • then press q to quit AlTracePrint
  • send us the log file you saved

Supported PLC runtime features

  • PLC application in machine executable code
  • Object-oriented programming supported
  • Hot swap download: allowing you to download the new application without halting the current execution
  • Floating point support: for optimized floating point operations
  • Extended string support: for optimized string operations
  • Extended math support: for optimized math operations
  • Relocatable code: for optimized memory usage
  • Source code download and upload: allowing you to download the project source code on the target and to retrieve it in a second moment
  • On-line debug: advanced debug instrument which allow you to see current symbols value directly inside the editor
  • Triggers and graphic triggers debugging instruments
  • Breakpoints and step debug
  • Synchronous I/O forcing
  • Dynamic check of stack integrity
  • Dynamic check of array validity
  • Dynamic check of pointers validity

Support

For any technical issue please send an email support@axelsw.it