Raspberry Pi: Difference between revisions

From Axel Public Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
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__
===(0) 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 and Raspberry PI 3 model B, with 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.  
The runtime PLC runs even without I/O expansion, it can be used to drive standard fieldbus modules, following the Modbus TCP standard.  
Line 7: Line 7:
image.
image.


=== (0.1) Software Setup ===
=== Software Setup ===
You can proceed in two alternative ways:
You can proceed in two alternative ways:
* '''(1)''' program a SD or uSD card with a full Raspbian image, already configured to run LLExec PLC runtime.
* '''(1)''' program a SD or uSD card with a full Raspbian image, already configured to run LLExec PLC runtime.
Line 14: Line 14:




== (1) program a SD or uSD card with a full Raspbian image, already configured to run LLExec PLC runtime ==
== 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 image is used to program an SD card, containing:
* the Raspbian distribution
* the Raspbian distribution
Line 21: Line 21:
* the LLExec PLC runtime
* the LLExec PLC runtime


===(1.1) Download image ===
=== Download image ===
You can download download the file '''rasppi_160323_raspbian_patched_kernel_PLC.rar''' from our site at url:
You can download download the file '''rasppi_160323_raspbian_patched_kernel_PLC.rar''' from our site at url:
  http://www.axelsw.it/pwiki/pub/rasppi_160323_raspbian_patched_kernel_PLC.rar
  http://www.axelsw.it/pwiki/pub/rasppi_160323_raspbian_patched_kernel_PLC.rar


===(1.2) Unzip the image ===
=== Unzip the image ===
Use the preferred utility to decompress the archive (eg. WinRAR)
Use the preferred utility to decompress the archive (eg. WinRAR)


===(1.3) 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), write rasppi.img into an  
SD card or uSD.
SD card or uSD.


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




==(1/b) install LLExec PLC runtime on a standard Raspbian image.==
== Install LLExec PLC runtime on a standard Raspbian image ==
With this procedure you can install the runtime Exec in a existent Raspberry PI Raspbian image.
With this procedure you can install the runtime Exec in a existent Raspberry PI Raspbian image.
With this procedure you will have less precise timings when using PIFace I/O expansions and Raspberry PI models 1.
With this procedure you will have less precise timings when using PIFace I/O expansions and Raspberry PI models 1.


===(1 / b.1) Download the runtime ===
=== Download the runtime ===
You can download the file '''LLExec_2.2.2_Linux_ARM_RaspPI.tgz''' from our website '''www.axelsw.it''' from the Downloads section.
You can download the file '''LLExec_2.2.2_Linux_ARM_RaspPI.tgz''' from our website '''www.axelsw.it''' from the Downloads section.


Line 46: Line 46:
select '''LLexec Linux ARM RaspPI'''
select '''LLexec Linux ARM RaspPI'''


==(1 / b.2) Unzip the runtime ==  
=== Unzip the runtime ===  
Use the preferred utility to decompress the archive (eg. WinRAR)
Use the preferred utility to decompress the archive (eg. WinRAR)


==(1 / b.3) Copy the entire directory plc on Raspberry PI ==
=== 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.
Copy in the default path that is '''/data/plc''' , and make sure the file '''LLExec''' has execute permissions.


==(1 / b.4) Create a standard startup script ==
=== Create a standard startup script ===
As an example the included '''LLExecDaemon''' can be used, and hook it to the init sequence.
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.
This script will change the current directory to '''/data/plc''' and launch the file '''./LLExec''', with root permissions - required.


==(1 / b.5) Enable SPI driver (optional) ==
=== Enable SPI driver (optional) ===
This step is necessary only if you use a PIFace expansion card.
This step is necessary only if you use a PIFace expansion card.
Run the command
Run the command
Line 63: Line 63:
Choose the '''A6 SPI''' and press '''Yes''' for the SPI interface to be enabled at startup.
Choose the '''A6 SPI''' and press '''Yes''' for the SPI interface to be enabled at startup.


