PROPOSAL OF A PROGRAMMABLE LOGIC CONTROLLER BASED ON OPEN HARDWARE

Industrial automation is dominated by solutions that are implemented with distributed controllers, such as programmable logic controllers. Currently, companies such as Industrial Shields, Norvi, Controllino


I. INTRODUCTION
Industrial automation is the application of different technologies to control and monitor a process.It is currently dominated by solutions that are implemented with distributed controllers, such as Programmable Logic Controllers (PLC) [1].Unlike general-purpose computers, a PLC is designed with multiple input/output channels, extended temperature ranges, electrical noise immunity, vibration and shock resistance, real-time operation capability, and compliance with established international standards [2], [3].
The use of programmable controllers in industry has improved efficiency in the use of time, which translates into a reduction in production costs [4].However, its implementation generally requires significant capital investments, a fact that prevents many companies to start the process of updating their control systems [5].
The evolution of open hardware and single-board embedded minicomputers has grown exponentially in the last decade due to the accelerated decrease in their manufacturing cost [6].As a result, these platforms have been used in a myriad of applications ranging from amateur electronics to advanced robotics and industrial control [6].Currently, several foreign companies and enterprises offer certified industrial controller solutions based on open hardware.They represent a low-cost commercial alternative to traditional approaches [7], [8].
In Cuba, companies such as Empresa de Tecnología de la Información y la Automática (ATI) and Empresa de Automatización Integral (CEDAI) stand out in the field of automation.The last one after a study determined that there is a need in the country for simple controllers for applications of small and medium complexity.From the determination of this need, the company CEDAI made an express request to the Department of Automatic Control of Universidad Central "Marta Abreu" de Las Villas to conduct a joint project aimed at designing a controller of this type.In this way, CEDAI established technical requirements and provided experience in working with several of the required hardware elements.
This study is the result of the collaboration between the Universidad Central "Marta Abreu" de Las Villas and the company CEDAI UEB Villa Clara.It shows an analysis of current trends in the development of industrial controllers based on open hardware worldwide.As part of the analysis, an approach to the devices of this type designed in Cuba is made.Finally, the objective of this article is to make a proposal for a programmable controller based on open hardware that is an economical and flexible alternative for industrial automation.

II. THEORETICAL REFERENCE
The International Electrotechnical Commission (IEC) is a worldwide standardization organization whose objective is the alignment of positions and the creation of standards in the fields of electronics and electricity [9].Due to the need to normalize perceptions in the field of programmable controllers, the IEC created IEC 61131.This standard defines a programmable controller as: "An electronic system with digital operation, designed for use in an industrial environment, using a programmable memory for the internal storage of user-oriented instructions for the implementation of specific logical, sequential, timing, counting and arithmetic functions to control, by means of analog or digital inputs and outputs, different types of machines or processes" [10].
The IEC 61131 standard in its parts establishes the requirements to be met by a PLC, while clearly defining the tests and verifications to be performed on them.Therefore, the development of the proposed design and the prototyping of the same must be ruled by these regulations [11].It is based on proven techniques, which are currently used in several forms and in many control products.Therefore, it integrally defines the entire design process for PLC including programming languages, implementation, communication, and technical documentation [12].

II.1 CURRENT TRENDS IN OPEN HARDWARE
The statement of principles of open hardware defines it as: "Hardware whose design is made available to the public so that anyone can study, modify, distribute, make and sell the design or hardware that is based on that design [13].Among the open hardware platforms employed are Arduino, Raspberry, and STM32, which have gained popularity for their flexibility and low cost.
Arduino is an open-source prototyping platform based on flexible and easy-to-use hardware and software.Its most popular variants are the Arduino Nano, the Arduino Uno shown in Fig. 1a, and the Arduino Mega.These are development boards based primarily on ATMEL microcontrollers that make it possible for anyone to make use of this tool, even people with no experience in electronics or programming [14], [15].One of its greatest advantages is its worldwide support; a large number of users develop their projects and share their results and experiences, thus facilitating learning [16].Its main applications range from prototyping, small projects or educational robotics to more advanced purposes such as home automation or the Internet of Things (IoT) [17].
Working with Arduino allows designers and developers to quickly prototype interactive electronic projects and test their functionality before integrating them into the final product.This involves conceptualizing and building a sample product, which is then tested and refined through several stages before deployment.These steps are usually independent of the application domain and can be applied to a wide range of projects [18].
Raspberry Pi is a low-cost embedded minicomputer, like the one shown in Fig. 1b, which was created with the purpose of introducing programming to the educational environment [19].It has a power comparable to most cell phones and can perform tasks such as multimedia player management, programming, or servers without problems of technical limitations.Among its potential applications is an auxiliary controller in low-cost systems, taking advantage of its high processing capacity [20].Given their hardware performance, operating systems can be installed on them, similar to computers [21].
The achievable performance, hence the user's perception, depends fundamentally on the available hardware platform.Embedded system development must take into account hardware characteristics; timing, memory usage, power consumption, and physical failures [22].Although the platforms described above have been used in industry, their design is considered not robust enough to withstand an aggressive industrial environment with high electromagnetic noise and harsh environmental conditions [23].There are studies that determine that, although in recent years they are moving from being simply experimental platforms to entering the world of industry, they are not the best option for critical applications [22].
It is important to note that, in Cuba, the environment is hostile to technologies, especially in areas close to the sea.Tropicalization is a common problem on the island, which results in a high rate of degradation of PCB coatings due to high temperature, relative humidity, intense solar radiation, and corrosion of welds due to high salinity in the air [24].In addition, adverse operating conditions, such as oscillation and regular power outages, must also be faced.
In this situation, the use of STM32 microcontrollers has emerged as an alternative, an industrial platform that offers greater performance where Arduino and Raspberry have some weaknesses.STM32 is a family of 32-bit microcontroller integrated Circuits (IC) from ST Microelectronics [23].These IC are grouped in series, based on a 32-bit ARM processor core.The STM32 family of microcontrollers provides a basis for designing a wide range of embedded systems, from simple projects to complex real-time systems [25].It includes dozens of different configurations that provide a wide variety of options in memory sizes, available peripherals, performance, and power and offer development boards such as the Evaluation board, Discovery, or Nucleo shown in Fig. 1c.According to [26] they are comparable in cost to the parts used for Arduino boards but offer significantly higher performance and more powerful peripherals.Development for the STM32 family has an extensive range of documentation and software libraries focused primarily on professionals [23].In contrast, the Arduino platform offers a simple application library and a single toolchain that is accessible to relatively inexperienced programmers.For many simple systems, this offers a fast path to prototyping; however, simplicity has its costs.
The Automatic Control Department of the UCLV has a proven track record in the development of concept prototypes for embedded applications.PCB development, system assembly, and subsequent implementation in real operating environments are tasks commonly faced by its researchers.This work has been recognized and published in prestigious academic journals [27]- [29].

