# IoT System for Detecting the Condition of Rotating Machines Based on Acoustic Signals
## 3 Architecture of the Proposed System
### Communication between Device for Acquisition and Cloud Platform  
As mentioned earlier, the communication between the acquisition device and the cloud platform is an important segment of the proposed system. In the initial phase of development, there was a dilemma whether to transfer recorded files and perform processing on the cloud (or at the user's server) or should perform all processing on the acquisition device and send only the obtained estimation of the machine state. Based on the experience regarding the size of the recorded files and considering the characteristics of the GPRS connection, we decided to apply this second approach [37]. Thus, the amount of data transmitted over the GPRS connection is very small, which reduces the possibility of communication problems, as well as its costs. On the other hand, reliability increases because information about the state of the machine can be obtained immediately, on the spot, even if the communication with the cloud platform does not work properly.  
In the implementation of the proposed system prototype, we used the GSM/GPRS communication module Waveshare GSM/GPRS/GNSS HAT [38]. This module is adapted for use with RPi microcomputers, which greatly facilitates system development. It can be connected to RPi in several ways, and in the current implementation, a USB connection is used. RPi 3B has four USB ports available, and our device requires two: one for microphone connection and the other for a GPRS module (see Figure 8).  
Figure 9: Installation of acquisition device: bracket for device accommodation (**left**); device mounted on the industrial coal mill (**right**).  
Using the USB port makes it much easier to establish communication with the GPRS module. The programmer just needs to include the _serial_ library in the Python code (line 2 in Figure 10). After that, the communication with the corresponding device has to be opened and the communication speed is set. Then, the corresponding AT commands in the form of strings are sent to the module via a set of \"_write_\" commands.  
Figure 10 shows a part of the program code for sending data about the state of the observed machine to the mentioned cloud portal. The parameters shown (_apn_, _username_, and _password_) refer to the local mobile Internet provider. Instead of the asterisks in line 16, the proper key for writing to the particular node of the cloud platform must be entered. Information on the estimated machine state is in the variable _state_estimation_. We send this information to the cloud using the GET method. This process begins with the command in line 14 by the initialization of the HTTP request and is finalized with the command in line 19.  
Figure 11 illustrates a diagram from a cloud platform that depicts information about the state of a rotating machine. As one can see from the figure, this diagram, and thus the information about the condition of the machine, can be downloaded and viewed by any device with Internet access, even on a mobile phone.  
Figure 11: Diagram from the IoT cloud platform shown on the mobile phone.  
Figure 10: Part of the program code for GPRS communication.