# APTM: A Model for Pervasive Traceability of Agrochemicals
## 4 Proposed Model
### Tier 1--Sensors and Microcontrollers  
Tier 1 can work with various sensors, such as: luminosity sensor, heartbeat/pulse sensor, pressure/resistive force sensor, tilt/impact or motion sensor, temperature sensor, ultrasonic sensor, sound sensor, liquid level sensor, speed sensor, and light sensor; and other features such as: RFID, Camera, QR code or bar code and GPS. Tier 2 is a multi-sensor approach with the combination of data from several sensors that must be passed to Tier 2 to enrich its analysis and predictions. The minimum necessary sensing/reading equipment for the solution is: (a) a code reader for identification of the packaging being used (can be a QR code, bar code, or a numeric code reader); (b) RFID tag; (c) an ultrasonic sensor; (d) a vibration/movement sensor; (e) a luminosity sensor; (f) Weighing scale module; and (g) a camera. This minimal setup produces data that feeds tier 2 (Table 2) and a simple schematic is showing sensors around the package inside a cabinet in Figure 7.  
\begin{table}
\begin{tabular}{l l} \hline \hline
**Technology** & **Use** \\ \hline
1. Identification code & Individualizes the product along the supply chain \\ (QR code, bar code or ID code) & and facilitates product location. \\ \hline
2. RFID tag & Tracking within the property \\  & automatically using antennas. \\ \hline
3. Ultrasonic sensor & Detects movement around the package. \\ \hline
4. Vibration/Motion sensor & Detects package movement. \\ \hline
5. Luminosity sensor & Detects when product container has been opened. \\ \hline
6. Weighing scale module & Allows to detection package volume variation \\ \hline
7. Camera & Allows one to take a photo of the employee \\  & determine who took a certain package. \\ \hline \hline \end{tabular}
\end{table}
Table 2: Sensors per type of processing use in tier 2.  
Figure 6: User interactions with the model.  
The sensor list summary is the following: 1. RFID tags/chip: MFRC522 NXP. 2. Ultrasonic distance sensor HC-SR04. 3. Vibration sensor SW-420. 4. Light sensor LDR 5 mm. 5. Weight scale module analog-digital converter module HX711. 6. Camera module VGA OV7670, 30 FPS, max resolution 640 \(\times\) 480 pixels.  
The sensors are located in an edge network around the product package and connected in this (except for the RFID antenna network, which can stay in various parts of the farm, forming the concept of virtual fence). The primary need for the arrangement of sensors around the products is to monitor when it is collected for use, allowing them to detect forms of misuse or theft. This detection is a tier 2 function. Tier 2 data entering an SQL database may also be available to the farm's ERP with appropriate access measures. This information is sent to tier 3 via function call to a blockchain application programming interface (API).  
In layer 1, we have the following features related to safety. Here, the sensors are in safe and closed cabinets. These cabinets are inside closed rooms because agrochemicals have a high value. In addition, the values collected by the sensors are compared with known parameters, layer two can issue alerts when these values change, so any attack on layer 1 to change data can be detected at layer 2. The model was designed with Ethernet Shields o which significantly reduces attacks and interference in data collection. Microcontrollers are only running code preloaded on them and cannot execute other types of malicious code. A feature beyond the model refers to data transmission within the supply chain. The farm must be connected via the internet, and this connection must pass through a router with a firewall.