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. Materials: http://ftp.oscada.org/OpenSCADA/Devices/RaspberryPi
Features:

  • Positive: abundant for IO, fast GPIO and WLAN.
  • Negative: not very cheap.
RaspberryPi.png


Parameters: Raspberry Pi Raspberry Pi2 Raspberry Pi3
Hardware platform: ARM11 (ARMv6) ARMv7 Cortex A53 (ARMv8)
Central processor: Broadcom BCM2835, 700 MHz Broadcom BCM2836, 900 MHz, 4 Cores Broadcom BCM2837 64bit, 1.2GHz, 4 Cores
Memory: 256/512 MB, integrated to CPU 512 Mb or 1Gb, integrated to CPU 1Gb, integrated to CPU
Solid memory: flash card MMC flash card MicroSD
Video subsystem: integrated video core Broadcom
Audio subsystem: integrated to CPU
Electrical power: microUSB, 5V, from 700 mA microUSB, 5V, up to 2.4A
Interfaces: 2xUSB, Ethernet 10/100M, HDMI, video RCA, Stereo Jack 3.5 mm, 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: 45 g.
Size: 85.6 × 53.98 × 17 mm

RaspberryPi openscada.png

Raspberry Pi
For working the board used special distributive Raspbian "Wheezy". 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 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 into 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 into graphical mode, but its performance insufficient for normal dynamic models of OpenSCADA execution.

Raspberry Pi 2 and 3
For working with the boards there also used a special distributive Raspbian "Wheezy". OpenSCADA has built for Work version 0.9 direct on the board and allowed memory here enough for this operation but it has 1MB and more, the building there allowed on all four threads. The building of OpenSCADA performs in packages which then placed into 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 into the cross-compiling environment and the result packages are placed into proper repository of Debian 8.

The typical graphical desktop environment into the selected distributive built on LXDE 0.5.5 (Wheezy) and 6 (Jessie) but it's 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 into 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 into 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 into 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 into 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.

1 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

2 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: