Raspberry Pi HMI
This article is intended to give some basic HMI support on the Raspberry PI runtime.
Requirements
- An HDMI display capable to display resolution of 800x480.
- A usb touch screen, or a usb mouse supported by the Raspbian distribution.
Target configuration
The steps to follow are simply to modify the LLExecLinux.conf file, under directory /data/plc
You have to uncomment one of these section, please select the correct one about your Raspberry PI model:
<!-- For Raspberry PI <= 3 -->
<runtime filename="./LLXRt_Linux_ARM_HMI.so" area="1" targetId="RaspPI_2p2" targetComm="RaspPI_HMI">
<memory>
<databit size="0x0"/>
<dataret size="0x0"/>
<debug size="0x400000"/>
</memory>
<tasks>
<task name="Draw" id="0" period="20000" type="worker"/>
<task name="Refresh" id="1" period="20000" type="worker"/>
<task name="Trend" id="2" period="100000" type="worker"/>
</tasks>
<params>
<param name="vnc_enable" value="false"/>
</params>
</runtime>
<!-- Raspberry PI >= 4 -->
<runtime filename="./LLXRt_Linux_ARM_HMI_RASPPI4.so" area="1" targetId="RaspPI_2p2" targetComm="RaspPI_HMI">
<memory>
<databit size="0x0"/>
<dataret size="0x0"/>
<debug size="0x400000"/>
</memory>
<tasks>
<task name="Draw" id="0" period="20000" type="worker"/>
<task name="Refresh" id="1" period="20000" type="worker"/>
<task name="Trend" id="2" period="100000" type="worker"/>
</tasks>
<params>
<param name="vnc_enable" value="false"/>
</params>
</runtime>
then you must restart your Raspberry PI.
Please set the targetId to the right PageLab / LogicLab target release.
Screen resolution on Raspberry PI 4
On Raspberry PI 4 you must use the utility raspi-config to set the preferred screen resolution and to activate the CLI (Command Line Interface) instead of the graphic login.
Once set the desired resolution, in every PageLab Project that resolution must be set:
In the "Project tree" right click on the "Properties" node and select Open entry.
Set the right screen resolution and save the PageLab project.
Using Pagelab
Configuration
Open PageLab software, the click on New project button.
Select target Raspberry PI 2.0 then give a name to the project.
Click on menu Project ==> Communication settings.
Select the GDB protocol and click on button Properties to specify the actual IP of the Raspberry.
Create a page
On the project tree, please right click on the Pages node then press Insert page.
Double click on the new page node, from the PLC Vars pane drag the sysSeconds variable in the page,
then select Edit control.
Compile and download
Select menu Project ==> Generate code
Select menu Project ==> Download project
Touchscreen calibration
LLExec supports virtually any touchscreen interface managed by Linux, but it requires a calibration step in order to work.
To do this please select the screen resolution and set it in both raspi-config tool and in the PageLab project properties.
Use Pagelab to download a simple project with just one page.
When the page is shown on the display, connect to Raspberry with SSH and type the following commands:
sudo -s
/etc/init.d/LLExecDaemon stop
cd /data/plc
. ./setEnvTS.sh
ts_calibrate
An image on screen will appear asking the user to touch the screen in the showed points.
After this configuration is done, type
sync
reboot
The touch screen will be calibrated.