**5.2 Design and implementation of SCADA and RFID system**

The practically developed, designed and implemented system is specialized embedded SCADA and RFID system realized using open source hardware and software technologies [9, 10]. Implemented system enables:


Process of design and implementation of the system was performed in next phases: hardware design, Bootloader design, Linux kernel and Device Tree design, ROOTFS and supporting applications, preparation of SD (Secure Digital) memory card, microcontroller programs design and programming. It was used one systematic approach for proper and optimized design of the system with the aim that the system performs all required functions and operations. Block scheme of designed and implemented system is shown in **Figure 5**.

The hardware in implemented system consists of open source elements: Pandaboard, Arduino/Genuino boards, LCD display, WiFi router, appropriate electronics and sensors.

The Pandaboard is open source development board based on dual-core 32-bit high-performance multimedia application microprocessor Open Multimedia Application Platform 4430 (OMAP 4430) and 1GB RAM and SoC (System on Chip) architecture [23]. Microprocessor OMAP 4430 is based on ARM (Advanced RISC Machine) Cortex-A9 architecture with very good performances and very small electrical energy consumption. The Pandaboard enables support for higher level operating systems and has performances that satisfy all needed requirements for central station in implemented SCADA and RFID system.

The Arduino/Genuino Uno and Arduino/Genuino Mega 2560 are open source development boards based on high performance, low power Atmel AVR 8-bit microcontrollers ATmega328P and ATmega2560, respectively, with supporting programs and libraries [24]. In the system design were used the Arduino/Genuino development boards to decrease time for performing needed operations and to increase possible distance between the system modules.

**Figure 5.** *Block scheme of implemented SCADA and RFID system.*

Software of the system was implemented using open source software tools and programs. Appropriate open source tools and programs were used for development and implementation of software for Pandaboard and for Arduino/Genuino boards.

For implementation of hardware of the system were used: Pandaboard as central station, Arduino/Genuino boards as remote stations (system modules) and part for communication with the modules, additional electronics for the boards, electronics for control of high-power consumers, electronics for communication with LCD display, WiFi router TP-Link TL-WR740N. For implementation of additional electronics for Arduino/Genuino boards were used: Arduino/Genuino Mega 2560 board, I2C RTC (Real-Time Clock) based on DS3231 and AT24C32 circuits, modules.

Arduino/Genuino Mega 2560 board realizes communication of remote modules with the Pandaboard as central station. Such is enabled communication of the Pandaboard with four modules. Total number of remote stations in the system can be increased using multiplexors. The RTC circuit that provides information about the exact time even in a situation when the entire system is left without the main power supply source is connected on the Arduino/Genuino Mega 2560 board. Such operation is enabled by a battery integrated into the RTC circuit.

For implementation of the module (remote station) were used: Arduino/ Genuino Uno board; temperature and air humidity sensor DHT11; RFID sensor MFRC522. The remote station enables system management and control using RFID tags from remote locations. It also sends needed information from the sensors to central station Pandaboard that has to perform appropriate actions on the complete system. This solution was selected to enable as much as possible system modularization. This way of design also enables easier service, maintenance and diagnostics of the errors in the system. It gives possibility for quick fault detection and replacement or repair of faulty module in event of a malfunction in the system. The system modularity results in higher reliability and greater configurability of the systems. So, it is faster and easier to customize and optimize the system in accordance with needs of user. Scheme of the module and scheme of additional electronics for Arduino/Genuino boards is shown in **Figure 6**.

Electronics for control of high-power consumers was implemented using: relays, Darlington transistor array circuit ULN2001A, resistors, LED diodes. There are

**Figure 6.** *Scheme of module and additional electronics for Arduino/Genuino boards.*

#### *Embedded Systems Based on Open Source Platforms DOI: http://dx.doi.org/10.5772/intechopen.85806*

two high-power consumers in the system. The LED diodes indicate state of the high-power consumers, what the high-power consumer is turned on or turned off.

