# Optimum System for Diagnosing Power Quality in Electrical Microgrids
## 3 Developed Electrical Measurement Network
### SDMD Prototype: Architecture and Characteristics
However, their capabilities must adhere to the requirements established by standards for voltage and current measurements, as detailed in Section 2.1. As mentioned earlier, in this work, a DSC was used to implement the source code, which was developed in the MPLAB(r) Integrated Development Environment (IDE) v6.20 using the C programming language. The source code was transferred to the DSC on the SDMD using the MPLAB(r) In-Circuit Debugger (ICD) 4. The selection of the DSC as a hardware component for implementing the source code was due to the free access to its IDE and the widespread use at the institution. Communication with other peripherals is enabled through the RS232 interface. In addition, a real-time clock (RTC) was used to keep track of the current time and date, which is necessary for the proper processing of collected data. Therefore, from the SDMD perspective, three tasks need to be enabled:  
* Receiving the measurement configuration and data requests;
* Performing and temporarily saving the measurements;
* Transmitting the voltage and current measurements for further processing. Before performing measurements, the SDMD receives information about the load connection (single-phase or three-phase) and measurement parameters, such as the numbers of cycles and points per cycle to measure. Data requests can be punctual or set for automated and continuous collection over time. The SDMD transmits and receives data in hexadecimal, which is unsuitable for further calculations. Therefore, the collected data need to be converted to decimals. Figure 4 presents the prototype of the SDMD, which is highlighted by its portability, featuring compact and lightweight components. The sensors are designed to clip onto existing infrastructure, requiring minimal setup. The SDMD includes eight terminals for measuring four voltages and four currents, allowing it to monitor phase voltage, phase current, and the neutral line in a three-phase system. Voltage measurements are facilitated by screw terminals, while current measurements use jack connectors. The non-invasive current sensor is not integrated into the smart meter, allowing for installation without the need to open the circuit. In addition, a terminal for zero-crossing detection is provided. The wide range of voltage and current measurement capabilities makes the SDMD versatile in scenarios with diverse loads. Another key feature is the easy access to programming and communications pins, which simplifies these tasks. The SDMD prototype was designed using EAGLE(r) v.9.6.2 software and subsequently manufactured. In summary, the selection of devices and their parameters for the SDMD prototype was guided by several key criteria: compatibility with established standards, the need for high measurement accuracy, and robustness in diverse industrial environments. Each parameter, such as voltage range, current range, and resolution, was chosen based on a comprehensive review of industry norms and the specific requirements of microgrid applications. The design of the SDMD is thoroughly justified and supported by both the technical literature [22; 29] and established standards for PQ analysis, notably the IEC 62053-21 standard [39], which confirms the appropriateness of the ZMPT101B voltage sensor and the SCT-013 current sensor. These selections are further validated by their proven effectiveness in PQ monitoring and their ability to minimize quantization errors with the ADAS3023 external ADC's high resolution and fast conversion rates, ensuring precise measurement of electrical parameters, especially in systems with multiple nodes requiring simultaneous data acquisition. In addition, the use of low-cost, open-source hardware platforms such as the DSC enhances scalability, cost-effectiveness, and integration into various microgrid configurations. The RS232 communication protocol was selected for its robustness in handling noise, making it particularly suitable for electrically noisy environments, such as industrial settings.