# Wireless Data Acquisition System with Feedback Function
## 2 Materials and Methods
### Description of the Developed Smart Wireless Sensor  
The block diagram of a current and voltage sensor developed in accordance with the concept formulated in Section 2.2 is shown in Figure 8. The designations in this figure are as follows: IRR--infrared receiver, VCS--primary voltage and current sensor, ZQI--quartz resonator, MCU--microcontroller, INT1--MCU interrupt line, PO.1-PO.3--MCU output port lines, LED--indicator LED, TX--radio transmitter, and RR--reed relay. A voltage divider made up of resistors R1 and R2, the output of which is connected to the AIN1 input of the analog comparator of the MCU, and an internal reference voltage source connected inside the MCU to the second input AIN0 of the analog comparator form a unit for monitoring the supply voltage of the MCU. The response threshold of the control unit is set using a precision construction resistor R2. The components located on the sensor board are highlighted in black, those connected externally are highlighted in blue, and those contained inside the chips are in red. The sensor can operate in main and diagnostic modes. In main mode, the sensor operates as follows. The TX (radio transmitter) is put into sleep mode most of the time and the RR relay contact is open. Thanks to this, the average power consumption of the sensor along the power circuit is significantly reduced, and the voltage measuring circuit practically does not consume current from the power battery. The MCU, through port INT1, cyclically polls the infrared receiver, sending reset pulses to the watchdog timer (WDT) built into the MCU at the end of the cycle. Therefore, in normal mode, the WDT does not interfere with the operation of the sensor. If the MCU freezes, for example due to strong electromagnetic interference, the WDT restarts the MCU after a set time (in our case, 512 ms), and its work according to the program automatically resumes. When a request is received from an IR request pulse generator (IR-RPG) or from an IR remote control, the microcontrollers of all sensors decipher it, but only one MCU responds to the request, having accepted the code stored in its memory. This MCU uses the RR relay contacts to connect \"its\" VCS to the battery for a time of about 15 to 50 ms. After the measurement process is completed, the MCU reads the current and voltage from the VCS registers. Then, the MCU of the requested sensor generates a response message containing a byte of the sensor number, two bytes of voltage, two bytes of current, and a checksum byte of the package. After which, several times in a row, it transmits a packet of several such parcels onto the airwaves at a speed of 9600 baud. During the process of measuring and transmitting the packet, the LED lights up, visualizing the sensor's response. To transmit  
Figure 8: Block diagram of wireless current and voltage sensor. a packet, the transmitter (TX) is brought out of the sleep state for 200 to 300 ms. Other wireless network sensors ignore the request that was not intended for them. Repeated transmission of information parcels and their checksum makes it possible to organize on the receiving side software detuning from reception errors in the presence of interference in the radio channel. In practice, it has been established that when using JDY-40 transceivers, to organize an uninterrupted data collection process in the SWPP ToU hardware room, it is enough to have 3-4 parcels in a package. The organization of a noise-resistant radio channel is described in more detail by the authors in [44]. If the supply voltage of the sensor drops below the set threshold, the signal at the output of the supply voltage monitoring unit changes, and the transmitter MCU adds the number 100 to the sensor number. The signal generated in this way in relation to the decrease in supply voltage is easily allocated by the MCU on the receiving side of the radio channel. If a code is received that corresponds to a request for the sensor to enter into diagnostic mode, the MCU initiates the transmission of diagnostic data via radio.