PLC Automation Project – Unity – The pizza machine
As part of an embedded systems project during my Erasmus in Finland, I had the chance to work on a solution combining PLC programming using the TwinCat platform from Beckhoff.
Our team: Mathieu Astruc, Pierre-Sacha Baglione, Luca de Genaro, Tim Marzocchinni
The theme of the project being free, we chose to create a pizza machine taking care of all the manual steps that the production of a traditional pizza requires. From the preparation and arrangement of ingredients to cooking and packaging using boxes.
We decided that the different “prefabricated” elements would be the cooking dough, ingredients such as olives, peppers… as well as the boxes for the final packaging and delivery to the customer.
The project consisted of three parts:
- The first, which I was in charge of, was to code in PLC the machine allowing to control various elements such as conveyors, a heating body (regulated in an ON-OFF manner for simplicity during the simulation), an elevator allowing to transport different elements of a floor as well as rotating “droppers” to arrange the ingredients that the customer would have chosen beforehand before launching the production of his pizza. Luca de Genaro created an HMI interface using Beckhoff TwinCat HMI allowing the customer to select the different ingredients (toppings) he wants on the base of his pizza. Once the ingredients are selected, the customer can start the production of his pizza. A light indicator shows the state of the pizza production.
- The second, aimed to create a communication interface between the PLC controller and the 3D demonstrator created on Unity. In charge of this second mission, I developed several tests of communication methods between the PLC and our demonstrator.
After several unsuccessful tests using the Modbus protocol which took too much time to be processed by our C# demonstrator, we decided to select the ADS protocol developed by Beckhoff.
I created the necessary modules for the simulation as well as a virtual IO communication module in the Unity workspace. Thanks to Beckhoff’s ADS we were able to facilitate communication between the simulator and the PLC controller thanks to native string type support.
This allowed us to directly send from the PLC a string of characters that concatenates the ingredients desired by the customer, separated by commas. Unity using the C# programming language, this choice facilitated the deserialization for use of the automated command of ingredient droppers.
- The third aimed to create a 3D demonstrator that would serve us to simulate the behavior of our machine.
The PLC receives information from virtual sensors developed on Unity via the ADS protocol and acts on the actuators. Thanks to the hard work of Tim Marzocchinni and his team composed of Mathieu Astruc and Luca de Genaro. We were able to achieve a simplistic but effective 3D simulation of the behavior of our pizza machine. All that remained was to integrate and test the PLC solution with the simulation. Easier said than done, it was after a sleepless night that we finally achieved our goal to communicate through an internal IP network the PLC controller and the simulation on Unity. Thanks to Beckhoff’s TC31 module we were able to create an IP ADS network allowing the connection between the PLC server configured on a VM and the demonstrator program installed on a client PC.This project was an excellent group collaboration. We were able to enrich our major skills in embedded systems but also in soft-skills. Our group having never worked with the Unity platform, it was a real discovery!