II.2 CONTROLLERS BASED ON OPEN HARDWARE
The progress and performance of open hardware devices led PLC manufacturers to install development boards of these platforms in their logic controllers [30], [31].This idea opens the way to a new world of industrial automation and motivates professionals in this field to develop new systems under the philosophy of open hardware and software.Also, under this conception, it is possible to migrate the systems currently installed and increase the functionalities already obtained, with the advantages of programming on open platforms.
This type of initiative and project is well received by the automation sector.It is visible the lack of tools and elements that allow an improvement in the optimization of resources and processes of small and medium industries, that fit the needs of companies, and in turn, encourage the development of innovation and entrepreneurship projects [30].However, several projects have tried to integrate open hardware platforms into industrial controls with the objective of their implementation in factories or for educational purposes.
In [32], the author discusses a model of a small-scale industrial system, which performs sequential operations using relays.The system shuts down automatically once it detects high levels of water or temperature, which are dangerous for industrial operations.This model is implemented using an Arduino microcontroller, which, according to the author, proves to be the most viable alternative.
The work presented in [33] shows a data acquisition system based on open hardware and software that is designed to be used as a teaching tool in the Science and Engineering Laboratories of the Universidad Nacional General Sarmiento.The system is composed of a hardware device, based on an Arduino Due and a set of sensors or signal adapters that transform the physical values of interest into the appropriate electrical signals.Computer software communicates with the device to configure it and obtain readings, whose values it displays and stores.
The author of [6] develops a PLC based on the Atmega328p microcontroller.Its programming was carried out in the integrated development environment (IDE) of Arduino and validation tests were performed where it showed a correct operation controlling loads of high and medium consumption.The main objective was to be used by various sectors of the municipal and regional industry in the town of Santander and additionally collaborate with learning in careers related to industrial electronics, automation, and control.
The project developed by [34] aims to design, build and implement a learning module oriented to physical and virtual instrumentation through Arduino PLC, applied in a dosing and mixing process.The system includes the monitoring of the entire process through a human-machine interface (HMI), to give students the facility to learn more industrial use designs with Arduino.
Currently, there are several companies developing logic controllers for industrial use.They are based on Arduino and other open platforms and their products are available in the market.It is necessary to point out that all the devices presented in this work are designed to be used in applications of small and medium complexity and according to their manufacturers, these products are not endorsed for use in processes that require critical safety.The following is an analysis of several alternatives that stand out for their quality, performance, and cost.Figure 2: Controllers of the different companies.Source: Authors, (2020).
The Spanish company Industrial Shields is dedicated to the design, production, and marketing of certified devices based on open hardware.Its products include PLC based on Arduino devices, which use the Arduino IDE as a programming platform.They can also incorporate HMI screens based on Raspberry Pi that the company itself markets and support USB, serial RS232 and RS485, and I2C communication protocols [9], [30].
The company has a basic controller product and two PLC ranges [35], the PLC 20 I/O (ARDBOX 20 I/O relay variant and analog variant) and the Ethernet PLC (M-Duino) [36], [37].Industrial Shields aims to generate a wide range of products at a reasonable price and comparable in terms of requirements with traditional options.These are products with the capabilities to work in an industrial environment and are therefore very suitable solutions for small and medium-sized installations.This equipment complies with the EN 61010 standard associated with the safety requirements for electrical equipment for measurement, control, and laboratory use [38].
Norvi, a Sri Lankan company, is another leading developer of controllers for the industry based on open technologies.Its main products are the industrial controllers Norvi IIOT, Norvi CEMA, and Norvi ARITA.The devices developed by Norvi are certified to comply with EN 61010-1 and EN 61010-2-201 standards related to safety requirements for electrical equipment for measurement, control, and laboratory use, as well as IEC 61131-2, which specifies requirements and technical tests for programmable controllers and their associated peripherals [39].
In these PLC variants, there are two that employ other hardware than Arduino devices.According to [40] in the case of the Norvi IIOT it uses an ESP32-WROOM device as the central processing unit.ESP32 are low-cost devices similar to Arduino but have higher speed, memory, and communication interfaces such as Wi-Fi and Bluetooth and dual-core architecture [41], [42].The Norvi Arita, in its high-efficiency industrial alternative, uses an STM32 microcontroller which presents an architecture suitable for its exploitation in industrial environments [40].
Controllino is a German company, dedicated to the manufacture of industrial PLC based on the Arduino platform, using different environments such as the Arduino IDE, Programino, LabView, or ATMEL Studio as programming software [30].There are three types of these controllers currently available on the market the Controllino MINI, MAXI, and MEGA, all with different technical characteristics [43].Their products use the Atmega 328p microcontroller in its most compact versions and the Atmega 2560 in the MAXI and MEGA variants.The latter is the most representative due to its large number of inputs and outputs and the possibility of using Ethernet communication interfaces [36].
The company's controllers are manufactured in compliance with industrial and safety standards such as EN 61010-1, EN 61010-2-201, and IEC 61131-1, which validate the product along with the rest of its potential [44].
The Opta PLC is the first micro-PLC with industrial IoT capabilities designed by the Arduino company in cooperation with the Finder company.According to the manufacturer, it was designed to be used by PLC engineers as well as Arduino enthusiasts.It can operate in diverse areas such as industrial IoT, building automation, electrical load management, and industrial automation.It employs the STM32H747XI dual-core Cortex M7 + M4 MCU as its processing core [45].
Additionally, it supports the 5 traditional programming languages defined in the IEC 61131/3 functionalities while allowing flexibility and easy deployment of the Arduino platform using Arduino IDE.The device is available in 3 variants Opta Lite, Opta RS485, and Opta Wi-Fi.The RS485 model has the same capabilities as the Lite but adds an RS485 communication interface.The Wi-Fi variant adds Bluetooth and Wi-Fi communications [46].The controllers marketed by Industrial Shields, Norvi, Controllino, and Arduino, mentioned above, are capable of meeting the requirements of small and medium-scale processes.Their technical characteristics are shown in Table 1, they are suitable for such applications and have, for the most part, sufficient communication interfaces to be integrated into current industries.However, they do not have the capacity to work in applications that require high levels of safety, they are not programmable according to the 5 languages established by the IEC 61131-3 standard and, despite having industrial certifications, only the Norvi and Controllino controllers comply with the requirements of the 61131-2 standard.

