Implementation of a PLC Сode on Raspberry Pi in CODESYS Environment
Makarcheva, Anna (2020)
Makarcheva, Anna
2020
All rights reserved. This publication is copyrighted. You may download, display and print it for Your own personal use. Commercial use is prohibited.
Julkaisun pysyvä osoite on
https://urn.fi/URN:NBN:fi:amk-202002062132
https://urn.fi/URN:NBN:fi:amk-202002062132
Tiivistelmä
This thesis project illustrated a Raspberry Pi microcontroller being used as a replacement for an industrial-grade programmable logic controller (PLC) in a data-collection application. The application, Inspector, is a tool for factory production monitoring provided by a Finnish automation company InSolution Oy, which was the commissioning party of the thesis project. Inspector is comprised of a PLC application collecting real-time data and a web application. The PLC data-collection application normally uses PLCs manufactured by Beckhoff, whereas in this project a program with the same functionality was implemented on a Raspberry Pi in CODESYS programming environment.
The theoretical part of the thesis includes information on the hardware, programming tools, languages and communication protocols used during the empirical part of the project.
In the implementation part of the project, changes were made to the original program to transfer it from TwinCAT to CODESYS environment. Most of the modifications were related to reference libraries, communication to the web client application over TCP/IP and the date and time interface. This part of the project also included the configuration of the inputs and outputs using Raspberry Pi GPIO and Horter I2C input modules.
Finally, the Raspberry Pi program was tested by establishing a connection to a web application, which revealed several issues related to the reliability of the new application in cases of power and network failures. Data persistence was added to the project along with other improvements which eliminated the discovered issues and enhanced the reliability of the application.
As an outcome of the project, a reliable and well-functioning solution was developed for possible use of Raspberry Pi instead of a Beckhoff PLC in the
Inspector tool. The developed solution provided the possibility of a significant increase in the cost-efficiency and flexibility of the tool. It was concluded that a Raspberry Pi can be a feasible replacement for a PLC in certain industrial automation applications. Moreover, the commissioning company decided to continue the project by conducting tests on the new product to prepare it to be released for customer projects.
The theoretical part of the thesis includes information on the hardware, programming tools, languages and communication protocols used during the empirical part of the project.
In the implementation part of the project, changes were made to the original program to transfer it from TwinCAT to CODESYS environment. Most of the modifications were related to reference libraries, communication to the web client application over TCP/IP and the date and time interface. This part of the project also included the configuration of the inputs and outputs using Raspberry Pi GPIO and Horter I2C input modules.
Finally, the Raspberry Pi program was tested by establishing a connection to a web application, which revealed several issues related to the reliability of the new application in cases of power and network failures. Data persistence was added to the project along with other improvements which eliminated the discovered issues and enhanced the reliability of the application.
As an outcome of the project, a reliable and well-functioning solution was developed for possible use of Raspberry Pi instead of a Beckhoff PLC in the
Inspector tool. The developed solution provided the possibility of a significant increase in the cost-efficiency and flexibility of the tool. It was concluded that a Raspberry Pi can be a feasible replacement for a PLC in certain industrial automation applications. Moreover, the commissioning company decided to continue the project by conducting tests on the new product to prepare it to be released for customer projects.