From OpenSCADAWiki
Jump to: navigation, search
This page contains changes which are not marked for translation.

Single-board computers Raspberry Pi from the Raspberry Pi foundations
Begin: 08 (August) 2012
Participants: Roman Savochenko
Description: "Raspberry Pi®" is a single-board computer created for charity purposes. Designed to teach basic computer science in schools, positioned as a low-cost solution for novice developers. Developed by "Raspberry Pi Foundation". First board of Raspberry Pi was got to assembling and adaption of OpenSCADA from Maxim Lysenko. The board Raspberry Pi2 was purchased for tasks of OpenSCADA and adapting it to work with generic buses like I2c, SPI, 1Wire with different sensors on its. The board Raspberry Pi3 was purchased and sponsored by Proviron Holding NV for some debug and technical support. The board Raspberry Pi Zero W was purchased as smallest and lowest consumption board for test the specific of ARMv6.
Materials: http://ftp.oscada.org/OpenSCADA/Devices/RaspberryPi
Features:

  • Positive: abundant for IO, fast GPIO and WLAN, minimal power consumption for RPiZ.
  • Negative: not very cheap.

Means:

  • [7532.05.28/2024.07.28] Some extra means for minimisation the power consumption:
    • /usr/bin/tvservice -o — HDMI power off, up to 80mW;
    • echo none > /sys/class/leds/led0/trigger; echo 1 > /sys/class/leds/led0/brightness — LED power off, up to 10mW.
  • [7531.08/2023.10] ARMHF packages are built now for Debian 12,11,10,9,8 and ARM64 packages for Debian 12,11.
  • [7531.04.17/2023.06.17] At the least the RPi3 boards work not very stable through WLan in the Power Management mode, so we need to disable the mode by the command /usr/sbin/iwconfig wlan0 power off.
  • [7530.03.05/2022.05.05] ARMHF packages are built now for Debian 11,10,9,8 and ARM64 packages for Debian 11.
RaspberryPi.png


Parameters: Raspberry Pi A+ Raspberry Pi Zero [W] Raspberry Pi2 B Raspberry Pi3 B
Hardware platform: ARM11 (ARMv6) ARM11 (ARMv6) ARMv7 Cortex A53 (ARMv8)
Central processor: Broadcom BCM2708, 700 MHz Broadcom BCM2835, 1GHz Broadcom BCM2836, 900 MHz, 4 Cores Broadcom BCM2837 64bit, 1.2GHz, 4 Cores
Memory: 256/512 MB, integrated to CPU 1 GB, integrated to CPU 512 MB or 1 GB, integrated to CPU 1 GB, integrated to CPU
Solid memory: flash card MMC flash card MicroSD
Video subsystem: integrated video core Broadcom
Audio subsystem: integrated to CPU NA integrated to CPU
Electrical power: microUSB, 5V, [60...700?] mA microUSB, 5V, [200...700?] mA microUSB, 5, [200...1000?] mA
Interfaces: 2xUSB, Ethernet 10/100M, HDMI, video RCA, Stereo Jack 3.5 mm, UART, JTAG, SPI, I2C, DSI, CSI 1xMicroUSB, MiniHDMI, UART, JTAG, SPI, I2C, DSI, CSI 4xUSB, Ethernet 10/100M, HDMI, video RCA, Stereo Jack 3.5 mm, UART, SPI, I2C, DSI, CSI 4xUSB, Ethernet 10/100M, WiFi 802.11 b/g/n, Bluetooth 4.1 LE, HDMI, video RCA, Stereo Jack 3.5 mm, UART, SPI, I2C, DSI, CSI
Weight: 7g. 9 g. 45 g.
Size: 67.6 × 31 × 17 mm 65 × 30 × 5 mm 85.6 × 53.98 × 17 mm

RaspberryPi openscada.png

1 Raspberry Pi and Zero

