Streamlining Traceability Data Generation in Apple Production Using Integral Management with Machine-to-Machine Connections

: Legal requirements and consumer demands have motivated the development and application of traceability technology. Farming practices are the starting point of the agri-food supply chain and the destination of the agri-food traceability system (AFTS). The amount of resource information and the complexity of the production process of agri-food become the main obstacles to the wide application of AFTS. This study introduces an integrated machine-to-machine system that allows collecting ﬁeld operation information automatically. This system includes an IoT-based integrated hardware system, a smart farm cloud (SFC) platform, and a mobile application, which accomplished the collection, upload, and storage of operation information. This system had been used in “BSD” organic apple orchard in Qixia, Shandong Province, China for about one year. The effectiveness of the system was evaluated by managing 270 apple trees in one plot of the orchard. Finally, a label with a QR code was successfully generated to provide consumers to query traceability information from a single tree to a fruit tray. This work was a background of a blockchain traceability system. Moreover, the future extendibility of the system was also discussed and prospected.


Introduction
Food safety and quality play a fundamental role in our daily life, especially in the background of frequent food safety incidents. Food safety scandals have seriously challenged consumers' confidence in the agriculture industry and made consumers become more careful about food choices [1][2][3][4]. Some research shows that consumers are focusing on food information and are willing to pay a premium for selected food safety attributes [4][5][6][7]. Traceability, which is referred to as the ability to trace and track, is gaining popularity in the agricultural products supply chain [8][9][10]. It involves control and data acquisition during each phase of the food supply chain and enables transparency through tracing and tracking [11][12][13].
Currently, traceability applications in agricultural products have been extensively studied [14][15][16][17]. As the most information-intensive application, the realization of traceability represents the collection, concatenation, and display of information [18,19]. Although the number of academic publications on food traceability is increasing, most of the existing agri-food traceability systems have not been assessed whether they are effectively implemented. The high level of traceability efficiency always comes with a high workload and labor costs. The traceability system with practical application value should realize traceability efficiency at the item or batch level with affordable costs.
Accordingly, the extent to which the agri-food traceability system is actually applied by Chinese farm managers remains limited [7,20]. The main obstacles to the wide application The apple production flow chart in the "BSD" organic orchard (in the middle), the traceability information flow (on the left), and the information collection system (on the right).

Hardware Integration
To streamline traceability data generation, an integrated hardware system was developed. This hardware system was flexible and allowed the identification of every apple tree in the orchard, the acquisition and uploading of data to a cloud platform, and the labeling of the apple products. Orchard staff could choose different modules to record different operation information. The components of the device are shown in Figure 2 described below. The apple production flow chart in the "BSD" organic orchard (in the middle), the traceability information flow (on the left), and the information collection system (on the right).

Hardware Integration
To streamline traceability data generation, an integrated hardware system was developed. This hardware system was flexible and allowed the identification of every apple tree in the orchard, the acquisition and uploading of data to a cloud platform, and the labeling of the apple products. Orchard staff could choose different modules to record different operation information. The components of the device are shown in Figure 2 described below.
A-Android smartphone (Huawei, Shenzhen, China), used to install and run the app. Connected with an RFID reader, printer, and electronic scale with several interfaces such as Bluetooth and USB. Storage capacity of 64 GB for datalogger, and communication with the web application with 4G.
B-RFID UHF reader/writer (BY-A100, Boyan Technology, Beijing, China). This device had configurable output power and provided USB and Bluetooth communication interfaces.
C-UHF RFID cable tie tags (BY-UZ-1, Boyan Technology, Beijing, China). Passive ABS tags with 512-bit memory, and waterproof to increase robustness against the orchard environment.
D-Printer (Zebra, Shanghai, China). G-Serial Bluetooth adapter (IRXON, Beijing, China), It is used to realize the communication between GPS, electronic scale, and computer/mobile phone.
as Bluetooth and USB. Storage capacity of 64 GB for datalogger, and communication with the web application with 4G.
B-RFID UHF reader/writer (BY-A100, Boyan Technology, Beijing, China). This device had configurable output power and provided USB and Bluetooth communication interfaces.
C-UHF RFID cable tie tags (BY-UZ-1, Boyan Technology, Beijing, China). Passive ABS tags with 512-bit memory, and waterproof to increase robustness against the orchard environment.
G-Serial Bluetooth adapter (IRXON, Beijing, China), It is used to realize the communication between GPS, electronic scale, and computer/mobile phone All the devices can be powered by internal lithium batteries or dry cells. The components of the integrated hardware system have their pros and cons and using all of them can streamline data generation, increase the system's reliability, and give it the flexibility to adapt to different needs [31][32][33][34].

