# A Communication Framework for Image Transmission through LPWAN Technology
## 3 Proposed Framework
### Framework Interconnection
#### 3.5.2 Stage Flow Process  
In stage I--processing and classification--the images are classified into normal or abnormal features. Thus, only the abnormal is transmitted between transmitter and receiver. Then, the abnormal samples are converted with wavelet transform. In stage II, the data is operated with CS, and its results give us a sparse vector with decimal and negative numbers. LoRa technology works with integer values among a range according to the spreading factor (SF) value. Thus, it was necessary to convert the sparse vector information into data supported in LoRa symbols. For this reason, it is necessary to encode the sparse vector. An encoder and decoder with an 8-bit structure were implemented. In stage III, it is necessary to create the LoRa symbols consequent with 8 bits, and therefore SF = 8 was implemented. Despite lower SF giving higher data rates for LoRa modulation, the SF's choice is to take into account the transmission of a compressed unit of the spare vector in one single LoRa chirp symbol, this simplifies the complexity of the reconstruction algorithm at the receiver at the expense of losing transmission data rates.  
Then, using National Instruments NI-2920 cards, the transmission and reception of LoRa symbols were implemented on SDR. Modulation features such as SF, BW, and the sampling frequency in the transmitter were set in conjunction with the interpolation and decimation factor in the receiver in order to achieve the bandwidth to sweep the value set up in the transmitter. Some specific features, such as the operating center frequency, gain, number of samples, and decimation factor value, had to be adjusted at the receiver.  
These values are required to operate within the operating frequency range. In our case, we needed to use a decimation factor that allowed us to sweep the BW used in the transmitter over 2 MHz of the spectrum around the central operation frequency (500 kHz). To restart the radio features, packet transmission and reception are required.  
In stage IV, a sweep from the beginning of the received vector to the end was required. Preamble and synchronization chirp symbols are also considered at this stage, as they are required to locate the image's coded information. The received vector was then analyzed using the Fast Fourier Transform (FFT) to find a peak between the image's preamble and data chirp symbols. Signal peaks in the FFT signal transform allow us to determine the end of the preamble and the start of the synchronization symbols; after two synchronization symbols (two symbols times 2_T_), we can determine the start of the data. Because the data were encoded in bytes, it was necessary to decode them in order to find the original values (wavelet transform representation). To accomplish this, a simple algorithm was developed that converts the received data back into its original form. Following the data decoding process, a vector of comparable length to the one transmitted is obtained. The resulting data contain information about the output wavelet transform values and positions, including negative values. Thus, the inverse wavelet transform is required, followed by taking the vector and adjusting the matrix with an original array, and finally representing the image and evaluating it with the PSNR function.