IoT Based Monitoring System using MQTT Protocol on Tortilla Chips Cutting Machine

This research focuses on monitoring and controlling a tortilla chip-making machine using the MQTT protocol. Tortilla chips are a popular snack made from corn tortillas that are cut into triangles and fried or baked. The study utilizes the Internet of Things concept, where sensors are integrated into the machine to enable data exchange and communication through networks. The MQTT protocol is chosen due to its lightweight nature, making it suitable for resource-constrained devices and efficient in IoT applications. The research involves using ESP32 as the microcontroller and various sensors, such as ZMPT101b, ACS712, Tachometer, and HC-SR04. The data collected from the sensors is transmitted to a Thingspeak channel via MQTT, allowing real-time monitoring and control of the machine. The results show that the MQTT protocol effectively facilitates communication of the tortilla chip cutting machine, with satisfactory delay and data integrity. The tortilla chip cutting test was successful, producing triangular-shaped chips. Overall, the research concludes that the implementation of the MQTT protocol in the IoT-based tortilla chip-making machine is effective and reliable. The results of this study indicate that the average delay in data communication is 2.8 seconds, and the integrity testing revealed a 3% error in the accuracy of the sensor data


Introduction
Tortilla chips are a popular snack made from corn tortillas that undergo cutting and frying or baking.Corn tortillas are made from a mixture of corn, vegetable oil, salt, and water.The term "Tortilla" originates from Spanish, denoting unleavened flatbread made from corn or wheat [1].UMKM represents Micro, Small, and Medium Enterprises, which are trade businesses managed by individuals or in small to micro-sized establishments [2].An instance of UMKM is the tortilla chips business.The process of producing tortilla chips involves a chip cutting machine equipped with integrated sensor devices in a centralized control system.This system aims to oversee and regulate the tortilla chip-making process, ensuring efficient production.
The Internet of Things denotes the progressive phase of the internet that establishes a worldwide communication infrastructure linking humans and machines [3], It allows for the collection of various data types in real-time, facilitating smooth communication between objects and individuals.Additionally, it enables intelligent perception, identification, and management of objects, processes, and information, while also supporting environmental protection through various network access approaches [4].One example of IoT implementation is in monitoring systems that use sensors on specific machines, such as the tortilla chip-making machine.In this system, IoT devices enable the machine to send and receive data through network connections, allowing more efficient monitoring and real-time decision-making based on data.
With the advancement of time, the implementation of the Internet of Things allows the use of various types of existing network protocols.However, not all protocols are suitable for IoT implementation, as choosing an inappropriate protocol can lead to system complexity.Therefore, an efficient and easy-to-implement protocol is needed to ensure smooth and effective IoT systems.
MQTT (Message Queuing Telemetry Transport) is a communication protocol at the application layer.MQTT is widely used especially for IoT applications since it's a light weight protocol [5].The main concepts of MQTT include MQTT broker, MQTT client (publisher and subscriber), MQTT topic.MQTT Broker is the junction of all incoming connections from the client and is the center of systems that uses the MQTT protocol.The principal responsibility of the Broker is to receive messages from publishers, queue them, and then forward them to subscribers based on topics.MQTT client is classified into two groups: publishers and subscribers, in which the prior is the message sender to the Broker and the latter is the message receiver from the Broker.A client can act as both a publisher and a subscriber on one or more specific topics [6].The topic is a logical concept that MQTT uses to route messages sent from publisher to subscriber.
With the characteristics of MQTT, this protocol is deemed appropriate for controlling the tortilla chip-making machine.Although MQTT is typically used for monitoring purposes in IoT environments, its publish/subscribe mechanism at the application layer allows it not only for monitoring but also for controlling according to user preferences and The acquired data will be stored in a thingspeak channel.This capability is made possible by MQTT, as it allows messages to be transmitted and received based on predefined topics, enabling greater adaptability for flexible control and monitoring to meet user requirements.
In this research, the researcher decided to monitor and control the tortilla chip-making machine using ESP32 as the microcontroller, ZMPT101b sensor for voltage monitoring, ACS712 sensor for current monitoring, Tachometer as an RPM sensor, and HC-SR04 as an ultrasonic sensor.The processed data results are displayed in an application.The researcher chose to use the MQTT protocol because it enables a publisher-subscriber model, where sensor data sent by the publisher reaches the broker and is then displayed in real-time on the subscriber's application [7].