Software System Framework
To provide accurate traceability information to apple tree adopters, data from the field level should be recorded, processed, and utilized by different role users (farmer/consumer) ( Figure 3). Therefore, the two system layers were designed. The smart farm cloud platform (SFC) combined information on orchard management. The orchard manage app was a lightweight system that could be run on mobile devices. It provided the convenience of obtaining information in real time and on site. The two layers can communicate through 4G/5G. The system flow is described below: All the devices can be powered by internal lithium batteries or dry cells. The components of the integrated hardware system have their pros and cons and using all of them can streamline data generation, increase the system's reliability, and give it the flexibility to adapt to different needs [31][32][33][34].

Software System Framework
To provide accurate traceability information to apple tree adopters, data from the field level should be recorded, processed, and utilized by different role users (farmer/consumer) ( Figure 3). Therefore, the two system layers were designed. The smart farm cloud platform (SFC) combined information on orchard management. The orchard manage app was a lightweight system that could be run on mobile devices. It provided the convenience of obtaining information in real time and on site. The two layers can communicate through 4G/5G. The system flow is described below: SFC worked over the Ali elastic cloud server, with the MySQL database system. It is programmed to manage and trace the production journey of orchards, fields, and greenhouse crops. In this study, taking apple planting as an example, the web application al-  SFC worked over the Ali elastic cloud server, with the MySQL database system. It is programmed to manage and trace the production journey of orchards, fields, and greenhouse crops. In this study, taking apple planting as an example, the web application allowed to create an orchard management information software for orchard registration, authentication of administrators, registration of plots and sectors, planting operations, input, apple products, and other additional associated information. The main functions were to establish planting files for the orchard, receive field and single-tree level information from the mobile app, host them in the database and show them to the user when requested. Figure 4 shows the structure of the web application user interface with seven differentiated sections: my farm (A), farm management (B), planting operation (C), products traceability (D), value-added services (E), system settings (F), and big data analysis (G). The function of each section is described as follows: SFC worked over the Ali elastic cloud server, with the MySQL database system. It is programmed to manage and trace the production journey of orchards, fields, and greenhouse crops. In this study, taking apple planting as an example, the web application allowed to create an orchard management information software for orchard registration, authentication of administrators, registration of plots and sectors, planting operations, input, apple products, and other additional associated information. The main functions were to establish planting files for the orchard, receive field and single-tree level information from the mobile app, host them in the database and show them to the user when requested. Figure 4 shows the structure of the web application user interface with seven differentiated sections: my farm (A), farm management (B), planting operation (C), products traceability (D), value-added services (E), system settings (F), and big data analysis (G). The function of each section is described as follows:  A-My farm: farm planning and digital display (google map, video surveillance information, environmental monitoring information).
B-Farm management: seedling management, agricultural resources management, order management and equipment management, consumer management, and so on.
C-Planting operation management: such as planting, processing, packaging, quality inspection, logistics operation. D-Products traceability: traceability label template design, traceability label printing, logistics tracking. E-Value-added services: planting expert system (planned). F-System settings: basic system settings, personnel management, equipment management, and permission settings.
G-Big data analysis: use big data technology for planting analysis, order analysis, yield analysis, etc.