==(1 / b.6) Configure the network ==
=== Configure the network ===
Change the file '''/etc/network/interfaces''' in order to assign your preferred IP address.
Change the file '''/etc/network/interfaces''' in order to assign your preferred IP address.




==(2) Get the free license ==
== Get the free license ==
* Login as user '''pi''', password '''axel'''
* Login as user '''pi''', password '''axel'''
and acquire root privileges with the command
and acquire root privileges with the command
Line 81: Line 81:
  ...
  ...
  GetHardwareIDs returned 1
  GetHardwareIDs returned 1
     HardwareID 0: 8ade035e7521fca1
     HardwareID 0: '''8ade035e7521fca1'''
  Error reading current license key
  Error reading current license key
  !! License key is invalid or missing
  !! License key is invalid or missing
Line 96: Line 96:




==(3) Installation and first use of LogicLab ==
== Installation and first use of LogicLab ==
=== (3.1) Downloads of LogicLab Automation Suite ===
=== Downloads of LogicLab Automation Suite ===
Go to our website '''www.axelsw.it''',
Go to our website '''www.axelsw.it''',
In the '''Downloads''' section expand the list '''Software -> LogicLab Automation Suite'''
In the '''Downloads''' section expand the list '''Software -> LogicLab Automation Suite'''
Download the file '''LogicLab Automation Suite'''
Download the file '''LogicLab Automation Suite'''


===(3.2) Install the setup ===
=== Install the setup ===


===(3.3) Launch LogicLab ===
=== Launch LogicLab ===
Press '''New Project'''
Press '''New Project'''
Select target '''Raspberry Pi 1.1'''
Select target '''Raspberry Pi 1.1'''

Revision as of 14:06, 4 October 2016

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

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 runtime PLC runs even without I/O expansion, it can be used to drive standard fieldbus modules, following the Modbus TCP standard. 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:

  • (1) program a SD or uSD card with a full Raspbian image, already configured to run LLExec PLC runtime.
  • (1/b) install LLExec PLC runtime on a standard Raspbian image.

Follow one of the two options, then go to section (2) Get the free license


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
  • 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.
Note: if you are using Raspberry PI 2 or 3, this kernel is not needed.
  • the LLExec PLC runtime

Download image

You can download download the file rasppi_160323_raspbian_patched_kernel_PLC.rar from our site at url:

http://www.axelsw.it/pwiki/pub/rasppi_160323_raspbian_patched_kernel_PLC.rar

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), 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 existent 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 file LLExec_2.2.2_Linux_ARM_RaspPI.tgz from our website www.axelsw.it from the Downloads section.

In the Downloads section expand the list Software -> Runtimes and please select LLexec Linux ARM RaspPI

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.

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

Change the file /etc/network/interfaces in order to assign your preferred IP address.


Get the free license

  • Login as user pi, password axel

and acquire root privileges with the command

sudo -s
  • Stop the LLExec process, if running, with the command
/etc/init.d/LLExecDaemon stop
  • Change to the directory /data/plc and issue the command
./LLExec -tm -1

It prints a series of logs that will end with these last lines

...
GetHardwareIDs returned 1
   HardwareID 0: 8ade035e7521fca1
Error reading current license key
!! License key is invalid or missing
LLEXEC main finished

Send a mail to support@axelsw.it with the HardwareID of your device (in this case 8ade035e7521fca1) Axel will send you the LLExec.key file related to your hardware. Install the license overwriting the file in the directory /data/plc with the one sent by Axel and reboot the system, The PLC should be started, you can now download out lates LogicLab automation suite, and connect to your target. Please follow tutorials on YouTube channel


Installation and first use of LogicLab

Downloads of LogicLab Automation Suite

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

Install the setup

Launch LogicLab

Press New Project Select target Raspberry Pi 1.1 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.

  • Change the IP address, with your Raspberry PI one 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

More informations

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 throubles: save a Log File

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

  • login into the Raspberry PI
  • acquire root priviledges
su -s
  • go to directory /data/plc
  • launch ./AlTracePrint
  • Enter Area name to trace:

enter LLExec

  • press s
  • insert the preferred filename
  • then press q to quit AlTracePrint