107.straton - User - Guide - GETTING STARTED WITH RaspberryPI Runtime
107.straton - User - Guide - GETTING STARTED WITH RaspberryPI Runtime
107.straton - User - Guide - GETTING STARTED WITH RaspberryPI Runtime
[email protected]
CP_R31_006_H
STRATON AUTOMATION, All Rights Reserved
The information contained in this document is the property of STRATON AUTOMATION. The
distribution and/or reproduction of all or part of this document in any form whatsoever is authorized
only with the written authorization of STRATON AUTOMATION. The technical data are used only
for the description of the product and do not constitute a guarantee of quality in the legal sense of
the term. We reserve the right to make technical changes.
2
Content
1. PREREQUISITES ...................................................................................................................................4
3
Prerequisites
1. Prerequisites
This user guide has been developed using a Raspberry Pi 4 device and a PiFace 2 IO board.
4 | 17
Installation and configuration of the Raspberry PI
Plug the SD card in your Raspberry, also connect a screen, a mouse and a keyboard.
Start the Raspberry and follow the installation steps.
The Raspberry is now ready to be used from your own computer using SSH connexions.
Reboot the Raspberry:
▪ sudo reboot
Connect it to the network using its Ethernet port.
To obtain the IP and MAC addresses, enter this command line in the terminal:
▪ ifconfig
5 | 17
Installation and configuration of the straton Runtime
6 | 17
Installation and configuration of the straton Runtime
Using an SSH Client (PuTTY in our case), connect to the Raspberry (IP address + port 22)
From version 11, an additional bash file named run.sh is provided. This helper can assist the user to select
the appropriate command line arguments.
Grant rights to the file using “chmod +x run.sh”
Launch “sudo ./run.sh --help” to display information about the arguments
Launch “sudo ./run.sh” to start t5runtime with the optimal command line arguments.
7 | 17
Download an application
In order to get a straton runtime license, you need to send the Raspberry physical/MAC address of one
of the device’s Ethernet card to STRATON AUTOMATION.
You will shortly receive your license number.
In order to activate the license, type in a console, in the same directory as the Runtime:
▪ echo Your_license_number > K5License.ini
Or create the K5License.ini file manually and put the license number inside it. Be careful with the file name,
this is case sensitive!
NOTES: he license number follows this syntax: MacAddress.0.0.abcd.efgh
If the license number is not OK, a message will warn you when starting the start of the straton runtime.
4. Download an application
Open the straton IDE and select the Demo project list (Menu
File > \xxx\DEMO.W5L), or click on the DEMO project list in
the start page.
(NOTE: clicking on the “Demo projects” title opens the demo
projects’ folder)
The project list opens. Right-click on the “Samples” project and set it as startup project, so this project will
be the one that will be built and downloaded to the runtime.
8 | 17
Download an application
RESULT IS:
The application is not yet downloaded or an error occurs during startup. More detail can be found in the
output view.
9 | 17
Install I2C Driver on Raspberry
There are some command lines to execute for enabling the i2c feature on the Raspberry.
Open a terminal on the raspberry then type:
sudo su in order to switch as the root (administrator) user
nano /etc/modprobe.d/raspi-blacklist.conf
In the opened file, add a # before the blacklist i2c-bcm2708. This will ensure the SPI interface
driver to be loaded each time the Raspberry will be started.
Press Ctrl +X to exit, type Y to confirm saving changes, then press enter.
nano /etc/modules
In the opened file, add a new line with i2c-bcm2708 and another one with i2c-dev :
Press Ctrl +X to exit, type Y to confirm saving changes, then press enter.
apt-get update in order to update the list of available packages on repository
apt-get install i2c-tools in order to install i2c driver
modprobe i2c-dev in order to activate the i2c
reboot and wait until the system has rebooted
Then, wire your i2c slaves to GPIO 2 (SDA) and GPIO 3 (SCL) (refer to the map in section Erreur ! Source
du renvoi introuvable.).
In a terminal, type sudo i2cdetect –y 1
It should discover the wired i2c slaves.
Addresses are shown in hexadecimal. Convert them to decimal to configure straton.
10 | 17
Configure I2C Port
First of all, make sure that the configuration of the GPIO does not map pins that are dedicated to the I2C
port. These pins are GPIO 2 and 3 for Raspberry V2, and GPIO 0 and 1 for Raspberry V1.
Then, in the fieldbus configuration tab, click on “Insert Configuration” button ( ):
Choose I2C, and validate.
Then click on the “Insert Mater / Port” button: and “OK”. Configure the port number to “1” (default on
the raspberry).
You have to take care of the offset. The offset of a value should be the offset of previous value plus the
size of previous value.
11 | 17
Use the dataserver on the Raspberry
7.1. Prerequisites
In this case, we will use CGI request with the pre-compiled t5web.cgi file as well as pre-coded javascript
files, both available in the ‘cgi-bin’ and ‘www’ folder present in the Runtime delivery (Refer to the section
Erreur ! Source du renvoi introuvable. of this document). The webserver will be apache2.
Install apache2:
sudo apt-get install apache2
Using Filezilla, put the ‘t5web.cgi’ file in /home/pi. Then move it to the right place, make it executable and
configure apache 2 to use cgi
sudo mv /home/pi/t5web.cgi /usr/lib/cgi-bin/
chmod +x /usr/lib/cgi-bin/t5web.cgi
sudo a2enmod cgi
sudo systemctl restart apache2
Using Filezilla, put the ‘js’ folder in /home/pi. Then move it to the right place:
sudo mv /home/pi/js /var/www/html
For certain graphics, images like *.bmp ones will be downloaded in an ‘t5html5’ folder. This must exist on
the target. In order to create it, if this does not exist:
sudo mkdir /var/www/html/t5html5
In a web browser, type the IP address of the Raspberry to check that the webserver runs well (apache2
default page must appear)
12 | 17
Use the dataserver on the Raspberry
Select the variables to be visible by the Data Server by checking the Embedded Symbol flag in the straton
variables list (dictionary on the right):
Note: you can also enable embedding all of the symbols in the straton project’s Settings.
Right-click in the straton project list > Insert New Item > Graphics.
In the graphics, create graphical elements doing a drag and drop from the list, then link the embedded
variables to it also doing a drag and drop from the variables list on the desired elements.
13 | 17
Use the dataserver on the Raspberry
14 | 17
Use the dataserver on the Raspberry
After pressing ‘OK’ the page will be downloaded to the target and a web browser will open, displaying
the HTML5 page. From here you can interact with the straton variables.
15 | 17
Frequently Asked Questions
16 | 17
How to start straton runtime on boot?
Use the following command to access the booting file
sudo nano /etc/rc.local
Then add the command lines you are using to access the straton runtime and launch it:
Revision Model
0002 Model B Revision 1.0
0003 Model B Revision 1.0 + Fuses mod and D14 removed
0004 Model B Revision 2.0 256MB, (Sony)
0005 Model B Revision 2.0 256MB, (Qisda)
0006 Model B Revision 2.0 256MB, (Egoman)
0007 Model A Revision 2.0 256MB, (Egoman)
0008 Model A Revision 2.0 256MB, (Sony)
0009 Model A Revision 2.0 256MB, (Qisda)
000d Model B Revision 2.0 512MB, (Egoman)
000e Model B Revision 2.0 512MB, (Sony)
000f Model B Revision 2.0 512MB, (Qisda)
0010 Model B+ Revision 1.0 512MB, (Sony)
0011 Model Compute Module Revision 1.0 512MB, (Sony)
0012 Model A+ Revision 1.0 256MB, (Sony)
0013 Model B+ Revision 1.2 512MB
a01041 Model 2 B Revision 1.1 1GB, (Sony)
a21041 Model 2 B Revision 1.1 1GB, (Embest)
17 | 17