App on the Mobile Phone: "Mobile Orchard (MO)"
The orchard manage app was a mobile application designed for this study. With this app, farmers can acquire and upload information on the web application. The beta version was demonstrated using android smartphones. Through the app, apple farmers can read the apple tree tag, collect agricultural operation information, and realize the conversion of RFID tag information and barcode. Figure 5 shows an example of the application interface. The main functions are as follows: The orchard manage app was a mobile application designed for this study. With this app, farmers can acquire and upload information on the web application. The beta version was demonstrated using android smartphones. Through the app, apple farmers can read the apple tree tag, collect agricultural operation information, and realize the conversion of RFID tag information and barcode. Figure 5 shows an example of the application interface. The main functions are as follows: Agricultural operation management: the farmer can record the new operations, review the history records, and upload the records to the cloud platform. New operations Agricultural operation management: the farmer can record the new operations, review the history records, and upload the records to the cloud platform. New operations could record during apple growing (weeding, pruning, fertilizer treatments, irrigation, apple bagging, harvesting . . . ).
Device management: connection and communication management of hardware devices (RFID readers, printers, and electronic scales).

Working Methodology
The new traceability data generation method includes the integration of IoT (Internet of things) technologies, such as RFID, QR code, and GPS. We implemented the data into the cloud platform and mobile app, and marking the trees with RFID tags ( Figure 6).

Pre-Processing Office Work
When starting an operation in the orchard, the items involved in the operation were pre-programmed in the office.
Registration: when a new agricultural subject (planting base, orchard, and so on) logs into the SFC, it is prompted by the platform to enter authentication information. After the registration application is passed, the administrator of agricultural subjects can access SFC with the appropriate username and password (Figure 7).

Working Methodology
The new traceability data generation method includes the integration of IoT ( of things) technologies, such as RFID, QR code, and GPS. We implemented the d the cloud platform and mobile app, and marking the trees with RFID tags ( Figure   Figure 6. Flow chart of the work methodology.

Pre-Processing Office Work
When starting an operation in the orchard, the items involved in the operati pre-programmed in the office.
Registration: when a new agricultural subject (planting base, orchard, and so into the SFC, it is prompted by the platform to enter authentication information. A registration application is passed, the administrator of agricultural subjects can acc with the appropriate username and password ( Figure 7).
Orchard plot plan: at the "My farm section" (Figure 4, Section A), the far create the plot or traceable unit that it to manage according to the actual situat requirements of the orchard. In this study, three levels of areas were planned: o plot, and traceable unit (single apple tree). There are 37 plots in the "BSD" organ orchard and 2 to 17 acres per plot. The plot is assigned an ID by the web applicat its boundary was positioned by the GPS receiver. The traceable unit was assigne ID, read from the RFID tag which is going to be hung on the apple tree for marking 8). The combination of the PLOT ID and the apple tree ID could serve to classify formation uploaded from the orchard management app.  Orchard plot plan: at the "My farm section" (Figure 4, Section A), the farmer can create the plot or traceable unit that it to manage according to the actual situation and requirements of the orchard. In this study, three levels of areas were planned: orchard, plot, and traceable unit (single apple tree). There are 37 plots in the "BSD" organic apple orchard and 2 to 17 acres per plot. The plot is assigned an ID by the web application, and its boundary was positioned by the GPS receiver. The traceable unit was assigned a tree ID, read from the RFID tag which is going to be hung on the apple tree for marking ( Figure 8). The combination of the PLOT ID and the apple tree ID could serve to classify the information uploaded from the orchard management app.  Meanwhile, the tree characteristics (species, planting time, and adopter) were collected and associated with apple tree ID during the office process.

RFID Tree Marking
Before marking, the RFID number of the tag was added to the inventory dataset with an RFID reader and assigned to every single apple tree on the web application. Afterward, the apple tree was marked with the RFID tag at the bottom branch by cable ties (Figure 9). Meanwhile, the tree characteristics (species, planting time, and adopter) were collected and associated with apple tree ID during the office process. Before marking, the RFID number of the tag was added to the inventory dataset with an RFID reader and assigned to every single apple tree on the web application. Afterward, the apple tree was marked with the RFID tag at the bottom branch by cable ties (Figure 9). Meanwhile, the tree characteristics (species, planting time, and adopter) were collected and associated with apple tree ID during the office process.

RFID Tree Marking
Before marking, the RFID number of the tag was added to the inventory dataset with an RFID reader and assigned to every single apple tree on the web application. Afterward, the apple tree was marked with the RFID tag at the bottom branch by cable ties (Figure 9).

Operations Recording
According to the apple growing process and the traceability acquirements, the system designed two operation collection methods, by batch (GPS) and by a single tree (RFID).
By batch: Most operations in the field section were performed by plot, such as irrigation, pruning, and fertilizer treatments. In this way, we use the mobile location function. When farmers worked in the orchard, the current GPS coordinates were continuously acquired with the operation data. In the pre-processing office work, the boundary position (polygon) of every plot was located, saved, and associated with PLOT ID. With the current

Operations Recording
According to the apple growing process and the traceability acquirements, the system designed two operation collection methods, by batch (GPS) and by a single tree (RFID).
By batch: Most operations in the field section were performed by plot, such as irrigation, pruning, and fertilizer treatments. In this way, we use the mobile location function. When farmers worked in the orchard, the current GPS coordinates were continuously acquired with the operation data. In the pre-processing office work, the boundary position (polygon) of every plot was located, saved, and associated with PLOT ID. With the current GPS coordinates and the boundary position, the current plot where the operations were taking place could be determined by the ray-casting algorithm for testing the inclusion of points in polygons. After acquiring the PLOT ID, the apple tree IDs in this plot could be determined. Then the current operation associated with the tree IDs is uploaded to the cloud platform SFC (Figure 10).
By single tree: There is a specific operation in the field section, harvesting. Because of the sales method of adopting apple trees and the traceability acquirement, this operation has a specific request that it should link the apple production with the apple tree. When harvesting, apple batch numbers are generated by adding the information (weight of apples, harvesting time) of different trees and are associated with the tree ID by reading the RFID tag on every tree. Then the whole information could upload to the cloud platform SFC.
After apple harvest, the apples of every single tree will be sent to the adopters. Apples should be tagged to document which tree they come from. With the app on the mobile phone, the harvest information including tree ID and harvest time was printed on the label. The labels were attached to the apple basket realizing the information associated with the apple tree to the apple ( Figure 11). GPS coordinates and the boundary position, the current plot where the operations were taking place could be determined by the ray-casting algorithm for testing the inclusion of points in polygons. After acquiring the PLOT ID, the apple tree IDs in this plot could be determined. Then the current operation associated with the tree IDs is uploaded to the cloud platform SFC (Figure 10). ples, harvesting time) of different trees and are associated with the tree ID by reading the RFID tag on every tree. Then the whole information could upload to the cloud platform SFC. After apple harvest, the apples of every single tree will be sent to the adopters. Apples should be tagged to document which tree they come from. With the app on the mobile phone, the harvest information including tree ID and harvest time was printed on the label. The labels were attached to the apple basket realizing the information associated with the apple tree to the apple ( Figure 11). After harvesting, apples should be packed and delivered to the adopters. Meanwhile, traceability information is also required by adopters. The SFC provides consumers with an information query function based on traceability codes. When packaging, the tracea−bility code was generated by scanning the label on the apple basket. Then the apples' traceability labels are printed, affixed to the final packaging, and provided to the consumers.