Elements for turning on and turning off high-power consumers do not exist in the Pandaboard. The board also can not provide sufficient current and voltage for turning on and turning off the relays needed for control of high-power consumers. So, it was necessary to design additional electronics for control of the consumers. Integrated circuit ULN2001A with the Darlington coupling of transistors and with protection diodes was used in design of the scheme. The output current that the ULN2001A integrated circuit provides is 500 mA per channel. That is enough to ensure proper operation of the relays and indicator LED diodes. For protection of the system, it is needed that the power supply of electronics for control of highpower consumers be separated from the power supply of the Pandaboard. Such it is prevented that in a case of destruction of electronics for control of high-power consumers also be destroyed the Pandaboard, and vice versa. Designed electronics for control of high-power consumers enables the users to control the consumers with characteristics of AC (0–250)V and (0–10)A or DC (0–30)V and (0–10)A.

For implementation of electronics for control of LCD display were used: voltage level shifter, I2C communication module, LCD display and additional circuits. The voltage level shifter enables communication between Pandaboard and I2C communication module and LCD display that use different power supply voltage levels. The power supply voltage of the Pandaboard is 1.8 V and the power supply voltage for the voltage level shifter, I2C communication module and LCD display is 5 V. The maximal output current of the I2C pin of the Pandaboard is 3 mA. It is sufficient for correct operation of the voltage level shifter. Integrated circuit PCF8574 was used for I2C communication and LCD display control.

Development and design of needed electronics was performed using software Proteus 8 Professional on Microsoft Windows 10 operating system. After the design, it was practically implemented hardware part of the system that was tested. It was performed additional experimentation and testing of the system hardware part in order to decrease the system energy consumption.

The system module is remote station and operates as remote station. Communication of the module with the Arduino/Genuino Mega 2560 board is performed using UART interface. GPIO pins of the Pandaboard are used for communication of Pandaboard and electronics for control of high-power consumers. Additional electronics for Arduino/Genuino boards communicates with Pandaboard using SPI interface.

The Pandaboard is central unit and central station of the implemented system. It was used WiFi router to enable connection to the Pandaboard using mobile phone, tablet, laptop and other computers. Communication of the router and the Pandaboard is performed using Ethernet protocol. So, there are enabled WiFi and Ethernet connection to the implemented system. There is possibility to disable one of the two connections with the aim to increase communication security. WPA2 security protocol is used for protection of WiFi connection.

Development and cross compiling of the system software on the development computer was started after successful testing of the system hardware. The software cross compiling was performed using the software tool arm-linux-gnueabi-\*.

Patch and source code of U-Boot bootloader v2015.10 downloaded from the Internet were used for design and implementation of Bootloader. The archived source code of the U-Boot and patch were downloaded from the Internet. In the design and implementation were performed: copying of patch into source code of U-Boot, setting parameters needed for cross compiling of U-Boot and patching of source code, deleting of not needed files and folders generated by previous compiling, cross compiling, copying of cross compiled U-Boot.

Version 4.1.14 of LINUX kernel downloaded from the Internet was used for design and implementation of the system. It was performed: programming of Device Tree file that enables correct mapping of devices during loading of LINUX kernel, setting parameters needed for cross compiling of LINUX kernel and Device Tree file, configuring of LINUX kernel, cross compiling of LINUX kernel and Device Tree file, setting of appropriate privileges to created files and folders.

During design and implementation of ROOTFS of the system first was cross compiled Busybox. It was used Busybox v1.24.1. and source code taken from the Internet. The archived source code was downloaded from the Internet and uploaded to the development computer. It was performed: setting variables needed for cross compiling of Busybox, configuration and cross compiling of Busybox, copying of needed libraries. In design and implementation of basic ROOTFS and configuring of the network were performed: creation of needed folders, creation of console devices, creation of ROOT users, setting of the network, copying of the files. During creation of ROOTFS it was used Dropbear version 2016.73 for SSH communication. It was realized: setting of variables needed for cross compiling of Dropbear, configuration and cross compiling of Dropbear, copying of needed files and folders, enabling automated starting of Dropbear when started operating system of Pandaboard.

SQLite program was used for management of data base. In the design and implementation were realized: setting variables needed for cross compiling of SQLite, configuration and cross compiling of SQLite, copying of needed files. **Figure 7** shows scheme of used data base. Information about users and RFID tags is stored and memorized in the data base. There are records about two types of users, the ordinary user and the administrator. Administrator can add new users and RFID tags, change activity state and update existing users and RFID tags. Every valid RFID identification is recorded in data base and information from sensors in that moment. For every change in data base is recorded time of change.

