# Stationary 3D Scanning System for IoT Applications
## 6 Scheme of Operation of the System  
A general scheme of operation of the 3D scanning system is shown in Figure 6, which illustrates an appropriate, cyclically repeating sequence of specific operations including user interaction. Initially, the appropriate height of the object to be tested must be specified, i.e., the largest dimension in the direction perpendicular to the surface of the rotating platform. Next, the entire scanning process begins, during which data are collected on each subsequent plane \"intersecting\" the fragment of the object's profile located at a given height from the starting position. Process parameters are checked here, using feedback, such as the position of both motors, and more precisely the number of revolutions made at a given angular speed, which is converted into linear displacement cyclically stored in non-volatile memory, which can be an external Flash memory source or by means of EEPROM emulation inside the microcontroller's memory. The control system is also equipped with wireless communication implemented via a type NRF24L01P radio receiving and transmitting signals in the 2.4 GHz frequency band [18]. This frequency allows communication over longer distances (approx. 2 km),  
Figure 5: A PCB that completes the entire control system. Figure 6: Diagram of the work state of the 3D scanning system. while maintaining transmission adequately matched to the speed of data collection by the scanner. The speed of receiving and transmitting data for the designed radio circuit is a maximum of 2 Mbps with a limited current consumption level of up to 14 mA. The radio module used expands the device's operations by enabling IoT device communication. Due to the modular nature of the device, it is possible to expand it in the future with a WIFI module. Input signals are also filtered using the implementation of the moving average filtering (\"MAF\") method, which makes it possible to compensate for unwanted harmonic components and reduce errors and measurement deviations resulting from the influence of interference and noise. This method was chosen due to its linearity and short and simple calculations that speed up filtration and do not place additional strain on the microcontroller [19]. It is based on determining the number of samples taken, which is constant each time, then summing them, and then a bit-shift simulating mathematical division is performed. The target raw data collection algorithm is based on summing a fixed number of samples of 32 (window size), which makes up one single measurement contained in the point cloud. This number was chosen appropriately so that it is possible to divide it, in order to obtain an average, using a bit-shifting operation that allows for faster data analysis. This operation is supported by the implemented low-pass filtration in the discrete domain, the mathematical formula of which is presented in the differential Equation (2) time domain. \[V_{out}+RC\frac{dV_{out}}{dt}=V_{in} \tag{2}\]  
and in the difference equation, e.g., after discretization, Equation (3) [4]:  
\[V_{out}[n]=\frac{T}{T+RC}V_{in}[n]+\frac{RC}{T+RC}V_{out}[n-1] \tag{3}\]  
where \(R\) is the resistance of the resistor; \(C\) is the capacitance of the capacitor, which in a real circuit forms a hardware-given filter as a passive component; \(V_{out}\) is the output voltage and \(V_{in}\) is the input voltage, which are given in the time domain; and \(n\) is a natural number that determines the index of a given sample. The algorithm performed cyclically by the 3D scanning system is based on the principle of the state machine, which allows for \"multitasking\"; i.e., the apparent parallel execution of two or more operations at the same time, by a microcontroller. A diagram of the system's state machine operations is shown in Figure 7. It represents the \"Source-Destination-Event\" layout, which determines the execution of appropriate operations due to the state in which the system is currently located and according to which it will be redirected using a specific event.