Data Collection
The case study area is plot 4 (4.5 acres) in the "BSD" organic apple orchard. There are 270 red Fuji apple trees in plot 4, which were planted in 2012. This plot is the main area of apple tree adoption.
The field application was carried out using the methodology described: the plot was created and bounded at SFC ((120.747420, 37.208665); (120.748570, 37.208723); (120.747409, 37.208200); (120.748448,37.208260)). The plot ID was 4. There are 270 apple tree IDs defined by RFID tags. The apple tree IDs were associated with plot ID 4. RFID tags were hung on apple trees to mark tree IDs ( Figure 12). After harvesting, apples should be packed and delivered to the adopters. Meanwhile, traceability information is also required by adopters. The SFC provides consumers with an information query function based on traceability codes. When packaging, the traceability code was generated by scanning the label on the apple basket. Then the apples' traceability labels are printed, affixed to the final packaging, and provided to the consumers.

Data Collection
The case study area is plot 4 (4.5 acres) in the "BSD" organic apple orchard. There are 270 red Fuji apple trees in plot 4, which were planted in 2012. This plot is the main area of apple tree adoption.
The field application was carried out using the methodology described: the plot was created and bounded at SFC ((120.747420, 37.208665); (120.748570, 37.208723); (120.747409, 37.208200); (120.748448, 37.208260)). The plot ID was 4. There are 270 apple tree IDs defined by RFID tags. The apple tree IDs were associated with plot ID 4. RFID tags were hung on apple trees to mark tree IDs ( Figure 12). The farmers installed the "Mobile Orchard" app on their phones and collected the usual operation data carried out in the orchard with the app. Regular field operations were collected by batch using GPS technology, while harvesting operations were done by the RFID method. The combination of the two collection methods effectively improved the efficiency of information collection. The operations performed in plot 4 were success- The farmers installed the "Mobile Orchard" app on their phones and collected the usual operation data carried out in the orchard with the app. Regular field operations were collected by batch using GPS technology, while harvesting operations were done by the RFID method. The combination of the two collection methods effectively improved the efficiency of information collection. The operations performed in plot 4 were successfully uploaded from "Mobile Orchard" to SFC. In 2021, about 45 operations were successfully obtained. The detailed description of the main operations is shown in Table 1.

