# Wireless Data Acquisition System with Feedback Function
## Appendix A  
The diagnostic mode is intended for online remote diagnosis of the health of sensors and for the monitoring of the main parameters of their settings without disconnecting the sensors from the SWPP circuits and without connecting additional wires to them. It is initiated separately for each sensor using a standard infrared remote control in pauses between sensor polling pulses from the IR-RPG, or when the latter is temporarily turned off. Diagnostic results are received remotely using a standard radio module and displayed on a laptop screen using a standard TTL-USB adapter or on a smartphone screen using a Bluetooth module. Examples of sensor responses to diagnostic data requests are shown in Figure 19.  
In the first of the examples given, the supply voltage of sensor No. 2 is less than 3.05 V, which is reflected in the fifth line of the log file of the message \"Low supply voltage!\", underlined in red. Sensors No. 2 and No. 3 are configured to measure voltage only, and No. 4 is configured to measure voltage and current up to 15 A with an external shunt. Appendix C 1. At the beginning of the program, the values of the INA219 sensor configuration registers are selected for the following reasons:  
In the bottom line of Table 20, there are values of the configuration register bits that we selected (highlighted in red) in accordance with the recommendations from the following fragments of the INA219 datasheet. All INA219 16-bit registers are actually two 8-bit bytes via the I2C interface. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**PG1** & **PG0** & **GAIN** & **RANGE** \\ \hline
0 & 0 & 1 & \(\pm\)40 MV \\ \hline
0 & 1 & +2 & \(\pm\)80 MV \\ \hline
1 & 0 & +4 & \(\pm\)160 MV \\ \hline
1 & 1 & +8 & \(\pm\)320 MV \\ \hline \hline \end{tabular}
\end{table} 
Table 10: PG Bit Settings \({}^{(1)}\). Bits 15 and 14 are left at their default values of 0. Bit 13 for the 32 V bus = 1. Bits 12 and 11 are used for the voltage drop across 80 MV shunt = 01. Bits 10 to 7 and 6 to 3 according to Table A4 for 32 samples with a 12-bit resolution are chosen equal to 1101. For sensors that measure the current as well as the voltage, according to Table A5, for operating mode = shunt and bus and continuous bits 2 to 0, select conditions 111. The result of selecting the bits of the configuration register will be entered in the bottom row of Table A1. Contents of the Config register = 0010.1110.1110.1111 = 2 EEF (Hex). For sensors that measure only the voltage, according to Table A5, for operating mode = bus voltage, continuous bits 2 to 0 are selected equal to 110. Contents of the configuration register for these sensors = 0010.1110.1110.1110 = 2 EEF (Hex). 2. To calculate the Calibr INA219 register, the program shown in Figure 4 performs the following steps:  
In the case of using an external shunt, the program calculates the resistance of the external shunt using the rated current and voltage drop across the shunt using Ohm's law, and then calculates the total resistance of the parallel-connected internal and external shunts using the well-known equation, Formula (A1):  
\[R_{shunt}=\frac{R_{internal\ shunt}\cdot R_{external\ shunt}}{R_{internal\ shunt}+R_{external\ shunt}}.\] (A1)  
In our case, it turns out that \(R_{shunt}\approx 4762\cdot 10^{-3}\) Ohm. The program then calculates the value of Current_LSB--(least significant bit--the value of the least significant bit of the register) for the Calibr register using Formula (A2):  
\[I_{LSB}=\frac{I_{maximum\ expected}}{2^{15}}=\frac{15\,\mathrm{A}}{32768}=0.00045 8\,\mathrm{A}.\] (A2)  
We select and enter into the program the nearest round value of \(I_{LSB}=1\) mA. The program calculates the maximum displayed current value, which fits into a 16-bit number, \(\mathrm{Imax}=32.768\) A.