## 2 Materials and Methods
### Electrochemical and Photoelectrochemical Versatile System Design
#### 2.1.1 Potentiostat Circuit  
The potentiostat is a fundamental EC tool with diverse analytical applications. Its core function is to maintain a constant potential difference between the WE and RE within an EC cell [56]. It simultaneously measures the current flowing through the WE, with the CE adjusting this current to ensure stable cell potential control [56]. Figure 3 illustrates the schematic of our designed potentiostat, based on the DeFord circuit [57]. This design is adaptable to two-electrode configurations by shorting the CE and RE via an analog switch (TMUX1113). To achieve a nominal \(\pm\)2.5 V working range, we employed a 2.5 V reference (REF3425) as the potentiostat's virtual reference point while using a separate 5 V low-dropout regulator (LDO regulator) ADP7105-5.0 for other components. The 16-bit digital-to-analog converter (DAC, DAC80501) generates the voltage setpoint for the control amplifier stage, which utilizes one operational amplifier (LMP7721, denoted as OP2) and three from a quad operational amplifier package (OPA4388, OP4B-D). User-selectable single-ended or differential modes are enabled through switched feedback paths from the RE. OP4B and OP4D function as voltage followers, in which only the OP4B operates in single-ended mode. In differential mode, OP4B-D forms a differential amplifier with the positive input of OP4D shorted to the WE and the differential gain of 1 (R4 = R5 = R6 = R7). The output of this feedback signal to the control amplifier (differential amplifier in differential mode or OP4B in single-ended mode) feeds into the positive input of OP4A, configured as an electrometer. This signal is then sent to a 24-bit analog-to-digital converter (ADC, ADS122C04) to measure the actual WE-RE control potential. Leveraging an ADC of 2000 samples per second (sps), the circuit offers a selectable scan rate or sampling interval for data acquisition, depending on the selected measurement. Users can choose from six scan rates (20 mV/s, 50 mV/s, 100 mV/s, 200 mV/s, 500 mV/s, and 1000 mV/s) to analyze signal changes over time or select one of seven sample intervals (40 sps, 90 sps, 180 sps, 350 sps, 660 sps, 1200 sps, and 2000 sps) for capturing data points at specific intervals. To measure the current through the WE, the OP3 (LMP7721) has the role of a trans-impedance amplifier (TIA), converting the current on the WE into a voltage (I/V converter). This converter offers four parallel channels with feedback resistors and capacitors providing sensitivities of 10 mA/V, 100 uA/V, 1 uA/V, and 10 nA/V. The feedback capacitor values ensure a consistent 3386 Hz TIA gain bandwidth across all feedback resistor settings. This converted voltage is then also fed into the ADC for acquisition. For the microcontroller unit (MCU), ESP32 was used to control the potentiostat circuit using the Inter-Integrated Circuit (I2C) communication in which the LDO regulator ADP7105-3.3 is the power supply for this MCU. The MCU ESP32 also supports Bluetooth Low Energy (BLE) for interaction with the Android-based  
Figure 2: The conceptual EC\(-\)PEC system includes (**1**) potentiostat; (**2**) EC-PEC experimental chamber; (**3**) monochrome excitation light source; and (**4**) Android\(-\)based user interface.  
user interface. Additionally, in the designed potentiostat circuit, another 4-channel resistor with the same resistance values as the TIA's feedback resistors was also used as the internal calibration for adjusting the TIA's gain value and the DAC output value.