Application Effects
Before using the system, the operations data were obtained manually. A dedicated manager was responsible for entering information into computers. This system was put into use in 2021. During this time there were 21 registered users. Feedback was provided by 2 orchard managers and 19 farmers (8 full-time employees and 11 temporary workers). Managers noted the advantages of promoting optimal management of agricultural operations and facilitating information accessibility, which arises from the fact that the system can provide real-time and on-site information to support orchard management. Compared with obtaining and entering information manually, the system is effective and precise. Enhancement of management is an obvious advantage for before using the system, agricultural operations data was difficult to query and analyze. The SFC accumulates data on apples, environments, and agricultural operations, and stores it in an easily accessible format. Based on the data, management and decisions about apple-producing can be implemented. Meanwhile, some managers noted advantages, the system also enhanced costs and brought additional training work.
Most farmers agreed that the system could increase the automation of data collection by machine-to-machine connections, although some farmers believed this system enhanced the complexity of the work and brought extra workload.

Guaranteeing Traceability
With the agricultural operations obtained by the system, the "BSD" organic orchard could provide complete and accurate traceability information to the adopters with trace-ability labels and codes ( Figure 13). In 2020, the apple products of "BSD" organic orchard only had a simple origin label. In 2021, all the apple products in plot 4 had been sent to consumers with a traceability label.
by machine-to-machine connections, although some farmers believed this system en hanced the complexity of the work and brought extra workload.

Guaranteeing Traceability
With the agricultural operations obtained by the system, the "BSD" organic orchar could provide complete and accurate traceability information to the adopters with trace ability labels and codes ( Figure 13). In 2020, the apple products of "BSD" organic orchar only had a simple origin label. In 2021, all the apple products in plot 4 had been sent t consumers with a traceability label.  With the traceability code, all the apple products could be traced to every single tree. In addition to the regular traceability information of the apple (origin base name, varieties), it can also show consumers the apple planting process and agricultural operation information (Figure 14), which the consumers (apple tree adopters) are most concerned about. With the traceability code, all the apple products could be traced to every single tree. In addition to the regular traceability information of the apple (origin base name, varieties), it can also show consumers the apple planting process and agricultural operation information (Figure 14), which the consumers (apple tree adopters) are most concerned about.  Preparation time for the system application in the office was necessary. One orchard manager worked 2 h to read the 270 RFID tags, assigned adopters to RFID tags, and la-

Pre-Processing Office Work
Preparation time for the system application in the office was necessary. One orchard manager worked 2 h to read the 270 RFID tags, assigned adopters to RFID tags, and labeled every RFID tag with its adopter's name. One orchard manager worked 1.5 h to create orchard, plot, and traceable unit (RFID code) on the SFC platform, entered orchard information and adopter's information (associated with the with the RFID code). The needed equipment was RFID UHF reader/writer (BY-A100), UHF RFID cable tie tags, Zebra Printer, and a computer.

RFID Tree Marking
It took 1.5 h to mark 270 trees with the RFID tags by two farmers, with the adopters' names on the RFID tags and each tag hung on the corresponding apple tree.

