Design and Implementation of an Electrical Characterization System for Membrane Capacitive Deionization Units for the Water Treatment - MDPI
←
→
Page content transcription
If your browser does not render page correctly, please read the page content below
membranes Article Design and Implementation of an Electrical Characterization System for Membrane Capacitive Deionization Units for the Water Treatment Federico A. Leon * , Alejandro Ramos-Martin and David Santana Departamento de Ingeniería de Procesos (Process Engineering Department), Campus de Tafira, Universidad de las Palmas de Gran Canaria (University of Las Palmas de Gran Canaria), 35017 Las Palmas de Gran Canaria, Spain; alejandro.ramos@ulpgc.es (A.R.-M.); david.santana122@alu.ulpgc.es (D.S.) * Correspondence: federicoleon@perezvera.com; Tel.: +34-686-169-516 Abstract: The desalination of seawater is one of the most established techniques in the world. In the middle of the 20th century this was achieved using water evaporation systems, later with reverse osmosis membranes and nowadays with the possibility of capacitive deionization membranes. Capacitive deionization and membrane capacitive deionization are an emerging technology that make it possible to obtain drinking water with an efficiency of 95%. This technology is in the development stage and consists of porous activated carbon electrodes, which have great potential for saving energy in the water desalination process and can be used for desalination using an innovative technology called capacitive deionization (CDI), or membrane capacitive deionization (MCDI) if an anion and cation membrane exchange is used. In this paper is proposed and designed a characterization system prototype for CDI and MCDI that can operate with constant current charging Citation: Leon, F.A.; Ramos-Martin, and discharging (galvanostatic method). Adequate precision has been achieved, as can be seen in A.; Santana, D. Design and the results obtained. These results were obtained from the performance of typical characterization Implementation of an Electrical tests with electrochemical double layer capacitors (EDLC), since they are electrochemical devices that Characterization System for behave similarly to MCDI, from the point of view of the electrical variables of the processes that take Membrane Capacitive Deionization place in MCDI. A philosophy of using free software with open-source code has been followed, with Units for the Water Treatment. Membranes 2021, 11, 773. https:// software such as the Arduino and Processing programming editors (IDE), as well as the Arduino doi.org/10.3390/membranes11100773 Nano board (ATmega328), the analogical-digital converter (ADC1115) and the digital-analogical converter (MCP4725). Moreover, a low-cost system has been developed. A robust and versatile Academic Editor: Jianhua Zhang system has been designed for water treatment, and a flexible system has been obtained for the specifications established, as it is shown in the results section. Received: 16 September 2021 Accepted: 5 October 2021 Keywords: membranes; capacitive deionization; reverse osmosis; desalination Published: 11 October 2021 Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in 1. Introduction published maps and institutional affil- The desalination of seawater is one of the most established techniques in the world. iations. In the middle of the 20th century, this was achieved using water evaporation systems and later with reverse osmosis membranes. However, the resulting high energy consumption, generally through fossil fuels, has been an important issue to solve [1–4]. Modern times have introduced the possibility to transition from the use of reverse Copyright: © 2021 by the authors. osmosis to capacitive deionization (CDI), or membrane capacitive deionization when Licensee MDPI, Basel, Switzerland. an anion and cation membrane exchange is used, which is a novel system still under This article is an open access article development that, in addition to removing salt from the water, allows for the storage of distributed under the terms and energy, similar to other electrochemical devices (batteries, supercapacitors, etc.) [5–8]. conditions of the Creative Commons Currently, some media outlets are claiming that the current hydrological year is the Attribution (CC BY) license (https:// driest hydrological year of the decade. In the last 12 months, the Spanish water reserve has creativecommons.org/licenses/by/ 4.0/). decreased by a volume of water equivalent to that of the Ebro Basin (7511 hm3 of capacity). Membranes 2021, 11, 773. https://doi.org/10.3390/membranes11100773 https://www.mdpi.com/journal/membranes
Membranes 2021, 11, 773 2 of 50 These phenomena are aggravated by the evident signs of climate change and, in coun- tries such as Spain, by the advance of desertification processes in large areas, causing water to become so much of an essential resource that it has become as precious a commodity as oil [4]. Knowing that 97% of the planet’s water is salty, the desalination of brackish or marine water (or seawater desalination) is one of the possible alternatives to mitigate the problem. However, current desalination technologies, such as reverse osmosis and distillation present a serious problem, which is the high energy consumption required to produce drinkable water, as well as the problem of boron removal. Capacitive deionization (CDI) is an emerging technology that makes it possible to ob- tain drinking water with an efficiency of 95% [5–10]. This technology is in the development stage and consists of porous activated carbon electrodes, which have great potential for saving energy in the water desalination process and can be used for desalination using an innovative technology called capacitive deionization (CDI) and membrane capacitive deionization (MCDI). In CDI and MCDI, salt ions are removed from brackish water by ap- plying a voltage difference between two porous electrodes in which the ions are temporarily immobilized, and dissolved salts are removed from different types of water [6–9]. The design and implementation of a characterization system for capacitive deioniza- tion units for water treatment was performed using types of water ranging from supply water to water from industrial processes. Capacitive deionization has emerged over the years as a robust, energy-efficient solution for water treatment [10–18]. It is an effective technology for the desalination of water with low to moderate salt content [5]. The optimal operating regime is obtained for water with a salt concentration of slightly less than 10 g/L [18]. Since the salt ions are minority compounds in the water, they can be removed from the mixture with this technology. In contrast, other methods extract the water phase from the salt solution. This technology also allows for the possibility of integrating renewable energy sources and energy storage [6–10]. The main objective of this study was the design and implementation of an electrical characterization system for capacitive deionization units in water treatment. The intention was also to make use of this system to obtain results that will make it possible to analyze the impact of this technique on different CDI and MCDI elements. The electrical characteri- zation system of CDI and MCDI has been implemented before [11–13]. In more detail, the objectives to be achieved are the following: To study a control system with a microcontroller (ATmega328 MICROCHIP) that will allow interaction, control, conditioning of different tests and data collection with the medium. For future implementations, to study the variation of the concentration as a result of the influence of injecting energy into the system, being influenced by the pH of the solution, temperature, conductivity, etc. Analyze by numerical methods the variables involved in the system, Develop a system capable of testing different situations that verify the tests described in similar works of the field. Establish a laboratory-scale electrochemical evaluation methodology for the electrical characterization of CDI and MCDI. In addition to the tests, the results obtained will be used to determine improvements in active materials (activated carbon, carbon fibers, carbon aerogels, etc.) and the current collectors that make up the electrodes. The set of results generated will serve as didactic material to illustrate the influence of the effects studied. This material will be useful for future students and teachers of degrees and masters programs of different universities thanks to the research and improvements on the CDI and MCDI units.
Membranes2021, Membranes 2021,11, 11,773 x FOR PEER REVIEW 33ofof50 52 2.2. Materials Materials and and Methods Methods Compared to Compared to the the classical classicalworking workingmodesmodesofof thethe 20th century, 20th there century, have there beenbeen have sev- eral innovations and new technologies, such as ion exchange in the membrane several innovations and new technologies, such as ion exchange in the membrane (see (see Figure 1) [14–18], Figure and operational 1) [14–18], optimization and operational in modes optimization suchsuch in modes as “stop-flow” as “stop-flow”during ionion during ex- change [19], salt ratio upon voltage reversal [16], current constant during operation exchange [19], salt ratio upon voltage reversal [16], current constant during operation [19], [19], energyrecovered energy recoveredfor fordesalination desalinationin inrelation relationto tocycling cycling[20,21], [20,21],flow flowthrough throughelectrostatic electrostatic wherewater where waterisisdirectly directlyfaced faced through through thethe electrostatic electrostatic [22,23] [22,23] andand flow flow electrodes electrodes based based on on suspended carbon suspended carbon [24]. [24]. Figure 1. Capacitive deionization cell (CDI). Figure 1. Capacitive Regarding the deionization cell (CDI). historical evolution of CDI and MCDI, a stage was defined before 1995, when aerogel carbon was developed for CCD. The peons who worked with the desalination conceptRegarding called itthe historical evolution “electrochemical waterofdemineralization” CDI and MCDI, a and stageitswas defined before originators 1995, were Blair, when aerogel carbon was developed for CCD. The peons who worked with Murphy and their colleagues, in the 1960s [25–28]. The basic standardized methods for the desalina- tion concept called supercapacitors haveit been “electrochemical used to study water demineralization” the behavior of CDI and and its originators MCDI were [29–33]. These Blair, Murphy and their colleagues, in the 1960s [25–28]. The basic standardized methods are constant current charging and discharging, constant power cycling, cyclic methods for supercapacitors voltammetry have been usedimpedance and electrochemical to study thespectrometry. behavior of CDI andprocedures, These MCDI [29-33]. andThese the methods are constant current charging and discharging, constant power cycling, self-charging and self-discharging phenomena, will be classified into three typologies: cyclic voltammetry frequency, and electrochemical dynamic impedance spectrometry. These procedures, and the and energy characterization. self-charging and self-discharging phenomena, will be classified into three typologies: fre- quency, 2.1. dynamic Frequency and energy characterization. Characterization The electrochemical impedance spectroscopy (EIS) method is used to characterize the electrochemicalCharacterization 2.1. Frequency behavior of energy storage devices. The electrochemical This method has gained impedance popularity spectroscopy (EIS) method in the last decade, is used especially to characterize in the determination the electrochemical of the capacity inbehavior fuel cellsof energy and storage batteries, duedevices. to the development of the electric car [34,35]. The Thispurpose method of hasthe EIS ispopularity gained to study the system in the response last decade, to the application especially of a small in the determination amplitude periodic of the capacity in fuelalternating current (AC) cells and batteries, due tosignal. These measurements the development of the electricare carcarried [34,35]. out atThedifferent purpose frequencies, of the EIS which is why is to study theitsystem is in the frequency response characterization to the application of agroup. small However, this technique is very sensitive, and it is essential to perform amplitude periodic alternating current (AC) signal. These measurements are carried out it as accurately as possible. Therefore, it is necessary to use several characterization techniques, at different frequencies, which is why it is in the frequency characterization group. How- because there isever, no single techniqueisthat this technique verygives all theand sensitive, expected results.toComplementary it is essential techniques perform it as accurately are as pos- therefore used. it is necessary to use several characterization techniques, because there is sible. Therefore, On thetechnique no single other hand, there that areall gives limitations the expected at high frequencies results. with CDI, due Complementary to the low techniques are impedance that therefore used. the CDI cell can present. One of the factors conditioning the impedance of CDI is dissolution, while others are caused by coupling effects between the power supply
Membranes 2021, 11, 773 4 of 50 and the media system cables [36]. These adversities are limited to low frequencies. In practice, twisted cables are used for the measurement cells to reduce these types of errors. 2.2. Dynamic Characterization The constant current charge/discharge method is the simplest method to apply with direct current (DC). It analyzes the response of CDI when a constant charge/discharge current is applied to it. Despite being a basic method, it is widely used in the characteri- zation of capacitors. Its application is documented with standardizations and will be the main object of the characterization of CDI in this work, being the main endorsement of the designed device [37–40]. The self-charging or self-discharging of CDI has its origin in two main causes. First, when CDI is charged or discharged, there is a diffusion of ions from the solution to the activated carbon electrode, or vice versa. The diffusion immediately after charging or discharging causes a self-discharge or self-charge, respectively. Secondly, these phenomena exist due to leakage current. Self-discharge by diffusion occurs predominantly in the initial stage. However, self-discharge by leakage is significant after self-discharge begins [41]. Self-discharge originates during dynamic operation, e.g., the dynamic operating cycle of electric vehicles [42], whose genome is through the equivalent impedance method, whose phase element is constant. On the other hand, we highlight cyclic voltammetry (C.V.), which has achieved the distinction of a procedure used to evaluate the performance of energy storage systems, as well as to determine the life cycle, the effects of internal resistance and the dissipation losses [43]. The method consists of applying a linear voltage ramp and storing the current response in the capacitors. This current is directly associated with the capacity of the component achieving a versatile procedure [44–49]. Constant power cycling is known as “cycle life testing” (C.L.T.); it is a methodology for calculating the electrochemical device parameter based on periodic charging and discharging, separated by rest time intervals [50–53]. The procedure consists of charging the device at a given power until a voltage is achieved [54–57]. Once this point is reached, the polarity of the current is reversed by applying a given value, and the current is resumed by reversing the current, so that the charging cycle is continued up to a higher voltage [45,46]. This is a research study in the industrial field and several milestones have been previously established, which are as follows: 1. A device capable of characterizing capacitive deionization (CDI) and membrane capacitive deionization (MCDI) for different tests, shown in Figure 2, in such a way that the main characteristics of capacitive deionization can be obtained, such as equivalent series resistance, capacitance, etc. 2. A system capable of collecting the test parameters and configuring it through a graphical user interface (GUI). 3. A procedure capable of characterizing the CDI and MCDI for stationary flows. 4. The results obtained will be studied in future research lines for CDI and MCDI technology. 2.3. General Description of the System Figure 2 shows the scheme of the characterization system prototype for capaci- tive deionization (CSP-CDI), and the interrelation of components. These components that make up this diagram define the fundamental structure of the system. It is briefly explained below: 1. Control and data acquisition system (microcontroller ATmega328): this part of the system can store data and control the different parameters of the CSP-CDI. This part of the system can analyze the data in real time to actuate the power system. The microcontroller ATmega328 model (Atmel, Beijing, China) is implemented in the platform Arduino Nano (Arduino, Beijing, China). This microcontroller is responsible
Membranes 2021, 11, 773 5 of 50 for directly controlling the galvanostatic charging process, so as to capture the data and send them to a PC for saving them (Appendix A shows the Arduino source code). 2. Power system (OPA549): A power operational amplifier OPA549 (Texas Instruments). This operational amplifier can provide a nominal current of 8A and also has a special input (ilim) for limiting the output current of the amplifier. This is an important feature for implementing galvanostatic charge or discharge (by controlling the cur- rent). This operational amplifier is responsible for sourcing the system, in order to charge and discharge the CDI cell or other similar electrochemical devices (batteries, electrochemical double layer capacitors, etc.). 3. ADS1015: An analogical-digital conversion stage based on the precision converter ADS1015 (Texas Instruments, Shanghai, China). This stage has two differential analog inputs for measuring: the charging or discharging current and the voltage of CDI cell. Current i(t) is measured from the voltage of a resistor Rm = 0.1 Ω, which is arranged between the output of the operational amplifier and CDI cell and the CDI cell voltage v(t) directly. The circuit ADS1015 has a 12-Bit resolution, which sets a resolution of 3 mV for the voltage measuring and 30 mA for the current measuring. 4. MCP4725: Two digital-analogical conversion stages based on MCP4725 (MICROCHIP, Beijing, China) with a resolution of 12 Bit. These stages are used to control the charg- ing/discharging processes of EDLC, for setting the voltage and current intensity references. 5. A PC: that is responsible for controlling and configuring the microcontroller for conducting the tests and storage of data obtained from the measurements. This is achieved through a script made in JavaScript language under Processing IDE (Processing Foundation). For the different tests, data were sent to the PC from the microcontroller (ATmega328), where they were saved by means of the use of Processing tool. At the Appendix B is showed the Processing source code, and Figure 3 displays the control interface achieved with Processing, for being used at the PC. 6. CDI cell: this is the object of study of this paper. Its correct operation is essential to Membranes 2021, 11, x FOR PEER REVIEW characterize it. Its operating range has been designed to satisfy the needs required 5 ofin 52 the programmed tests, which have carried on with different EDLCs (electrochemical double layer capacitors) for commissioning and evaluation. Figure2.2.Scheme Figure Schemeof ofthe thecharacterization characterizationsystem systemprototype prototypefor forcapacitive capacitivedeionization deionization(CSP-CDI). (CSP-CDI). 2.3. General Description of the System Figure 2 shows the scheme of the characterization system prototype for capacitive deionization (CSP-CDI), and the interrelation of components. These components that make up this diagram define the fundamental structure of the system. It is briefly ex- plained below:
(Processing Foundation). For the different tests, data were sent to the PC from the microcontroller (ATmega328), where they were saved by means of the use of Pro- cessing tool. At the Appendix B is showed the Processing source code, and Figure 3 displays the control interface achieved with Processing, for being used at the PC. 6. CDI cell: this is the object of study of this paper. Its correct operation is essential to Membranes 2021, 11, 773 characterize it. Its operating range has been designed to satisfy the needs required in 6 of 50 the programmed tests, which have carried on with different EDLCs (electrochemical double layer capacitors) for commissioning and evaluation. Figure 3. Figure 3. −Processing ProcessingPC PCcontrol control interface interface and anddata datalogger. logger. Comme 3.3. Results Results The target The target prototype prototype developed developed for for characterization characterizationtesting testingisiscapable capableofofcharging charging and discharging at constant voltage and current (galvanostatic mode). InInaddition, and discharging at constant voltage and current (galvanostatic mode). addition,the thepower power supply provides the load with a constant current at 95% efficiency supply provides the load with a constant current at 95% efficiency and establishes the and establishes the duration duration for which for which thethe nominal nominal voltage voltage is ismaintained. maintained.The The device device isis capable capableofofmeas- measuring uring current and voltage with a maximum error tolerance of ± current and voltage with a maximum error tolerance of ±1%. Moreover, voltmeter 1%. Moreover, voltmeter mea- measurements surements havehave a resolution a resolution of of 0.125 0.125 mVmVfor forvoltage voltagemeasurement. measurement. The Theinput inputimped- impedance ance of these voltmeters must be sufficiently high for measurement errors to be negligible. of these voltmeters must be sufficiently high for measurement errors to be negligible. To To obtain the data, an analog-digital converter (ADC1115) was used, which has a series of obtain the data, an analog-digital converter (ADC1115) was used, which has a series of filters at the input and output of the converter, resulting in precise, noise-free data. filters at the input and output of the converter, resulting in precise, noise-free data. The designed device must be able to perform constant voltage and current charging The designed and discharging, device as well must be ablevoltage as simultaneous to perform constant and current voltage and measurements current at the termi-charg- ing and discharging, nals of the CDI cell. as well as simultaneous voltage and current measurements at the terminals of the CDI cell. The power supply (through the OPA549) must be able to provide the constant load Thetopower current the CDIsupply cell with(through the OPA549) 95% efficiency must beset and, in addition, able theto provide duration of the constant voltage load current maintenance. to the CDI cell with 95% efficiency and, in addition, set the duration of voltage maintenance. The developed device must satisfy the requirement of an error tolerance of ± 0.01% The developed for voltage measurement device andmust satisfy an error the requirement tolerance of ± 0.1% for of an error current tolerance of ± 0.01% measurement. for voltage measurement and an error tolerance of ±0.1% for current measurement. 3.1. Proposed Test Results 3.1. Proposed Test provides This section Results the details of the tests carried out and the results obtained for the characterization of the CCD This section provides the system. details of the tests carried out and the results obtained for the characterization of the CCD system. 3.1.1. Calibration of the Equipment 3.1.1. Calibration of the Equipment To provide veracity and reliability to the results obtained during the tests, the CSP-CDI was first subjected to a series of calibration tests. The procedure that followed consisted in the fact that, knowing an input setpoint, the system returned a series of expected results since the output data were known, since a 1 Ω resistor was used instead of a CDI cell. Calibration of the Digital-to-Analog Converter DAC (MCP4725) The first test of the CSP-CDI was the calibration of the equipment by setting an input setpoint current to measure the voltage at the terminals of the 1 Ω resistor (see the results in Table 1). With this experience, the calibration line of the equipment is determined, obtaining the expression of the digital-analogical converter’s transformation of accounts.
Membranes 2021, 11, 773 7 of 50 Table 1. Calibration of the system in the digital-analog converter (MCP4725). Ic (mA) Measures (mA) −138.890 −142.1 −13.889 −10.6 −1.3889 2.1 0 3.9 Test 1 1.3889 5.6 13.889 18.7 138.890 151.5 −138.890 −143.1 −13.889 −10.5 −1.3889 2.4 0 3.6 Test 2 1.3889 5.3 13.889 18.6 138.890 151.4 −138.890 −142.9 −13.889 −10.5 −1.3889 2.3 0 3.7 Test 3 1.3889 5.4 13.889 18.6 138.890 151.4 As can be seen in the previous Figure 4, the slope of the straight line corresponds to the resistance of 1 Ω, and it can also be seen that the data dispersion is null, so the sample taken refers to the population and indicates that the CSP-CDI is characterized with the Equation (1): y = 1.0588 X + 3.9833 (1) where: X is the rated setpoint current in mA (milli-Amperes). Membranes 2021, 11, x Y isPEER FOR the REVIEW current at the load mA (milli-Amperes). 8 of 52 Finally, knowing the current, the voltage is trivial because the resistance is 1 Ω. Calibration line 200 y = 1.0588x + 3.9833 150 100 50 Calibration line Line (Calibration line) -100 -150 -200 Figurewith Figure 4. DAC calibration 4. DAC calibration the load with the load resistance. resistance. Calibration Calibration of the of the Analogical-Digital Analogical-Digital ConverterConverter (ADS1115) (ADS1115) This experimentThisisexperiment based onisconnecting based on connecting a 1 Ω (Ohms) a 1 Ω (Ohms) resistor resistor to to theload the load and and estab- es- lishing an input setpoint current to measure the voltage in the measuring cell. With this, tablishing an input setpoint current to measure the voltage in the measuring cell. With we know the current and current of the CSP-CDI (see Figures 5–8). With this experience, the calibration line of the equipment is determined, obtaining the expression of the trans- formation of accounts of the analogical-digital converter (table 2).
Membranes 2021, 11, 773 8 of 50 this, we know the current and current of the CSP-CDI (see Figures 5–8). With this experi- ence, the calibration line of the equipment is determined, obtaining the expression of the transformation of accounts of the analogical-digital converter (Table 2). 9 of 52 Membranes 2021, 11, x FOR PEER REVIEW Table 2. Calibration of the system in the analog-digital converter (ADS1115). Table 2. Calibration of the system in the analog-digital converter (ADS1115). V_Sensor I_Sensor V_Count_Measures I_Count_Measures Sample V_Sensor 0.860 I_Sensor 0.091 V_Count_Measures 6892 I_Count_Measures 735 Sample 0.860 0.816 0.091 0.757 6892 6527 735 6060 0.816 0.713 0.757 2.292 6527 5710 6060 18,365 0.713 0.698 2.292 2.515 5710 5591 18,365 20,152 0.698 2.515 5591 5578 20,152 20,354 Measure 1 0.696 2.541 Measure 1 0.696 0.695 2.541 2.563 5578 5565 20,354 20,535 0.680 0.695 2.784 2.563 5565 5450 20,535 22,302 0.597 0.680 4.020 2.784 5450 4785 22,302 32,260 0.597 0.860 4.020 0.090 4785 6889 32,260 730 0.860 0.814 0.090 0.760 6889 6524 730 6090 0.814 0.713 0.760 2.290 6524 5710 6090 18,346 0.713 0.698 2.290 2.515 5710 5592 18,346 20,142 0.698 2.515 5592 5578 20,142 20,358 Measure 2 0.696 2.542 Measure 2 0.696 0.695 2.542 2.565 5578 5565 20,358 20,542 0.695 0.680 2.565 2.783 5565 5450 20,542 22,290 0.680 0.597 2.783 4.020 5450 4785 22,290 32,261 0.597 4.020 4785 32,261 0.860 0.090 6887 730 0.860 0.814 0.090 0.761 6887 6524 730 6100 0.814 0.713 0.761 2.292 6524 5710 6100 18,362 0.713 0.698 2.292 2.515 5710 5592 18,362 20,145 0.698 2.515 5592 5577 20,145 20,366 Measure 3 0.696 2.543 Measure 3 0.696 0.695 2.543 2.565 5577 5567 20,366 20,546 0.695 0.680 2.565 2.783 5567 5450 20,546 22,290 0.680 0.597 2.783 4.020 5450 4786 22,290 32,260 0.597 4.020 4786 32,260 I_count_measures (ADC) 45000 40000 35000 30000 25000 20000 I_count_measures Line (I_count_measures) 5000 -0.2 -0.15 -0.1 -0.05 0 0.05 0.1 0.15 0.2 A (Amps) Figure 5.5.“I” Figure “I”counts measured counts at theatADC. measured the ADC.
Membranes 2021, 11, 773 9 of 50 Membranes 2021, 11, x FOR PEER REVIEW 10 of 52 Membranes 2021, 11, x FOR PEER REVIEW 10 of 52 y = 17.691x + 2.5387 5 y = 17.691x + 2.5387 5 3 I_Sensor 3 I_Sensor Line (I_Sensor) Line (I_Sensor) -0.2 -0.15 -0.1 -0.05 0 0.05 0.1 0.15 0.2 -0.2 -0.15 -0.1 -0.05 0 0.05 0.1 0.15 0.2 A (Amps) A (Amps) Figure 6. Intensity at the sensor. Figure 6. Intensity at the sensor. Figure 6. Intensity at the sensor. V_counts_measures (ADC) 8000 V_counts_measures (ADC) 8000 y = -9466.1x + 5577.9 7000 y = -9466.1x + 5577.9 7000 5000 5000 4000 V_count_measures 4000 3000 V_count_measures Line (V_count_measures) 3000 2000 Line (V_count_measures) 2000 1000 1000 -0.2 -0.15 -0.1 -0.05 0 0.05 0.1 0.15 0.2 -0.2 -0.15 -0.1 -0.05 0 0.05 0.1 0.15 0.2 A (Amps) A (Amps) Figure 7. “V” counts measured on the ADC. Membranes 2021, 11, x FOR PEER REVIEW 11 of 52 Figure 7. “V” counts measured on the ADC. Figure 7. “V” counts measured on the ADC. 1 0.9 0.8 y = -1.1824x + 0.6963 0.7 0.6 0.5 0.4 Line (V_sensor) 0.3 0.2 0.1 -0.2 -0.15 -0.1 -0.05 0 0.05 0.1 0.15 0.2 A (Amps) Figure 8. Voltage at the sensor. Figure 8. Voltage at the sensor. As can be seen in the previous figures, the data dispersion is null, so the sample taken refers to the population and indicates that the CSP-CDI is characterized, with Equation (2) being “I” of the measured ADC counts, while Equation (3) is the sensor current, Equation (4) is “V” of the measured ADC counts, and Equation (5) is the sensor voltage, as follows:
Membranes 2021, 11, 773 10 of 50 As can be seen in the previous figures, the data dispersion is null, so the sample taken refers to the population and indicates that the CSP-CDI is characterized, with Equation (2) being “I” of the measured ADC counts, while Equation (3) is the sensor current, Equation (4) is “V” of the measured ADC counts, and Equation (5) is the sensor voltage, as follows: y = 141704 X + 20340 (2) where: X is the rated set point current in A (Amps). Y are the counts corresponding to the current of the ADS1115. y = 17.691 X + 2.5387 (3) where: X is the rated setpoint current in A (Amperes). Y is the measured current in V (Volts) at the sensor. y = −9466.1 X + 5577.9 (4) where: X is the rated setpoint current in A (Amperes). Y are the counts corresponding to the voltage of the ADS1115. y = −1.1824 X + 0.6963 (5) where: X is the rated setpoint current in A (Amperes). Y is the measured voltage in V (Volts) at the sensor. 3.1.2. Charging and Self-Discharge Tests at an Input Set Point This section specifies the tests to which the equipment is subjected for its validation, where the degree of response from the equipment to an input setpoint will be determined, characterizing its behavior through the supercapacitors and the standardized tests. Three samples were taken in each test to avoid uncertainty and mean error. Further- more, the data obtained in the tests are representative of the CSP-CDI. The first characterization test performed was the charging and self-discharging of a 1 F capacity supercapacitor with a setpoint voltage of 2 V and a setpoint current of 0.1 A. The data generated were stored in a database. The data generated have been saved in a plain text file with “.txt” extension for further processing. A script was created with Matlab software for data management on the screen. In this way, a detailed analysis of each test carried out is carried out. The result of this first test can be seen in Figure 9. Figures 10–13 show that the test was carried out satisfactorily. Although, there is a small variation of 0.01 A in the current. This was due to an equipment calibration problem, hence the importance of having the CSP-CDI properly calibrated.
The data generated were stored in a database. The data generated have been saved in a plain text file with “.txt” extension for further processing. Membranes 2021, 11, 773 A script was created with Matlab software for data management on the screen. In 11 of 50 this way, a detailed analysis of each test carried out is carried out. The result of this first test can be seen in Figure 9. Voltage Intensity Membranes 2021, 11, x FOR PEER REVIEW 13 of 52 Figure9.9 Charging Figure Charging and and self-discharge self-discharge test test at at Vc_max Vc_max == 22 V V and and Ic Ic = = 0.1 0.1 A. A. Figures 10–13 show that the test was carried out satisfactorily. Although, there is a small variation of 0.01 A in the current. This was due to an equipment calibration problem, hence the importance of having the CSP-CDI properly calibrated. Figure10. Figure 10.Charge Chargeand andself-discharge self-dischargetest test(voltage–current): (voltage–current):Vc_max Vc_max==22VVand andIc Ic== 0.1 0.1 A. A. The following tests were at the same maximum set point voltage, but at the set point current of 0.05 A and 0.025 A, respectively. The following Figures 12 and 13 show the results of the tests per screen.
Figure 10. Charge and self-discharge test (voltage–current): Vc_max = 2 V and Ic = 0.1 A. Membranes 2021, 11, 773 The following tests were at the same maximum set point voltage,12but at the set p of 50 current of 0.05 A and 0.025 A, respectively. The following Figures 12 and 13 show results of the tests per screen. Membranes 2021, 11, x FOR PEER REVIEW 14 of 52 Figure Figure 11. Load and11. Load and self-discharge self-discharge test=at2 Vc_max test at Vc_max V and Ic==20.05 V and A. Ic = 0.05 A. Voltage Intensity Figure12. Figure 12.Charge Chargeand andself-discharge self-dischargetest testatatVc Vcmax max==22VVand andIcIc==0.025 0.025A. A. On the other hand, the system was validated with another supercapacitor, with a capacity of 650 F at another maximum voltage and setpoint current. The test results can be seen in the following figure. Voltage
Figure 12. Charge and self-discharge test at Vc max = 2 V and Ic = 0.025 A. Membranes 2021, 11, 773 On the other hand, the system was validated with another supercapacitor, 13with of 50 a capacity of 650 F at another maximum voltage and setpoint current. The test results can be seen in the following figure. Voltage Intensity Figure13. Figure 13.Test Testwith witha a650 650FFsupercapacitor. supercapacitor. The following tests were at the same maximum set point voltage, but at the set point current of 0.05 A and 0.025 A, respectively. The following Figures 12 and 13 show the results of the tests per screen. On the other hand, the system was validated with another supercapacitor, with a capacity of 650 F at another maximum voltage and setpoint current. The test results can be seen in the following figure. Firstly, as can be seen in Figure 14, the test was carried out at the set voltage of 0.4 V and set current of 0.1 A. This test lasted 1 h. It should be noted that the results are as expected for a supercapacitor with these characteristics, the reason being that the setpoint current is very small and the capacity of the supercapacitor is too large. On the other hand, quality results have been obtained without the adverse effects of noise. This was possible because the design of the CSP-CDI foresaw the need to have a noise-free reading of the data when characterizing. For this reason, the use of the analogical- to-digital converter (ADS1115) is fundamental to the system. This converter has a series of input and output filters that result in accurate and noise-free data. Finally, the self-discharge of CDI for 1 F, 100 F and 150 F supercapacitors has been analyzed and characterized (Figures 11–14). The results shown are satisfactory and, with this, the characterization system is again validated. As can be seen in Figures 15 and 16, there are anomalies at the beginning of the charge and self-discharge. It has been deduced from the results obtained that an equivalent series resistance coexists due to the poor connection of the supercapacitor with the system terminals, resulting in a series resistance of 56 Ω. This can be seen in more detail in Figure 17.
noise. This was possible because the design of the CSP-CDI foresaw the need to have a noise-free reading of the data when characterizing. For this reason, the use of the analog- ical-to-digital converter (ADS1115) is fundamental to the system. This converter has a se- ries of input and output filters that result in accurate and noise-free data. Membranes 2021, 11, 773 Finally, the self-discharge of CDI for 1 F, 100 F and 150 F supercapacitors has been 14 of 50 analyzed and characterized (Figures 11–14). The results shown are satisfactory and, with this, the characterization system is again validated. Voltage Intensity Membranes 2021, 11, x FOR PEER REVIEW 16 of 52 Figure14. Figure 14.Self-discharge Self-dischargetest testtotocharacterize characterizea a1 1F Fcapacitor. capacitor. As can be seen in Figures 15 and 16, there are anomalies at the beginning of the charge and self-discharge. It has been deduced from the results obtained that an equivalent series resistance coexists due to the poor connection of the supercapacitor with the system ter- minals, resulting in a series resistance of 56 Ω. This can be seen in more detail in Figure 17. Figure15. Figure 15.Self-discharge Self-dischargeanalysis analysischaracterizing characterizingaa100 100FFcapacitor. capacitor. Voltage Intensity
Membranes 2021, 11, 773 15 of 50 Figure 15. Self-discharge analysis characterizing a 100 F capacitor. Voltage Intensity Membranes 2021, 11, x FOR PEER REVIEW 17 of 52 Figure16. Figure 16.Charge Chargeand andself-discharge self-dischargetest testtotocharacterize characterizeaa150 150FFcapacitor. capacitor. Figure 17. Graphs with details of the charge and self-discharge test, characterizing it on a 150 F Figure 17. Graphs with details of the charge and self-discharge test, characterizing it on a 150 F capacitor. capacitor. 3.1.3. CDI Charging and Discharging Test In this section, the system will be validated based on the standardized tests for su- percapacitors. For the first charge and discharge characterization test of the CSP-CDI, the initial data have been programmed via the interface created with processing. The follow-
Membranes 2021, 11, 773 16 of 50 3.1.3. CDI Charging and Discharging Test In this section, the system will be validated based on the standardized tests for supercapacitors. For the first charge and discharge characterization test of the CSP-CDI, the initial data have been programmed via the interface created with processing. The following table (Table 3) shows the data given to the interface. Table 3. Data initially programmed in the processing interface. Time 1 0.3 Minutes Time 2 45 Seconds Time 3 0.25 Hours Time 4 45 Seconds Time 5 0.25 Hours Ic 01 A (Amperes) Vcmax 1.8 V (Volts) Capacitor capacity 1 F (Farads) Once the data have been entered on the screen, the test is started. Once the test has Membranes 2021, 11, x FOR PEER REVIEW been completedand the data obtained have been managed, the result is shown on 18 the of 52 screen (Figure 18). Voltage Intensidad Figure18. Figure 18.Charge Chargeand anddischarge dischargetest testatatVcmax Vcmax==1.8 1.8VVand andIcon Icon==0.1 0.1A. A. Firstly,the Firstly, thetest testisissatisfactory. satisfactory.Figure Figure19 19shows showseach eachof ofthe thetimes timesthat thatmake makeup upthe the experiment,which experiment, whichare: are:time timeone, one,time timetwo, two,time timethree, three,time timefour fourand andtime timefive. five.
Figure 18. Charge and discharge test at Vcmax = 1.8 V and Icon = 0.1 A. Membranes 2021, 11, 773 17 of 50 Firstly, the test is satisfactory. Figure 19 shows each of the times that make up the experiment, which are: time one, time two, time three, time four and time five. Figure19. Figure 19.Detailed Detailedgraphs graphsfor forthe theloading loadingand andunloading unloadingtest testatatVcmax Vcmax==1.8 1.8VVand andIcon Icon==0.1 0.1A. A. Secondly, the test responds to the initially programmed times and the input setpoints (Vcmax and Icons). Finally, the cleanliness of the data obtained should be highlighted, as the noise phe- nomenon in the result is negligible. This has been possible with the analogical-digital converter (ADS1115), which inhibits the noise generated by the instrumentation elements of the system. On the other hand, another test has been carried out with different initial conditions to those described above, to validate the CSP-CDI system. The data entered by the interface are shown in Table 4. Table 4. Data programmed for the second loading and unloading test. Time 1 0.3 Minutes Time 2 45 Seconds Time 3 0.1 Hours Time 4 45 Seconds Time 5 0.1 Hours Ic 0.1 A (Amperes) Vcmax 2 V (Volts) Capacitor capacity 1 F (Farads) The results per screen can be seen in Figure 20. In Figure 20, it can be seen in time interval five that the capacitor self-charges once this period starts. The cause is the inertia of the capacitor in maintaining an equilibrium state, even though the attack current in the CSP-CDI system is 0A. Finally, a new charge/discharge test is carried out with a supercapacitor of capacity 1 F (Farad), with different initial conditions to those previously described. The data initially programmed by the interface are shown in the following Table 5.
Ic 0.1 A (Amperes) Vcmax 2 V (Volts) Capacitor capacity 1 F (Farads) Membranes 2021, 11, 773 The results per screen can be seen in Figure 20. 18 of 50 Figure 20. Charge and discharge test for the 1 F supercapacitor with other input setpoints. Membranes 2021, 11, x FOR PEERFigure REVIEW 20. Charge and discharge test for the 1 F supercapacitor with other input 20 of 52 setpoints. Table 5. Data programmed to characterize the CSP-CDI system. In Figure 20, it can be seen in time interval five that the capacitor self-charges once Table 5. Data programmed Time 1 to characterize the CSP-CDI system. 1 this period starts. The cause is the inertia of the capacitor in maintainingMinutes an equilibrium Time 1 2the attack current1 in the CSP-CDI 45 Seconds state, even though Time Time system is Minutes 0A. 2 3 0.025 Hours Finally,Time a Time new 45 4charge/discharge test is carried 45 out Seconds with a supercapacitor Secondsof capacity Time 3 0.025 Hours 1 F (Farad),Time Timedifferent with 5 initial conditions 0.025 to those previously described.Hours The data ini- 4 45 Seconds Ic 0.1 A (Amperes) tially programmed Time 5 Vcmax by the interface are 0.025 shown 1 in the following Hours Table 5. V (Volts) Ic Capacitor capacity 0.1 1 A (Amperes) F (Farads) Vcmax 1 V (Volts) Capacitor capacity 1 F (Farads) The following Figures 21 and 22 show the results of the test per screen. The following Figures 21 and 22 show the results of the test per screen. Voltage Intensity Figure Charging 21. 21 Figure Chargingand and discharging test discharging test characterizing characterizing a 1 F supercapacitor. a 1 F supercapacitor.
Membranes 2021, 11, 773 19 of 50 Membranes 2021, 11, x FOR PEER REVIEW 21 of 52 Figure Figure 22. 22. Charge Charge and and discharge discharge test at Vcmax == 11 V V and and Icon Icon ==0.1 0.1A. A. 4. Conclusions 4. Conclusions The conclusions The conclusions obtained obtained in in the the development development of of this this study study are are as as follows: follows: 1. 1. AAprototype prototypehashasbeen been designed designed that that can can operate operate with with constant constant current current charging charging and and discharging. discharging. 2. 2. Adequateprecision Adequate precisionhas hasbeen beenachieved, achieved, as as can can be be seen seen in in the the results results obtained. obtained. 3. 3. A philosophy of using free software with open-source code has been A philosophy of using free software with open-source code has been followed, followed, such as such the microcontroller ATmega328 (Arduino platform) and Processing programming as the microcontroller ATmega328 (Arduino platform) and Processing programming ed- itors, asas editors, well asas well the analogical-digital the converter analogical-digital converter(ADS1015) (ADS1015) and thethe and digital-analogical digital-analog- converter (MCP4725). ical converter (MCP4725). 4. A low-cost system has been developed. 4. A low-cost system has been developed. 5. A robust and versatile system has been designed for water treatment. 5. A robust and versatile system has been designed for water treatment. 6. A flexible system has been obtained for the specifications established. 6. A flexible system has been obtained for the specifications established. Contributions: Conceptualization, Author Contributions: Author F.A.L., Conceptualization, F.L., A.R.A.R.-M. andmethodology, and D.S.; D.S.; methodology, F.L. andF.A.L. and A.R.; soft- A.R.-M.; software, A.R.-M. and D.S.; validation, F.A.L., A.R.-M. and D.S.; formal analysis, ware, A.R. and D.S.; validation, F.L., A.R. and D.S.; formal analysis, F.L..; investigation, A.R.; re-F.A.L.; investigation, sources, A.R.-M.; F.L.; data resources, curation, F.A.L.; data curation, A.R.; writing—original A.R.-M.; draft writing—original preparation, draft preparation, F.L.; writing—review and ed- F.A.L.; writing—review and editing, A.R.-M.; visualization, F.A.L.; supervision, A.R.-M.; project ad- iting, A.R.; visualization, F.L.; supervision, A.R.; project administration, F.L.; funding acquisition, ministration, A.R. F.A.L.; All authors have funding acquisition, read and agreed toA.R.-M. All authors the published have version of read and agreed to the published the manuscript. version of the manuscript. Funding: This research was co-funded by the INTERREG V-A Cooperation, Spain-Portugal MAC Funding: This research was2014-2020 (Madeira-Azores-Canarias) co-fundedprogram by the INTERREG V-A Cooperation, and the MITIMAC Spain-Portugal MAC project (MAC2/1.1a/263). (Madeira-Azores-Canarias) 2014-2020 program and the MITIMAC project (MAC2/1.1a/263). Conflicts of Interest: The authors declare no conflict of interest. Conflicts of Interest: The authors declare no conflict of interest.
Membranes 2021, 11, 773 20 of 50 Appendix A. Microcontroller Source Code (ATmega328) /********************************************************************************************* ******* CSP_MCDI ATmega328 source code Title: Design and implementation of an electrical characterization system for mem- brane capacitive deionization units for water treatment. Authors: Federico Leon, Alejandro Ramos-Martin and David Santana-Quintana. ********************************************************************************************** ******/ // V2-2021/07/07 #include #include #include #include // Configuracion nombres del sistema ADS y DAC Adafruit_ADS1115 ads; //Adafruit_MCP4725 dac; Adafruit_MCP4725 dac1; // Configuración de los reles para conseguir sistemas aislados const int Rele1 = 2;//Rele de control 1. const int Rele2 = 3;//Rele de control 2. int16_t a; int16_t b; int c = 0; // Consigna para los ensayos /************************************************************************************ * Inicialización de variables ************************************************************************************/ unsigned long inicio=0;//Variable de entrada que fuerza la puesta en marcha y parada del ensayo. // 0 -> En espera o parado. // 1 -> Cargar con consigna de tension maxima. // 2 -> Cargar con consigna de carga electrica. // 3 -> forzar descarga con resistencia externa. // 4 -> carga y descarga. // 5 -> conductimetro. unsigned long tiempo_1=0;//Tiempo de precarga. unsigned long tiempo_2=0;//Tiempo de carga, cuando se establezca la referencia de carga eléctrica (inicio=2). unsigned long tiempo_3=0;//Tiempo de estado de auto-descarga o tiempo de man- tenimiento de la tensión unsigned long tiempo_4=0;//Tiempo de estado de descarga. unsigned long tiempo_5=0;//Tiempo de estado de auto-descarga.
Membranes 2021, 11, 773 21 of 50 uint16_t Vcmax=0;//Consigna de tensión máxima de carga, siempre se aplicará por seguridad. int estado=1;//Variable de salida que indica en que modo de operación se encuentra la celda de CDI // 0 -> En espera o stop, pero enviando datos. // 1 -> En estado de precarga, durante tiempo_1. // 2 -> En estado de carga, hasta que se complete el tiempo_2 o se alcance la tensión Vcmax para evitar la // electrolisis // 3 -> En estado de auto-descarga. // 4 -> Finalizado el ensayo. unsigned long control_tiempos=0;//Variable de control de tiempos en cada estado. /* RESOLUCIONES del MCP4725 * Tensiones del Arduino: * 0 V > 2.5 V ——>> Tensiones positivas 0–2048 bit para MCP4725 * 2.5 V > 5 V ——>> Tensiones negativas 2048–4095 bit para MCP4725 */ //Expresión de cálculo; NOTA: Vx4=Gain*(Vx2-Vard)+Voffset; Gain=1;Voffset=0; /* * Vx4=(Vx2-Vard) */ /********************************************************************* * Ventrada[−2.5;2.5]V // Valores de entrada al OPA548 ********************************************************************/ uint16_t Vcuenta1=0;//Vopa —->[X4=2.5 V] uint16_t Vcuenta2=2048;//Vopa —->[X4=0 V] uint16_t Icons=2048;//Consigna establecida de corriente de carga-descarga. // Iconns es un valor inicial que luego se refresca int16_t results; int16_t results1; /************************************************************************************ * Configuración del puerto serial y del timerone ************************************************************************************/ void setup() { Serial.begin(9600); pinMode(Rele1, OUTPUT); pinMode(Rele2, OUTPUT); digitalWrite(Rele1, HIGH);//HIGH–> NC en el relé 1 digitalWrite(Rele2, HIGH);//HIGH–> CDI descargada (NC en el relé 2) Timer1.initialize(100000);// Configuración del timerONE Timer1.attachInterrupt(intu);// Asignación de la subrutina a la interrupción del timerONE dac1.begin(0 × 62); //Control de la corriente. Direccionamiento del conversor ADC //dac.begin(0 × 63); //Control de la tensión. Direccionamiento del conversor ADC ads.begin(); //Inicia el ADS1115. ads.setGain(GAIN_ONE); // 1× gain +/− 4.096 V 1 bit = 2 mV 0.125 mV // Establecimiento de la ganancia del ADC
Membranes 2021, 11, 773 22 of 50 /* * Ventrada[2,5;−2,5] –> Rcerámica=18 ohm * I_carga_max=2.5/18=138,9 mA * Icarga maxima=138.9 mA –> {Icons=0} * Icarga mínima=−138.9 mA -> {Icons=4095} */ /************************************************************************************ * Configuración de los DAC y los relés ************************************************************************************/ dac1.setVoltage(2048, false);//Inicializado a 0A. digitalWrite(Rele1, HIGH);//Rele NC digitalWrite(Rele2, HIGH);//Rele NC /* * El OPA esta como un seguidor de tensión y la CDI está a tierra */ } //interructión a los 1 micros void intu() { Serial.print(a); Serial.print(“,”); Serial.print(b); Serial.print(“,”); Serial.print(Icons); Serial.print(“,”); Serial.print(Vcmax); Serial.print(“,”); Serial.println(estado); // Serial.print(“,”); // Serial.println(inicio); control_tiempos=control_tiempos+1; } /*********************************************************************************************** * Se realizan los ensayos ***********************************************************************************************/ void loop(void) { Timer1.detachInterrupt();//Se deshabilita la interrupcion de envio de datos switch (inicio){ //Tiempo a 0 sg case 0: //Estado de espera o parada. digitalWrite(Rele1, HIGH);//Relé NC. digitalWrite(Rele2, HIGH);//Relé NC. results1 = ads.readADC_Differential_0_1(); results = ads.readADC_Differential_2_3(); a = results1; b = results; control_tiempos=0; Timer1.attachInterrupt(intu); //Se habilita la interrupción de envio de datos. break;
Membranes 2021, 11, 773 23 of 50 /***************************************************************************************** * RESOLUCIONES del MCP4725 * Vard= 5 V − 2.5 V ——>> Tensiones positivas 4095–2048 bit para MCP4725 * Vard= 2.5 V − 0 V ——>> Tensiones negativas 2048–0 bit para MCP4725 ******************************************************************************************/ case 1: //Carga con consigna de tensión máxima. switch (estado){ case 1: //Forzar estado de precarga. digitalWrite(Rele1, HIGH);//Rele abierto (NC) digitalWrite(Rele2, HIGH);//Rele cabierto (NC) //Tensión //dac.setVoltage(4095, false);//Tensión en el OPA, X4= −2.5 V. //Corriente // Se le asigna un ‘0’ al OPA dac1.setVoltage(2048, false);//Corriente en el OPA, X4= 0 A. results1 = ads.readADC_Differential_0_1(); results = ads.readADC_Differential_2_3(); a = results1; b = results; if(control_tiempos>=tiempo_1){ estado=2; control_tiempos=0; } Timer1.attachInterrupt(intu); //Se habilita la interrupción de envio de datos. break; case 2: //Forzar estado de carga sólo con límite de tensión. // Estado de carga, hasta que se complete el tiempo_2 o se alcance la // tensión máxima digitalWrite(Rele1, LOW);//Relé abierto (NA). digitalWrite(Rele2, LOW);//Relé abierto (NA). // dac1.setVoltage(Icons, false);//Falta asignar la corriente. // //dac.setVoltage(Vcuenta1, false);//Falta asignar la tensión. results1 = ads.readADC_Differential_0_1(); results = ads.readADC_Differential_2_3(); a = results1; b = results; // Valor máximo de tensión 1,2 V o 1 V para evitar la electrolisis de la CDI if (a > Vcmax) { estado=3;//Estado de auto-descarga control_tiempos=0; digitalWrite(Rele1, HIGH);//Relé NC. digitalWrite(Rele2, HIGH);//Relé NC. // Corriente dac1.setVoltage(2048, false);//corriente en el OPA, X4= OA. Se le // asigna un ‘0’ al OPA
Membranes 2021, 11, 773 24 of 50 // Tensión //dac.setVoltage(4095, false);//Tensión en el OPA, X4= −2,5 V. } Timer1.attachInterrupt(intu); //Se habilita la interrupción de envio de datos. break; case 3://Forzar estado de auto-descarga. results1 = ads.readADC_Differential_0_1(); results = ads.readADC_Differential_2_3(); a = results1; b = results; if(control_tiempos>=tiempo_3){ //Tiempo_3–> Tiempo de estado de auto-descarga estado=4;//Ensayo finalizado inicio=0; control_tiempos=0; } Timer1.attachInterrupt(intu); //Se habilita la interrupción de envio de datos. break; } //Fin del switch (estado) break; case 2://Carga con consigna de carga eléctrica. switch (estado){ case 1: //Forzar estado de precarga. digitalWrite(Rele1, HIGH);//Rele NC. digitalWrite(Rele2, HIGH);//Rele NC. // //dac.setVoltage(4095, false);//Aproximadamente en el OPA, X4= −2.5 V. // dac1.setVoltage(2048, false);//Aproximadamente en el OPA, X4= 0 A. results1 = ads.readADC_Differential_0_1(); results = ads.readADC_Differential_2_3(); a = results1; b = results; if(control_tiempos>=tiempo_1){ estado=2; control_tiempos=0; } Timer1.attachInterrupt(intu); //Se habilita la interrupción de envio de datos. break; case 2://Forzar estado de carga con limite de tiempo 2.
You can also read