# Wireless Data Acquisition System with Feedback Function
## 2 Materials and Methods
### Obtaining Initial Information about Current and Voltage  
To ensure the functionality of the monitoring system, at a minimum, information about the current and voltage in the power circuits is required [7; 36]. Currently, there is no doubt that measurements and data transfer must be carried out in digital form. A typical way to measure and digitize constant voltage today is to use analog-to-digital converters (ADCs) with the averages of multiple samples to reduce amplitude jitter. For this purpose, as a rule, ADCs that are part of modern microcontrollers (MCUs) are most often used. However, the reference voltage in such ADCs usually does not exceed 5 V, and to bring higher voltage levels in the power circuits of the SWPP to the input voltage range of the built-in ADC, it is necessary to use resistive voltage dividers, as shown in Figure 1. When measuring current to measure small voltages on shunts or Hall sensors, it is impossible to do so without additional direct current amplifiers, which are subject to zero drift at their outputs and require a bipolar power supply [37]. Along with a decrease in resolution and accuracy, all this complicates the sensor design and forces the use of more expensive MCUs with 12-bit ADCs. The approach to the selection of equipment for measuring direct current and voltage is radically changed by the appearance on the general market [38] of inexpensive digital sensors in an integrated design, which make it possible to comprehensively solve all of the above problems. To obtain primary information about current and voltage directly in digital form, the most suitable sensors in our case were the INA219 sensors, allowing for the simultaneous measurement of not only voltage, but also the strength and power of the direct current. A block diagram of the INA219 current and voltage sensors is shown in Figure 3. These sensors already contain inside the crystal [39] a measurement mode switch (current-voltage), a pre-amplifier, and a built-in 12-bit ADC, which provides much higher metrological and speed parameters than the 10-bit ADC of most widely used microcontrollers. In addition, they are very compact and economical, consuming no more than 1 mW in the power supply circuit. Using one such sensor, you can simultaneously measure voltage up to 26 V, current up to 3.2 A, and power up to 83 W with high accuracy. To expand the current and power measurement limits, an external shunt is used. Current measurement is carried out using a 0.1 Ohm resistor (shunt) with an accuracy of 1% (inputs Vin+ and Vin\(-\)). The microcircuit, by averaging a given number of ADC samples, measures the voltage at the terminals connecting the voltage and the voltage drop across the shunt, and then, according to the laws of electrical engineering, calculates the current and power and enters them into its internal registers. The contents of the registers can be read from the microcircuit via the I2C interface in a time of about 1 ms. Calculation of the contents of the INA219 registers for sensors intended for installation on the batteries of the SWPP of Toraighyrov University (ToU) was carried out in the BasCom  
Figure 3: Block diagram of INA219 current and voltage sensors. AVR environment using a program compiled on the basis of the methodology from the datasheet of the INA219 module. A fragment of the program is shown in Figure 4. A more detailed description of the calculation algorithm included in the program is provided in Appendix C.  
As a result of the calculation, for sensors measuring current with a shunt of 15 A, 75 mV, the values of the register Config = 2 EEF (Hex) were obtained (averaging from 32 + 32 ADC samples for 34 ms), and for the register, Calibr = 8664. For voltage-only sensors, Config = 2 EEE (average of 32 ADC samples in 17 ms; ADC does not waste time measuring current) and Calibr = 0000. The selected sensor settings provide a maximum displayed current of 32,8 A without register overflow and no jitter between repeated measurements.