Literature Review
The author's choice of MQTT as the application protocol for the Internet of Things (IoT) network, especially for the tortilla chips cutting machine, is supported by previous research, such as "Design of ATM Crime Monitoring System Based on MQTT Protocol Using SIM800L and Arduino Mega 2560 [8]" and "Using the MQTT to Transmit Vehicle Telemetry Data [9]".Both studies explain that MQTT has several advantages, such as highly efficient energy usage compared to other protocols, and it performs well in environments with limited bandwidth and high latency.In the context of IoT application on the tortilla chips cutting machine, the energy efficiency of MQTT is crucial in minimizing power consumption and improving machine operational efficiency.
In the subsequent research "Performance Analysis of MQTT and HTTP Protocols in Internet of Things (IoT) Based Magnet Data Acquisition [10]" a comparison was made between the MQTT and HTTP protocols, and the results indicated that MQTT quality is superior with smaller data packets and lower delay compared to the HTTP protocol.Additionally, the ability of MQTT to operate well in environments with limited bandwidth and high latency allows the tortilla chips cutting machine to function smoothly even in cases of network connectivity issues.Based on findings from previous research, the use of MQTT is a suitable and appropriate choice for the IoT control system on the tortilla chips cutting machine.

Research Method
In this study, the author opted for the Research and Development method, the research and development method is utilized to create a particular product and evaluate its efficiency.In this study, the research and development method is used for testing of the sensor and equipment's performance.The pivotal aspect of the research stage lies in the research framework, which provides a clear roadmap of the steps to be accomplished, streamlining the device design process.The research employs a framework method comprising 4 stages: hardware design for assembling the machine and sensors, software design to create essential program components, implementation to apply hardware and software based on the design, and testing conducted after previous stages to evaluate the machine's performance.The research framework and its stages are visually represented in Figure 1.

Hardware Design
During the hardware design phase, the focus will be on creating a prototype for the tortilla chipmaking machine.The initial step involves designing a block diagram that outlines the various components of the machine.The ultimate goal is to attain the desired hardware design, resulting in a fully operational and efficient tortilla chip-making machine.

Figure 2. Hardware Design Block Diagram
Figure 2 illustrates the various components utilized in creating the machine for this research, and these components are detailed in the accompanying Table 1.In this study, four sensors are utilized, including ACS712, ZMPT101b, Tachometer, and HC-SR04.The ACS712 sensor employs a precise, low-offset, linear Hall sensor circuit with a copper conduction path near the surface of the die [11].The ZMPT101b Voltage Sensor is a module designed for measuring AC voltage.It utilizes an isolation transformer with a voltage ratio of 1:1 [12], functioning by reducing the input voltage using a step-down transformer, and obtaining a stable output value based on the input.Tachometer, on the other hand, is a device utilized to count or measure the number of revolutions an object undergoes within a specific period of time [13].Lastly, the The HC-SR04 ultrasonic sensor is capable of measuring the distance between the sensor and an obstacle [14] is also integrated into the research setup.
The Wemos Lolin32 microcontroller is employed in this study due to its WiFi and Bluetooth features provided by the ESP32, enabling wireless control of the machine and data transmission.This simplifies the monitoring and adjustments required for the tortilla chips cutting machine.The primary role of Wemos Lolin32 is to serve as the central control and data processing unit for the machine.The layout in Figure 3 displays the organized arrangement of components.Once the layout is operational in the application, all the equipment's components are ready for direct assembly.

Software Design
The software design phase encompasses the programming aspect required to execute the system.This programming will be embedded in the microcontroller and also utilized to develop the interface system for mobile devices.The selected programming languages for this purpose are Java and C/C++, which will effectively control the desired system using Arduino IDE.Arduino IDE is a software application utilized to insert and upload programs with commands to microcontrollers for their practical application [15]

Implementation
The implementation phase follows the pre-established design, enabling the system to execute its controlling and monitoring tasks via the control system application.The integrated sensor data is processed by the Wemos Lolin32 microcontroller, utilizing the MQTT communication protocol.The integrated sensors send the processed data to the application once it is ready.During this process, the microcontroller communicates with MQTT to establish a connection with ThingSpeak through a hotspot network, enabling users to monitor the data using an Android application.

Experiment
Following the completion of both hardware and software design stages, the subsequent step involves testing the device.Hardware testing involves the operation of the tortilla cutting machine, driven by an AC motor.On the other hand, software testing is conducted using the MQTT communication protocol to facilitate publish-subscribe interactions between the device and the smartphone's client application.During the data communication testing, it is essential to conduct various tests to assess the speed and reliability of the implemented system.These tests include evaluating delay and data integrity to thoroughly analyze the machine's performance and identify any potential issues in the tortilla chips cutting process for prompt detection and resolution.The following are the formulas for calculating delay and error percentage.
Delay is the duration it takes for a signal to traverse from one point to another within a network [16].The calculation of the delay is represented by equation (1).

