# Battery-Free Pork Freshness Estimation Based on Colorimetric Sensors and Machine Learning
## 4 RF Harvesting Experiment
### Kalman Filter for RF Harvesting Evaluation  
The power received per 1 cm by the collinear antenna connected to the proposed sensor tag is measured, and the received power is shown in Figure 9. The actual amount of RF energy received by the sensor tag may vary slightly. To estimate the state of a linear dynamic system based on measured values, including noise [28; 29], a Kalman filter was used. Figure 8: Smart sensor tag using RF scavenging power. Figure 9: RF harvesting measurement data by the distance of collinear antenna. This Algorithm 1 represents the Kalman Filtering algorithm for energy harvesting. Kalman Filtering is a widely-used technique for estimating the state of a system in the presence of noisy measurements. ```
1:Initialization: \begin{tabular}{} \end{tabular} 
```
2:Prediction: \begin{tabular}{} \end{tabular}  ```
3:Kalman Gain Calculation: \begin{tabular}{} \end{tabular} 
```
4:Update \begin{tabular}{} \end{tabular}  ```
5:Input: Observation matrix \(H\), predicted error covariance \(P_{K}^{-}\), measurement noise covariance \(R\)  Output: Kalman gain \(K_{K}\) \(K_{K}=P_{K}^{-}H^{T}\left(HP_{K}^{-}H^{T}+R\right)^{-1}\) # Kalman gain calculation \begin{tabular}{} \end{tabular} 
```
6:Update \begin{tabular}{} \end{tabular}  ```
7:Input: Observation \(z_{t}\), observation matrix \(H\), predicted state estimate \(\hat{x}_{t}\), Kalman gain \(K_{K}\)  Output: Updated state estimate \(\hat{x}_{t}\), updated error covariance \(P_{t}\) \(\hat{x}_{t}=\hat{x}_{k}^{-}+K_{t}\left(z_{t}-H\hat{x}_{t}^{-}\right)\) #State estimate update \(P_{t}=(1-K_{t}H)P_{t}^{-}\) # Error covariance update
```

**Algorithm 1** Kalman Filtering for Energy Harvesting

### RF Energy Scavenging Performance

To validate the proposed Colinear-type antenna design, the efficiency of energy acquisition was evaluated. The material plate (\(\varepsilon=4.4\)) of the 2.4 mm thick FR4 substrate was chosen as the circuit surface for printing the antenna. The dimensions were selected according to optimal parameters in simulations. The PCB layer of the antenna was designed using Altium Designer software, and the actual antenna of the Collinear Dipole type is shown in Figure 3C (Section 3.1). An experiment was conducted to investigate the energy density around the energy harvesting module's antenna. The receiving Collinear Dipole type antenna is connected to the spectrum analyzer (N9320, Keysight Technologies, USA) to collect the wavelengths of the RF emitted from the 1 W transmitter at a specific distance. Figure 4 demonstrates the curve of the collected RF energy simulations and actual lines. The distance between the TX transmitter and the RX receiver's module varied from 0 m to 2 m. The antenna's harvested power (dBm) gradually reduced in the simulation, in accordance with the official formula (4). At a distance of 50 cm, the RF energy reaches 5.47 dBm, and the output power is 3.54 mW, which is sufficient for the buck-boost converter to start working. ## 5 Food Monitoring Method and Data Preprocessing for Machine Learning

### Criteria for Data Preprocessing Process and Degree of Rotten

The environment for storing meat varies substantially based on the region's location, climate, and timing. The degree of decomposition varies depending on the meat breed, the breeding environment, and the slaughter age. According to the FDA's recommendations on food storage [7; 17], pork will be safe if stored in the refrigerator for three to five days. Pork deteriorates quickly at room temperature within 24 h, necessitating the use of an automated system to detect changes. For stable sensor operation, a 3W transmitter was employed as the RF source, with the transmission distance to the sensor module adjusted to 50 cm. The sensor tag's energy harvesting unit is powered by built-in MCUs and sensors as the collected RF energy is converted into electricity. It is stored in a low-power microprocessor (STM32L053, STMicroelectronics, Coppell, TX, USA) and transmitted to the BLE chip using a Universal Asynchronous Receiver/Transmitter (UART).