II.3 CONTROLLERS DEVELOPED IN CUBA
From the experiences in the use of PLCs in the sugarcane process, it was decided at the time to manufacture a controller suitable for the needs of the sugar industry in Cuba.In this sense, three specific products were developed and marketed for several years: the PLC Nova, the EROS, and the EROS mPLC.These devices are programmable using the 5 languages of the IEC 61131-3 standard, for which they use the EROS PG software [47].
The Nova and EROS controllers are medium-sized devices with a large number of analog and digital inputs and outputs, as well as RS232/RS485 serial communication interfaces.In addition to these intrinsic features, there is the possibility of connecting expansion modules, which allows them to expand their potential and achieve scalability.The EROS mPLC was designed for process or manufacturing control, with the possibility of operating as an HMI using its integrated keyboard and display for supervision and control from the field.Additionally, it can function as a weighing and batching system, as well as for machine tool automation [48].
These devices had a high memory compared to similar devices of the time.Their design is highly immune to noise and can be operated under adverse temperature and vibration conditions.Over time, revisions were made to improve its performance; however, no recent updates or improvements in its features are reported [47], [49].Although its appearance in the domestic market was a breakthrough for several sectors of the industry, currently its features and availability place it below the controllers that are available in the market.

III. MATERIALS AND METHODS
Design decisions influence the sensitivity of a product to variations in raw materials and working conditions, which in turn affects manufacturing costs [50].Since a trade-off between performance and safety is necessary to ensure reliable and safe control, five fundamental requirements are identified: real-time performance, reliability, sustainability, survivability, and critical safety.
 Real-time performance: In the case of considering realtime requirements during PLC operation, critical parameters must be considered for the correct work of the system such as timing parameters, whose non-compliance will result in one of the system's timing errors or not emitting a control signal at a given time [50].
 Reliability was defined by [8] as quality over time. Sustainability: "that development which is capable of meeting the needs of the present without compromising the ability of future generations to meet their own needs" [8].
 Survivability can be defined as "the ability of a system to fulfill its mission and, therefore, to cope with malicious, deliberate or accidental failures in a timely manner" [4].
 Safety critical: those systems that can potentially lead to serious catastrophic consequences due to the existence of unplanned events, which could result in human death or injury [50].