Hardware CPU Entry into JavaLikeCalc, us Operation sin(Pi) [in JavaLikeCalc], us Operation pow(Pi,2) [in JavaLikeCalc], us Model AGLKS [Vision, main mnemo], %(core) Extra tests and notes
Raspberry Pi ARMv6, BCM2708, 700 MHz 1.15 [4.57] 1.28 [4.60] -


Raspberry Pi Zero ARM v6Z ARM1176JZF, BCM2835, 65nm, 1 GHz 1.66 0.862 [1.4] 0.979 [2.29] >100 Minimum power consumption (on 700MHz): 0.32W, 0.33W(+LED), 0.41W(+HDMI), 0.57W(+WIFI)
RT-tests:[!] precision_test[!] OpenSCADA[!]
Linux 4.19.66+ 0.353+3.04 [0.052] 0.494+1.362, 0.53+1.375

Initially and on Raspberry Pi A, for working the board used special distributive Raspbian. Building OpenSCADA was done on the board for LTS version 0.8.0.5 and Work version 0.8.1 direct. For building there had to be expanded the swap memory size up to 500 MB due more memory need for some modules of OpenSCADA building by modern compiler (GCC 4.7) and with optimization (-O2). Result packages successfully installed and operation.

Graphical desktop environment in the selected distributive built on LXDE 0.5.5, displayed in full resolution of the display through HDMI, or in resolution 640x480 through composite video-output. OpenSCADA successfully have started and have worked in the graphical mode, but its performance insufficient for normal dynamic models of OpenSCADA execution.

For Zero, and due to the specific of these boards as ARMv6, what different from the ordinal architecture supported by Debian ARMHF (ARMv7), there were created the different builds same on Rasbian.

2 Raspberry Pi 2 and 3

Hardware CPU Entry into JavaLikeCalc, us Operation sin(Pi) [in JavaLikeCalc], us Operation pow(Pi,2) [in JavaLikeCalc], us Model AGLKS [Vision, main mnemo], %(core) Extra tests and notes
Raspberry Pi 2 ARM Cortex-A7, BCM2836, 40nm, 900 MHz, 4 Cores 0.742
0.77
0.724 [0.988]
0.688 [0.95]
0.491 [0.868]
0.447 [0.83]
107 [168]
100 [165]
Updated: 16.09.2024
2014

Minimum power consumption (on 600MHz): 1.02W, 1.14W (+Eth), 1.33W(+WIFI)

RT-tests:[!] precision_test[!] OpenSCADA[!]
Linux 4.9.35-v7+ 0.23+4.18 [0.016] 0.385+0.918, 0.484+4.772


Raspberry Pi 3 ARM v8 Cortex-A53, BCM2837, 40nm, 1.2 GHz, 4 Cores 0.4
0.33
0.37 [0.454]
0.303 [0.4]
0.336 [0.477]
0.304 [0.41]
52 [88] ARMHF, Updated: 16.09.2024
ARM64, Updated: 03.03.2023
Minimum power consumption (on 600MHz and indifferent to enabled WIFI or Bluetooth): 1.14W, 1.39W(+Eth), 1.5W(+WIFI)
Performance for 1.8W, 600MHz: GPIO 0.3us

Starting time (JGM-T001), seconds: 14+42+5(AGLKS), 98(Boiler)

RT-tests:[!] precision_test[!] OpenSCADA[!]
Linux 4.9.35-v7+ 0.045+0.102 [0.088] 0.492+0.514, 0.456+0.657

To work with the boards there also initially used a special distributive Raspbian "Wheezy". OpenSCADA has built directly on the board for the Work version 0.9 and allowed memory here enough for this operation since it has 1GB and more, the building there allowed on all four threads. The building of OpenSCADA performs in packages which then placed in proper repository of Debian 7 from time to time of the buildings. Also for Raspbian "Jessie", mostly for the generic architecture ARMHF, there performs regular building of OpenSCADA by the OpenSCADA automatic builder in the cross-compiling environment and the result packages are placed in proper repository of Debian 8.