The Lighttpd, optimized open source HTTP server, was used for design and implementation of HTTP server. In the server design and implementation was realized: setting variables needed for cross compiling of Lighttpd, configuration and cross compiling of Lighttpd, creation of folder and copying of needed files, setting privileges to created folders and files. It was used Libxml2 library for parsing XML (Extensible Markup Language) and needed for cross compiling of PHP (Personal Home Page) used in design and implementation of web page. It was realized: setting variables needed for cross compiling of Libxml2, configuring and cross compiling of Libxml2. The PHP server-side script language was used for design and implementation of Internet web page. It was performed: setting variables needed for cross compiling of PHP, configuration of PHP, cross compiling of PHP, copying of files, creation of folder.

Application for control of high-power consumers was optimized and implemented as ash script to occupy minimum of space in implementation. Possibilities of the application are: turn on or turn off of consumer, monitoring state of consumer. Commands for control of consumers are: consumer turn on, consumer turn off, reading state of consumer.

Application for control of LCD display was also based on ash script. Command for control of LCD display gives possibility to show on the LED display needed string of text characters.

Application for communication with remote stations was written in C language. It enables acquisition of data from remote stations and recording important events into SQLite data base, and also time synchronization obtained from RTC.

It was designed and implemented graphical user interface in the form of Internet web page for monitoring and control of the system from remote locations. *Embedded Systems Based on Open Source Platforms DOI: http://dx.doi.org/10.5772/intechopen.85806*

#### **Figure 7.** *Scheme of used data base.*

For design and implementation were used next technologies: HTML (HyperText Markup Language), CSS (Cascading Style Sheets), PHP, JavaScript, AJAX (Asynchronous JavaScript And XML).

It was created and designed monitoring and control panel named PandaPower. It is needed to enter Username and Password on login page shown in **Figure 8a** during login to the system. It is not stored user Password in the data base but the hash of the user Password. In this way the administrator can not see the user Password and is prevented misuse of the data from the administrator side.

After authorization the PandaPower panel is available for the user. There are panels for ordinary user and for administrator. **Figure 8a** shows panel for ordinary user and **Figure 9a** shows panel for administrator. Ordinary user can use the panel for: Control of consumers and displaying load of SCADA system, Monitoring of consumers, network, processes and basic information of SCADA system, Displaying of the last 100 web logs. Administrator can use the panel for: Control of consumers and displaying load of SCADA system, Monitoring of consumers, network, processes and basic information of SCADA system, Displaying of the last 100 web and RFID logs, Control of RFID tags, Control of users. Every control of consumers, users and RFID tags is recorded in the data base. It is enabled to users to logout from the system after using of the PandaPower panel.

#### **Figure 8.**

*PandaPower login page (a) and panel for ordinary user (b).*

**Figure 9.** *Panel for administrator (a) and administrator monitoring panel (b).*

Administrator has possibilities to monitor and control users, consumers, network, process, RFID devices, basic information of the SCADA system. PandaPower administrator panel for monitoring consumers, network, process and basic information of the SCADA system is shown in **Figure 9b**. **Figure 10a** shows PandaPower administrator log panel that enables list of last 100 web and RFID system logs. **Figure 10b** shows administrator RFID panel for control of RFID tags.

Due to the support of Pandaboard, it was used SD memory card for storage of the data. SD memory card has appropriate performances and low cost. Formatting of SD card was performed on development computer using program fdisk on GNU/ Linux Mint 17.2 operating system. Two partitions with names BOOT and ROOTFS were created on the SD card. Then were copied LINUX kernel, Device Tree, U-Boot and ROOTFS with all needed applications to the SD card.

It was also needed to program Atmel microcontrollers in the Arduino/Genuino boards. The Arduino IDE environment was used for the programming [24].

*Embedded Systems Based on Open Source Platforms DOI: http://dx.doi.org/10.5772/intechopen.85806*


#### **Figure 10.**

*Administrator log panel (a) and administrator RFID panel (b).*

Proposed and described embedded system is relatively complex but inexpensive. With such way of design the time needed for the system design and implementation, and system cost were significantly decreased.