𝐷𝑒𝑙𝑎𝑦 = 𝐷𝑎𝑡𝑎 𝑅𝑒𝑐𝑖𝑒𝑣𝑒𝑑 𝑇𝑖𝑚𝑒 − 𝐷𝑎𝑡𝑎 𝑆𝑒𝑛𝑡 𝑇𝑖𝑚𝑒
(1) Measurement error is defined as the discrepancy between the true or real value of a quantity and the value measured or recorded during an experiment or observation [17].The calculation of the error is represented by equation (2).

Results and Analysis
In this section, we will present the findings and analysis obtained from the conducted research.The study focuses on monitoring and controlling a tortilla chip-making machine using the MQTT protocol in an Internet of Things (IoT) environment.The hardware setup, software integration, and successful implementation of the system have been discussed in the previous sections.Now, we will delve into the results obtained from testing and evaluating the system's performance.The analysis will provide insights into the delay in data communication, the integrity of sensor data, and other relevant aspects of the IoT-based tortilla chip-making machine.These results and analysis will shed light on the effectiveness and reliability of the MQTT protocol and the overall performance of the system.

Hardware
The hardware setup comprises circuits capable of detecting pre-set parameters based on the utilized sensors.Once the sensors read the data, the microcontroller analyzes it to transmit the information to the Application via a component connected to the hotspot signal.The successful creation of the hardware for the tortilla snack printer machine involved using ESP32, HC-SR04, ZMPT101b, ACS712, Tachometer, and Power Supply as per the device design scheme.To protect against potential damage, the EPS32 microcontroller, ZMPT101b sensor, and ACS712 sensor are housed in a plastic box while the HC-SR04 and Tachometer are fitted within the tortilla printer machine.The test results of the tortilla chips cutting also went well and produced triangular-shaped tortilla chips.Figure 4 illustrates the accomplished outcomes in creating the hardware configuration.

Software
In this research, once the sensors were successfully programmed according to the guidelines in Figure 5, the program code was integrated into the microcontroller to facilitate the transmission of tested data to the application.Proper coding and data processing using MQTT communication protocol are essential for creating the software and enabling data communication in the tortilla chip cutting machine.Figure 5 provides a glimpse of the source code.Once this stage is accomplished, data access becomes possible from any location and at any time, provided there is an internet connection.The application comprises two primary views: Home screen and Monitoring screen.Figure 6 represents the Monitoring screen of the application, presenting information from the tested ACS712, ZMPT101b, and Tachometer sensors of the device.

Implementation
The successful implementation of the system is based on its adherence to the initial project design, aimed at creating an IoT-based tortilla chips cutting machine using the MQTT communication protocol, resulting in a functioning prototype.In this study, the prototype was effectively employed for cutting tortilla chips.When the prototype is connected to a 220-volt power supply and activated through the Android application, the machine will initiate, and the motor will drive the pulley within the machine.Concurrently, data from the ACS712 sensor, measuring current, the ZMPT101b sensor, measuring voltage, and the Tachometer sensor, measuring rotations per minute, will be transmitted to the microcontroller.While the ESP32 is in operation, the WiFi module will establish an internet connection and store the collected data on the Thingspeak channel.

Result Analysis
Once the implementation phase is completed, it is necessary to conduct testing to evaluate the system's reliability and speed.The data communication was tested by performing delay testing and data integrity testing.The process involved comparing the first 10 sensor data received by the thingspeak server with the first 10 data published by the microcontroller integrated with the sensors.The data received by the server was stored in a database, and the data published by each microcontroller was tested using a multimeter.The obtained test data for the delay is presented in Figure 7.The delay comparison graph illustrates a relatively consistent delay in data transmission from the microcontroller to the Thingspeak server.Among the 10 data samples, 8 had the highest delay of 3 seconds, while 2 samples had the lowest delay of 2 seconds.The average delay recorded during the testing was 2.8 seconds, which is mainly attributed to the network's performance, causing delays in data communication.The researcher considers the obtained results for delay to be satisfactory in facilitating communication between the microcontroller and the server.
The integrity testing followed a similar approach to the delay testing, where the first 10 sensor data received by the Thingspeak server were compared with the first 10 data published by the microcontroller from the sensors.The results of the integrity testing conducted on the ACS712, ZMPT101b, and Tachometer sensors are presented in Figure 8.

Figure 8. Data Integrity Graph
The integrity testing results, comparing 10 different data samples as previously described, show a 98.7% similarity between the sent and received data.This indicates that the data received by the server closely matches the data published by the microcontroller.While there is an average of 2.3% error in the sensors accuracy, the system is still considered to be functioning as intended, as evident from Figure 8.

Figure 4 .
Figure 4. Tortilla Cutting Machine and Sensor Box