Operations Recording
During the early stages of the system design, agricultural operation information was collected from every single tree [30]. With this approach, recording one farm operation needed to scan RFID tags and enter operation data 270 times, which was extremely inefficient. When using GPS to collect farm operation information in batches, it cost about 1 min to enter the whole operation data of plot 4.
While during apple harvest, the information (weight of apples, harvesting time) was associated with tree ID by reading the RFID tag on every tree. So, farmers had to scan each tag on the apple tree first, then synchronize the weight and time data. In the end, harvest information was printed on a label with a Zebra printer, pasted with apple products. The time taken for the entire process varied from 2 min to 5 min, which depended on the level of familiarity with the "Mobile Orchard" app.
Compared with the duration of the main farming operations in 2020, the duration of corresponding farming operations did not increase significantly in 2021 (the number of farmers was basically unchanged). It is reflected from the side that the collection of agricultural information with this system did not increase the workload (Table 2), although it was difficult to quantify the time consumption of the original manual recording method.

Discussion
The performance of the system has enabled an automatic record of the inputs and operations involved in the traceability of the apple. It changes the information collection and management status of using handwritten or manual input with office software in the past and facilitates the transfer of reliable information between the orchard and consumers, which enables improved product quality through control of important variables and increased consumers' trust. Moreover, the information associated with apple planting might be expanded by adding other parameters to record in the whole supply chain, such as the climatic variables and warehouse environment variables [28]. The information, with the precise agricultural techniques, will make the system become a powerful tool for the farmer to establish the orchard logbook and manage the data from all aspects of production, processing, warehousing, logistics, and others [35].
This system adopts two collection methods, by batch and by individual trees, with GPS and RFID technology. The combination of these two methods realized data entry automatically, which greatly improves the efficiency of agricultural operation data collection by ensuring the traceability accuracy of a single apple tree. However, the same technical issues may exist. In 2021, the GPS method was only used in one plot, which means the program only need to determine in or out, which is much simpler than identifying multiple contiguous plots. In the future, the positioning accuracy under different cases requires more testing., and we may need a more accurate type of GPS, although the cost would be higher. When the single tree marking with RFID tags and the scanning of the tags worked well but with some reading range changes. When trees bear apples, the appropriate range to make a reading with 100% becomes smaller than lab tests. Meanwhile, the two methods both involve previously establishing some proper work route to identify the plot at the pre-processing office work (such as initial positioning of the GPS and RFID tag assignment) before starting the field operations collection. These changes in the working operation could be a problem in the early stages of training. For some farmers, it is difficult to manage a mobile app that is too complicated. Developing a user-friendly, simple, and clear interface both for the cloud platform SFC and mobile application Mobile Orchard would make this challenge easier.
The implementation of the system would not entail much outlay when compared to the advantages that could be obtained by increasing the added value of apple products. With the sales method of adopting fruit trees, most of the consumers (adopters) are willing to pay more for the apples accompanied by a reliable traceability system.
The traceability system developed here uses QR codes to present traceability information to consumers. The information includes apple varieties, apple tree ID, plot ID, and agricultural operations data. Abundant and trusted data can increase consumer confidence, thus increasing the value of the apple products.
The system developed here is a starting point for the implementation of blockchain technology in the apple supply chain [36]. Blockchain is a promising technology that has great potential for ensuring the veracity and incorruptibility of information from the field to the consumer and improving traceability performance by providing security and full transparency [33,[37][38][39][40]. This aspect will be addressed in the next article, where a blockchain-based framework for apple supply chain traceability is described.

Conclusions
This work proposes an integrated, machine-to-machine traceability data generation system. With this system, apple products could trace to every single tree. Abundant and trusted traceability information was offered to the consumers via traceability labels. Under the premise of ensuring traceability accuracy, web application SFC, mobile application MO, and the integrated hardware system were developed, which allows the automatic recording, storing, and managing of all the operations carried out along apple production in the orchard, without extra workload and labor costs.
This system was used for about a year in the "BSD" organic apple orchard in Qixia, Shandong. The RFID technology worked properly in the identification of every single tree. Additionally, GPS identified the plot. With the GPS and RFID technologies, it realized the combination of information batch and individual collection, improved collection efficiency, and reduced operational complexity. These are the advantages of the system. Disadvantages included increased cost and some pre-processing work. Nevertheless, the system is an open platform, which provides wide room for future development and improvement of traceability, such as blockchain. Further studies are necessary to reach these goals.