Proper controller design can improve system performance.In order to meet the demands of complex applications, the architecture of controllers must be universal, open, modular, and easily expandable.The application of standards allows systems that are developed according to their specifications to have important characteristics in terms of efficiency, quality, and above all, safety [10].From the commercial point of view, although compliance with various standards is not mandatory, having the certification of organizations such as the IEC guarantees the devices created, makes the product more competitive in the market, and reduces installation and commissioning costs.
In Cuba, the CEDAI company, also in line with national science and innovation policies, is aware of the need for a low-cost, locally produced controller to boost the competitiveness of Cuban companies.Therefore, this work is part of a project in which the Central University "Marta Abreu" of Las Villas and the Integral Automation Company CEDAI UEB VC collaborate.The aim of this project is to implement a line of research in low-cost industrial controllers that meet the needs of industry in applications of small and medium complexity.
The MCI-VC v1.0, the name given to the design, is intended to be a compact, low-cost, STM32 microcontroller-based automaton that complies with the IEC 61131 standard.The aim is to achieve, in principle, a minimum unit to be used in small and medium-complexity tasks that do not require critical safety.From the analysis of each of the PLCs with open technologies shown above and according to the specifications that are considered of greater importance in industrial processes, the technical and functional requirements of the programmable controller to be designed can be defined.

IV. CONTROLLER ARCHITECTURE
In accordance with the technical characteristics defined for the programmable controller, it is necessary to specify its structure.Fig. 3 shows the general hardware scheme to be used in the design.This architecture constitutes the conceptual basis for the design of the controller.It defines its main functional characteristics and the relationship between the fundamental elements that make it up.

V. PHYSICAL DISTRIBUTION OF THE CONTROLLER
A modular implementation has been proposed for the industrial controller under development, according to the hardware model defined in the standards.The internal power supply units, the central processing and communications unit, and the input/output unit must be distributed independently.
The CPU module must be placed on top of the rest of the boards.It contains the communication interfaces of the controller and storage, as well as the STM32 microcontroller unit with its respective conditioning.It also contains connectors for the signals coming from the input/output board and for the connection of the external programming and debugging device ST-Link.
The input-output board must contain the 8 conventional 24 V digital inputs and the 4 fast inputs, the 6 configurable analog inputs, and the relay and transistor digital outputs, as well as their respective conditioning.It receives the 24 V and 9 V signals from the power supply and the ground references of the digital and analog circuits separately.The states of the input interfaces and the 9 V from the internal power supply are sent from this unit to the CPU board.Commands for handling the outputs and the analog selector are also received.Communication between the two units is via a 38-pin connector.
The controller shall have connectors for input and output interfaces and two 24 V terminals for powering external devices.The inputs shall be located at the bottom of the controller and the outputs shall be positioned at the top.The external connectors for RS-485 communication via DB9 female, Ethernet via RJ45 and USB as well as storage via SD card will be included on the front.On the sides, only the expansion bus connector shall be located on the right side of the equipment so that each module located in the rack is in this direction.Additionally, the connector for the external 100-240 VAC power supply must be located at the bottom.
The commercial destination for these devices may be initially focused on the domestic market, especially the industrial sector.It can also be used in the control of various auxiliary services for the tourism sector, health, management, and residential buildings.The estimated cost of a unit should be close to 200 USD, which makes the product competitive in the Cuban market.This price is below all the aforementioned equipment, which costs between 200 and 500 USD.

VI. CONCLUSIONS
After the analysis carried out in relation to programmable controllers for industry and the role played by open hardware for the implementation of the same today, the following conclusions are established.
The current development of open hardware technologies positions is an emerging and at the same time indispensable part in the conception of the programmable automaton for modern industry.STM32 microcontrollers represent a strong alternative to solve the shortcomings in terms of performance and robustness that can present, especially in industrial environments, other hardware platforms such as Arduino, Raspberry Pi, or the Z80 used in Cuban controllers.
The proposed design meets the technical requirements defined and has similar technical characteristics to controllers that are currently marketed while achieving a reduction in costs.It's modular conception and physical distribution allow an adequate insertion in industrial environments.In addition, the design allows the scalability of a higher-performance model and the expansion of its functionalities.

Table 1 :
Characteristics of controllers based on open hardware.