# Real-Time Remote Sensing of the _Lobesia botrana_ Moth Using a Wireless Acoustic Detection Sensor
## 2 Materials and Methods
### Filter Design Procedure  
The Welch PSD [40; 41] allowed us to estimate the power of a signal at different frequencies using periodogram spectrum estimates, converting the time signal to the frequency domain. [PERSON]'s method computes a modified periodogram for each segment and then averages these estimates to produce the estimate of the power spectral density. [PERSON]'s method uses PSD estimates of different segments of the time series; the modified periodograms represent approximately uncorrelated estimates of the true PSD and averaging reduces the variability. The segments are typically multiplied by a Hamming window so that [PERSON]'s method amounts to averaging the modified periodograms. The segments are partly overlapped; this guards against the loss of information caused by windowing. In our implementation, the sample rate was 250 kHz and the signals had different durations (around 2,500,000 samples each). To obtain the [PERSON]'s overlapped segment averaging, the PSD estimate of the signal used a segment length of 32,768 samples with 16,384 overlapped samples. To design the filter, it was necessary to know the behavior of the signals that characterized the sound produced by the moth. The first step in measuring the moth signals was to characterize the container where the moths were placed. Figure 4 shows the PSD obtained from the container without moths. The first thing we observed were the peaks, which stood out at around 20 dB from the background level. The peaks of that prominence were a product of periodic signals with a constant frequency. This is mainly the case for electromagnetic interference and harmonics produced by electric power lines, fluorescent lamps, analog or digital electronic components of power amplifying and communication circuits of microphones. As this was a reference signal for our experiments, all these effects were not considered in the signal comparison. Figure 3: Time signal recorded from the acquisition setup: (**a**) without moths; (**b**) with moths. In addition to the peaks, it was also interesting to notice that the background curve was not flat; it has a resonance at around 50 kHz. This non-flat course corresponded with the shape of the internal noise of the microphone, as presented by the manufacturer of the MEMS microphone [42]. The process continued by entering different numbers of moths into the container. In our experiment, we used a different number of moths in the container (varying from 1 to 50). Two cases are shown in Figures 5 and 6. In addition, the experiment was repeatedly performed and replicated over several days; therefore, an experimental signal database was built with the information of the flying moths under laboratory conditions. The PSDs obtained for the containers with 8 and 50 moths are shown in Figures 5 and 6, respectively. On each figure, a reference PSD was added (in a red color) that corresponded with the container without moths (as shown in Figure 4). Figure 5a shows the moth signal recorded as produced by 8 moths inside the container and Figure 5b shows its respective PSD. Similarly, Figure 6a shows the signal captured when there were 50 moths in the container and Figure 6b represents its PSD. Note the increase in the PSD amplitude (around 10 dB) when there were moths inside the container compared with the reference (the container without moths) at frequencies between 6 kHz and 30 kHz. From the two figures (Figures 5 and 6), it was possible to observe an increase in the amplitude of the PSDs in the frequency ranges between 6 kHz and 12 kHz and between 18 kHz and 30 kHz. Applying the PSD to several signals obtained from the moths always produced variations in the amplitude in ranges close to 8 kHz and 20 kHz. In this way, it was chosen to define two bandpass filters centered at frequencies of 8 kHz and 23 kHz, respectively. The final filter is presented in Figure 7. Figure 8 shows the filter response by using a flying _Lobesia botrana_ signal (Figure 8).