The typical graphical desktop environment in the selected distributive built on LXDE 0.5.5 (Wheezy) and 6 (Jessie) but it was replaced to TDE R14 for more features with low hardware demands. For remote access there was configured VNC access in display resolution 1024x768. OpenSCADA is successfully started and worked in the graphical mode and the performance here enough already by the multi-threading.

RaspberryPi TDE.png

For more free handling to the board was connected a WiFi adapter and on RPi3 it presents already.

To allow for operations with GPIO directly in OpenSCADA there was created a module DAQ.GPIO based on the library bcm2835. For now the module provides access to "Raspberry Pi" GPIO (0...31) as OpenSCADA DAQ's parameter attributes, static and dynamic functions, which the comparing information of performance shown here.

RaspberryPi experiments.jpg

To the board there was connected a 16x2 text display 1602A and a program like to the original Python one was wrote in OpenSCADA by using the static functions of the module DAQ.GPIO. As a result the program works fine and some faster to the Python original one.

To the board there were directly connected sensors DHT 11 and AM2303 (humidity and temperature) and a program like to the original Python program's C-language driver part was wrote in OpenSCADA by using the static functions of module DAQ.GPIO.

To allow creation derivative DAQ templates with their configuration the dynamic linking to static external functions was added in DAQ.JavaLikeCalc, like this:

function put = addr+".fnc_put";
if(put) {
  put(D4, vl&0x10);
  put(D5, vl&0x20);
  put(D6, vl&0x40);
  put(D7, vl&0x80);
}

To allow operation in OpenSCADA with devices on bus I2C the output transport "Serial" was adapted to the bus by selection the bus and a slave device's address (first byte of the sequence) set by IO control command I2C_SLAVE. In this way now to OpenSCADA there were connected:

  • The 8-bit A/D and D/A converter chip PCF8591. Through the chip PCF8591 were connected sensors LM35 and LM335.
  • The 8DIO converter chip PCF8574, which also adapted and tested for connection to 1602A.
  • The barometric pressure/temperature/altitude Sensor BMP180.
  • The memory chips AT24CXX by calls through the proper protocol.

The tracing task of the work out opened here.

3 Raspbian

Old distributive packages was moved to http://legacy.raspbian.org/raspbian/, then for old installations we must to change the repository line in "/etc/apt/sources.list" to one:

deb http://legacy.raspbian.org/raspbian/ stretch main contrib non-free rpi

4 GPIO

Name P1 Pin
Number
Name
2x13 Header (Model A and B)
3.3v DC Power 1 2 5v DC Power
GPIO02 (SDA1, I2C) 3 4 5v DC Power
GPIO03 (SCL1, I2C) 5 6 Ground
GPIO04 (GPIO_GCLK) 7 8 GPIO14 (TXD0)
Ground 9 10 GPIO15 (RXD0)
GPIO17 (GPIO_GEN0) 11 12 GPIO18 (GPIO_GEN1)
GPIO27 (GPIO_GEN2) 13 14 Ground
GPIO22 (GPIO_GEN3) 15 16 GPIO23 (GPIO_GEN4)
3.3v DC Power 17 18 GPIO24 (GPIO_GEN5)
GPIO10 (SPI_MOSI) 19 20 Ground
GPIO09 (SPI_MISO) 21 22 GPIO25 (GPIO_GEN6)
GPIO11 (SPI_CLK) 23 24 GPIO08 (SPI_CE0_N)
Ground 25 26 GPIO07 (SPI_CE1_N)
Extension of the Model B
ID_SD (I2C ID EEPROM) 27 28 ID_SC (I2C ID EEPROM)
GPIO05 29 30 Ground
GPIO06 31 32 GPIO12
GPIO13 33 34 Ground
GPIO19 35 36 GPIO16
GPIO26 37 38 GPIO20
Ground 39 40 GPIO21

5 LCD Touch Screen+Stylus

RaspberryPi LCD.png

3.5" (320x480) RPi LCD TFT Touchscreen Display Touch Shield SPI. Configuration procedure for RPi3 and last Raspberry Jessie: