Academia.eduAcademia.edu

Solar Power Storage using Hydrogen: an e-lab experiment

2015, Thesis to obtain the Master of Science Degree in Engineering Physics

https://doi.org/10.13140/RG.2.2.19019.54566

The work done in this thesis aims to automate an experimental setup which mimics the acquisition of solar power, converts it into hydrogen and later use of the hydrogen to generate electric power. The generation and conversion of the Hydrogen was done using proton exchange membrane (PEM) cells. The automation of the setup was done through control and data acquisition routines. Some parallel testing was done regarding hydrogen generation through PEM water electrolysis, under a pulsed DC regime, varying the frequency and the shape of the signal. In none of the tests has the electrolyser’s efficiency been higher than that at constant DC conditions.

Solar Power Storage using Hydrogen: an e-lab experiment Miguel Pacheco de Carvalho da Silva Batista Thesis to obtain the Master of Science Degree in Engineering Physics Supervisors: Prof. Horácio João Matos Fernandes Dr. Rui Pedro Costa Neto Examination committee Chairperson: Prof. Luís Filipe Moreira Mendes Supervisor: Prof. Horácio João Matos Fernandes Member of the comittee: Prof. Carlos Augusto Santos Silva May 2015 i ii Acknowledgments During the course of the work that led to this thesis I was offered help and valuable advice for the tasks that I faced. I would like to thank Professor Horácio Fernandes for having given me the opportunity to work with a technology that had always been of great interest to me, for his availability as well as for the numerous insightful comments. I would like to thank Professor Rui Neto for the amounts of knowledge and excitement he transmitted and for the availability to form a bridge between my background and the Hydrogen related technologies. I would like to thank Rui Dias for the valuable help while constructing the printed circuit boards and overall help throughout the entire work. I would like to thank Ivo and Tiago for the help, company and precious comments during all of the stages of this thesis. I would also like to thank my family for the support ever since I entered IST. Finally, I would like to thank Maria for having listened to a subject she had very little interest on without ever complaining and for the invaluable support she offered. iii Resumo Palavras-Chave: PEM; Célula de Combustível; Electrolisador; DC pulsado; Hidrogénio; armazenamento. O trabalho realizado pretende automatizar e controlar uma montagem experimental que simule a aquisição de energia solar, a sua conversão para hidrogénio através de electrólise da água e posterior utilização do hidrogénio para gerar energia eléctrica. A geração e conversão de Hidrogénio foram feitas usando células de membrana de troca de protão (PEM). A automatização da montagem implicou a criação de rotinas de controlo e de aquisição de dados, realizadas através de microcontroladores. Paralelamente foram realizados ensaios com fornecimento pulsado de corrente a electrolisadores PEM, fazendo variar a frequência e a forma do sinal. Em nenhum dos ensaios foi verificado que a eficiência tivesse sido superior à do caso em que o fornecimento é constante. iv Abstract Keywords: PEM; Fuel Cell; Electrolyser; Pulsed DC; Hydrogen; storage. The work done in this thesis aims to automate an experimental setup which mimics the acquisition of solar power, converts it into hydrogen and later use of the hydrogen to generate electric power. The generation and conversion of the Hydrogen was done using proton exchange membrane (PEM) cells. The automation of the setup was done through control and data acquisition routines. Some parallel testing was done regarding hydrogen generation through PEM water electrolysis, under a pulsed DC regime, varying the frequency and the shape of the signal. In none of the tests has the electrolyser’s efficiency been higher than that at constant DC conditions. v Abbreviations AC Alternate Current BJT Bipolar Junction Transistor DC Direct Current DTD Document Type Definition ESR Equivalent Series Resistance HHV Higher Heating Value LHV Lower Heating Value FET Field Effect Transistor GUI Graphical User Interface JVM Java Virtual Machine LED Light emitting diode MEA Membrane Electrode Assembly NTP Normal Temperature and Pressure PCB Printed Circuit Board PEM Proton Exchange Membrane or Polymer electrolyte membrane PV Photovoltaic PID Proportional-Integral Derivative RMS Root Mean Square ReC Remote Experienced Control SPR Special Production Regime IC Integrated Circuit XML eXtensible Markup Language vi Contents Acknowledgments ........................................................................................... iii Resumo .......................................................................................................... iv Abstract ............................................................................................................ v Abbreviations .................................................................................................. vi List of figures.................................................................................................. viii Chapter 1 ......................................................................................................... 1 Introduction................................................................................................... 1 1.1 Experiment ............................................................................................. 5 1.2 e-lab ....................................................................................................... 6 1.3 State-of-the-art ....................................................................................... 8 1.3.1 Hydrogen Storage for Intermittent Power Sources .............................. 8 1.3.2 Remote Controlled Laboratories .......................................................... 8 1.3.3 Energy Storage Experiments ............................................................... 9 1.4 Outline .................................................................................................. 11 Chapter 2 ....................................................................................................... 12 Experimental setup ..................................................................................... 12 2.1 LED and PV panels .............................................................................. 12 2.2 PEM Electrolyser .................................................................................. 14 2.3 Storage, valves and volume measurement .......................................... 21 2.4 PEM Fuel Cell ...................................................................................... 24 Chapter 3 ....................................................................................................... 35 Electronics and Control .............................................................................. 35 3.1 LED panel regulation ............................................................................ 35 3.2 Buck Converter – PV panel output ....................................................... 37 3.3 PEM Fuel Cell Power converter ........................................................... 48 3.4 Data acquisition and Control ................................................................ 51 Chapter 4 ....................................................................................................... 54 e-lab ........................................................................................................... 54 4.1 Technology ........................................................................................... 54 4.2 Protocols .............................................................................................. 55 4.3 User Interaction .................................................................................... 58 Chapter 5 ....................................................................................................... 60 Study on the performance of pulsed electrolysis ........................................ 60 5.1 Background .......................................................................................... 60 5.2 Apparatus and measurements ............................................................. 65 5.3 Discussion ............................................................................................ 74 Chapter 6 ....................................................................................................... 78 Conclusions ................................................................................................ 78 References..................................................................................................... 80 Appendices .................................................................................................... 83 A1. Program used in the Pulsed electrolysis tests ...................................... 83 A2. Functions used in the e-lab experiment ............................................... 91 A3. PCB layouts ......................................................................................... 97 vii List of figures Fig. 1 Energy consumption and generation on 26/02/14. ................................. 1 Fig. 2 Special production regime detailed. ....................................................... 2 Fig. 3 Pricing in the Iberian market. ................................................................. 3 Fig. 4 Scheme of the experiment. .................................................................... 4 Fig. 5 Experimental apparatus schematic. ....................................................... 6 Fig. 6 Structure of the power system. ............................................................ 10 Fig. 7 Structure of the control routines. .......................................................... 11 Fig. 8 Experimental Setup. ............................................................................. 12 Fig. 9 Short Circuit current vs Duty cycle . ..................................................... 13 Fig. 10 Voltage applied to a load vs Duty cycle.............................................. 13 Fig. 11 PEM electrolyser. ............................................................................... 14 Fig. 12 I-V characteristic of a typical PEM electrolyser .................................. 16 Fig. 13 Double layer (source: wikipedia) ........................................................ 17 Fig. 14 Plot of current vs voltage for the electrolyser ..................................... 20 Fig. 15 Efficiency of the electrolyser .............................................................. 20 Fig. 16 Scheme of the containers .................................................................. 21 Fig. 17 Astable circuit (taken from the ne555 data sheet) .............................. 22 Fig. 18 Volume/counts calibration (hydrogen) ................................................ 23 Fig. 19 Volume/counts calibration (oxygen) ................................................... 23 Fig. 20 Schematic of a fuel cell operation ...................................................... 24 Fig. 21 Thermodynamics of Fuel Cells; chapter 2 Springer ........................... 26 Fig. 22 Plots of the Voltage, Resistance, Current and Power ........................ 31 Fig. 23 Voltage/Current curve of the stack ..................................................... 32 Fig. 24 Power/Current curve .......................................................................... 32 Fig. 25 Power / Current curve from the manufacturer’s technical sheet ......... 33 Fig. 26 Typical emissivity / current characteristic of a LED ............................ 35 Fig. 27 Full wave rectifier schematic .............................................................. 36 Fig. 28 Schematic of the step-down converter ............................................... 37 Fig. 29 Waveforms in the various components of the circuit .......................... 39 Fig. 30 Variation of the power transfer and efficiency (source: wikipedia) ..... 40 Fig. 31 RdsON / Id / Vgs ................................................................................ 42 viii Fig. 32 Switching losses ................................................................................ 43 Fig. 33 Schematic of the gate driver and power level shifter.......................... 44 Fig. 34 Structure of the power system ........................................................... 44 Fig. 35 Rds/Junction temperature .................................................................. 58 Fig. 36 Conductivity/Case temperature .......................................................... 47 Fig. 37 Schematic of the buck converter ........................................................ 47 Fig. 38 Transient response ............................................................................ 48 Fig. 39 Schematic of the converter ................................................................ 48 Fig. 40 Waveforms associated with the conducting components ................... 49 Fig. 41 Ground bounce .................................................................................. 50 Fig. 42 Bode plots of the filter ........................................................................ 51 Fig. 43 Schematic of the filter, with variable gain ........................................... 52 Fig. 44 Diagram of the structure of e-lab ........................................................ 55 Fig. 45 State-machine diagram of the driver .................................................. 56 Fig. 46 Diagram of the states of the experiment ............................................ 58 Fig. 47 Frame of the experiment’s animation ................................................. 59 Fig. 48 a) Dielectric constant/distance b) potential/distance .......................... 61 Fig. 49 Current transient ................................................................................ 62 Fig. 50 Waveforms for Fpulse=25 kHz, DC=0.80. Toff=32us ......................... 63 Fig. 51 Power demand vs Pulse frequency .................................................... 63 Fig. 52 Power vs Efficiency ............................................................................ 64 Fig. 53 Waveforms for the current and voltage of the applied signal ............. 64 Fig. 54 Variation of current across the electrodes vs frequency..................... 65 Fig. 55 Schematic of the Switched step down converter and gate driver circuit ....................................................................................................................... 65 Fig. 56 Second order Sallen-Key Low Pass filter, with gain ........................... 66 Fig. 57 Red:Load Current; Green: Load Voltage; Purple: Cout current; DC=0.8 ....................................................................................................................... 67 Fig. 58 Duty cycle vs Current ......................................................................... 69 Fig. 59 Duty cycle vs Voltage ......................................................................... 69 Fig. 60 Current-Voltage Characteristic ........................................................... 69 Fig. 61 Volume vs Time ................................................................................. 70 Fig. 62 DC Flow ............................................................................................. 70 Fig. 63 Electrolyser’s efficiency ...................................................................... 71 Fig. 64 Flow response to various frequencies ................................................ 72 ix Fig. 65 Fitted surface of the data for V=4 volt ................................................ 73 Fig. 66 Flux vs Duty Cycle profile of the experimental data ........................... 73 Fig. 67 Sample taken from a saw tooth test ................................................... 74 Fig. 68 Schematic of the circuit when the load is purely resistive .................. 75 Fig. 69 Waveforms of the previous circuit (purple=current)............................ 75 Fig. 70 Current transient at Fsw = 2.5 kHz..................................................... 75 Fig. 71 Current transient at Fsw = 900 kHz.................................................... 76 Fig. 72 Schematic using an ohmic load with a capacitive component............ 76 Fig. 73 Corresponding waveforms ................................................................. 76 x Chapter 1 Introduction The ability to store electric energy is one of the most important aspects in electricity markets today. Like other markets, supply and demand principles are used to set the cost of energy during each hour of the day. Because the demand for electricity follows the consumers’ needs, predictable patterns are formed and estimates of the amount of energy required can be made. Of the various energy sources commercialized, one can make a distinction based on the fact that some are very dependent on external factors to produce energy and others are not. Fig. 1 Energy consumption and generation on 26/02/14. (1) As can be seen in Fig. 1, there are discrepancies between the energy produced and the energy consumed. In particular, it is often that electricity is imported to meet the demand. Following these lines of thought, one can deduce that the best energy source to have its power stored would be one which is not easily controllable by the producers and at the same time has smaller operating costs. Energy producers operating under the special production regime (SPR) often share these features. 1 Fig. 2 Special production regime detailed. [1] In Fig. 2, it can be seen in greater detail the production of various kinds of energy source. For the purpose of this work, a greater focus will be given to the wind power plants and to photovoltaic (PV) power plants. One can see that for both these sources, there is a great variation of the output power, along the day. The energy produced by all the suppliers in Portugal and Spain is commercialized on the MIBEL, which is the energy spot market – a market that trades goods which are to be delivered immediately. 2 Fig. 3 Pricing in the Iberian market (Continental time zone) in 26/02/14. (2) The plot in Fig. 3 shows the energy price for Portugal and Spain during the same day. The most noticeable occurrence in the energy market is the great difference between the off-peak hours (02:00 – 06:00) and the remaining, which peak at around the 22 nd hour. In this difference lies the opportunity for energy storage. By using a buffer able to transport the less valuable energy of certain hours and sell it at a higher price, the power supply better fits the demand and should overtime provide profit. Various energy storage methods exist. The main methods can be divided by their capacity:  Large-scale energy storage (GW): reversible hydro (pumped storage), thermal storage.  Storage in grids (MW): batteries; capacitors and superconducting coils; flywheels.  At an end user level (kW): batteries, superconducting coils (…).(2) 3 The work in this thesis intends to build a small system, from energy source to consumer application, using hydrogen to buffer energy for a given time period. Although there are various kinds of power storage systems, electricity still has to be imported at peak hours, so the opportunity to use alternatives is present. Fig. 4 Scheme of the experiment. In Fig. 4, its depicted an idealization of the power system, able to provide electricity to the grid only when required. The main reason why these systems are not functioning is because the marginal costs of producing energy are still too high. Even the most efficient branches of the hydrogen technologies are still waiting on scientific advances, tied mainly with the high costs associated with the materials used and their short lifetime. Until the overall robustness of these systems increases, these applications will be mainly prototypical and not meant for real world use. 4 1.1 Experiment To illustrate the principles behind energy storage using hydrogen, a small scale experiment was developed. In order to deal with time varying energetic needs, the experimental setup is able to: generate a variable luminous stimulus; convert said stimulus to electric power; produce and store hydrogen; use the hydrogen to power a load able to produce visible work, such as operating a small electric engine. As seen in Fig. 2, of the main energy sources, solar power is the one that displays a behavior which varies the most in time – it only produces energy when it’s exposed to the sun. Because of this, it seems adequate to simulate the sun and the PV system used in electric grids. In addition, the experiment’s main purpose is to function in e-lab, so the scaling down the power supply, while maintaining the experiment easily visible to the user is very important. The apparatus can be divided in the following sections: • LED Panel and PV panel – this portion of the experiment is the only one that had to be scaled down. To produce even very small amounts of hydrogen as the ones in the experiment, the PV panel would have to be much larger and the light source would also had to be much more powerful. Because this would not add significant value to the experiment, an external power source was used. The output power of the source was regulated in order to mimic the response of the PV panel to the light emitted by the LEDs. • PEM Electrolyser – this device is used to perform water electrolysis. Given sufficient power – electric and thermal – it is able to break the electronic bounds in water molecules and so, separate them into oxygen and hydrogen. • Storage – once water electrolysis has taken place, both gases are stored in airtight reservoirs, able to store a small amount of hydrogen and oxygen. Once the user wishes to release the hydrogen, an electro-valve is opened and the water is forced to exit because of the pressure of the water present in the column (as can be seen in Fig. 5). •PEM Fuel Cell and load – from the moment when the valves are opened, hydrogen is free to enter the PEM fuel cell and start producing electric power. The main idea behind this device is to separate the hydrogen atoms in electrons and protons. As the protons travel through the polymer membrane, electrons are forced to exit the anode, perform work on the load and return through the cathode. • Control and electronics – to interface the user and the entire ensemble, a microcontroller was used. It performs data acquisition and control of the assisting electronics, as well as the communications with the e-lab platform. 5 Fig. 5 Experimental apparatus schematic. In chapter 2, these devices are explained in greater detail. 1.2 e-lab E-lab is a remote controlled laboratory which enables the control and acquisition of data from various physical experiments. The interaction between a user and the platform that controls the experiment is done using the Internet and typically shares the following structure: Choice of what experiment to select; Selection of the parameters relevant to the experiment; Real time video streaming; Presentation of data acquired in tables and scatters. The experiments that compose e-lab are found in IST's Alameda Campus. Such setups require that a computer running the corresponding driver, a java program designed to link the hardware and the user. As of now, they comprise various fields from physics, e.g. optics or mechanics. Being a remotely controlled laboratory, e-lab has the ability to gather data and to control the entire apparatus at the will of the user, and as of today every step of each experiment is completely 6 automated. The consequence of automated experiments is that all of the possibilities in these systems have to be well planned, in order not to cause damage to the devices. The only requirement needed for a user to operate e-lab is to have a web browser with a Java Virtual Machine (JVM) installed. The JVM is like a foreign language interpreter, turning Java bytecode into whatever native language a particular computer understands. This makes e-lab a very flexible platform and increases the availability greatly, as it runs on practically any device with an internet connection. The experiment's Graphical User Interface (GUI) provides an appealing way of exchanging the information from the experiment and allows the user to watch the execution of the experiment in realtime, via video streaming. After the experiment has taken place, the results are displayed, showing the corresponding plots. The main goals of e-lab are to motivate students to learn science by showing them real situations that prove scientific theory; to provide access to experimental science and the theory associated, doing so by remotely operating the experimental setup and retrieving data analysis from it; To make available an user-friendly method to teachers and professors for teaching science in an appealing manner; To provide a carefree study of experiments with a degree of danger, such as radioactivity measurements or any Chemistry experiment dealing with noxious gases.; To enable an interaction with expensive equipment and to provide quality educational resources not available at most institutions.(3) E-lab's intent is not only to provide raw data, plots of it or a real-time video transfer, but to provide the necessary knowledge to introduce the user to the experiment that's being performed. To do so, an introductory narrative regarding the physical laws that rule the system is provided, and if relevant, information concerning the devices found in the experimental setup. Because this experiment could be controlled without human supervision, it could provide remote interaction to anyone wanting to study the various technologies employed, without the dangers associated with hydrogen usage and without placing the devices under hazardous conditions.(3) 7 1.3 State-of-the-art In this chapter a description of the current technology used in automated laboratories will be made. In addition, the most relevant experiments regarding energy storage using hydrogen will also be mentioned. Any background and current developments on pulsed electrolysis will be made in chapter 6. Because the description of electrolysers is made in the following chapters it seems to be the most appropriate structure for the document. 1.3.1 Hydrogen Storage for Intermittent Power Sources This work [4] has served as the blueprint for the experimental setup and electronics in this thesis. It was the first attempt to build a prototype of a solar to hydrogen power plant to the e-lab project. The structure and electronics were very similar to the one in this thesis’ experiment, even though only the fuel cell stack and the LED panel could be reused. The power conversion circuits were not optimized. Because BJT transistors were used, major heat losses were taking place, even at lower power ranges that the setup required – compared to the present experiment. In addition, there were no safety fuses protecting the devices. 1.3.2 Remote Controlled Laboratories Remote controlled experiments take place in several locations in the world today, and belong either to a single institution or partnerships of institutions. Most of the relevant projects – the ones that are currently online – use Java interfaces, either launching Java applets or directly embedding the contents on the webpage. In general, most of the laboratories that distribute experiments require one computer per experiment [3] Although most of them share the same functions, a brief description of some will be given along with the most interesting features. AutomatL@bs The AutomatL@bs is a partnership between several Universities from Spain such as Universidad Politécnica de Cataluña, Universidad de Alicante, Universidad Politécnica de Valencia among others. The experiments currently online cover a few basic fields of physics, such as optics, thermodynamics or hydrodynamics. The software used to treat and display the data acquired from the experiments are Simulink and Easy Java Simulations, along with LabView remote panels (Virtual Network Computing). 8 There are however some more interesting features in the Java Applet that improves the communication between the user and the hardware. In Jara CA, et al. (2012) article it's introduced a new implementation that makes use of Java 3D library to improve both the performance and the appearance of models. LabShare Labshare laboratories are a joint partnership between University of Technology of Sydney, the University of Curtin and the Royal Melbourne Institute of Technology. They are currently running tens of experiments, ranging from chemistry to applied physics, passing through many others. The use of those experiments is limited to registered students of said institutions, and is used in many courses, such as Chemical Engineering, Electrical Engineering or Civil Engineering. LabShare has implemented the requirement of booking a time slot to perform the experiments, along with the possibility of changing the view of the video that is being streamed, by means of a webcam with a rotational axis. The treatment of the data is made and displayed through a LabView GUI. RCL, Olomouc, NetLabs and others These are some other laboratories that currently provide online control of remote laboratories. They share common features, without having any that stands out. 1.3.3 Energy Storage Experiments In a Blinov A, et al (2013) a system very similar to the one being implemented in the e-lab experiment is studied and implemented.[5] The study explorerd the electronics of the system, presenting interesting solutions in the kW power range. 9 Fig. 6 Structure of the power system. [5] The work done revolved around the electronics of the DC/DC converters, mainly in the minimization of the switching losses occurring in the switching devices, and on the isolation of the power modules by having the energy source on the primary side of a transformer and the rest of the electronics on the secondary. The structure of the system can be seen in Fig.6. Although no external renewable source was used, the circuitry was designed to easily introduce one, without any particular adaptations. In Belvedere B, et al (2012), a study of a power system comprising a PV unit and able to control the output of a fuel cell was implemented.[6] Unlike the previous experiment, a greater emphasis is given to the management of the system, providing routines for control and data acquisition, as well as safety mechanisms. This power management system developed a potential domestic application, working in the kW power range. 10 Fig. 7 Structure of the control routines. [6] Additional work was done in many other papers, sharing the same structure: Conversion of the input renewable energy source from AC/DC or DC/DC; production of hydrogen using an electrolyser; storage of hydrogen; production of power using a fuel cell. The control routines can be observed in Fig.7. 1. 4 Outline Chapter 2 – In this chapter a description of the most relevant devices used can be found. It has the technical characteristics acquired throughout the dissertation. Also, a brief introduction to the working principle behind the operation of each of the devices is added. Chapter 3 – In this chapter the electronics used in the experiment are presented and analyzed. In particular, the power conversion circuits, signal management and data acquisition. Chapter 4 – In this chapter, the principles of the e-lab platform are explained, followed by an introduction to the communication between the user and the hardware, as well as some elements of the user interaction. Chapter 5 – The description and results of the study regarding water electrolysis with a pulsed power supply are presented and discussed. Chapter 6 – Conclusions from the work done in the e-lab experiment and from the pulsed electrolysis experiment. 11 Chapter 2 Experimental setup Fig. 8 Experimental Setup. 2.1 LED and PV panels The light source for the experiment was designed and constructed in the work that preceded this thesis, Hydrogen Storage for Intermittent Power Sources.[8] It is a panel of 252 high brightness LEDs which is controlled with a dsPic microcontroller. The panel has three types of LED, each emitting in a different wavelength, which corresponds to the following colors: Blue (B), pure Green (G) and Red (R). It basically is able to control the intensity of light emitted and the combination of colors present in the light. Bearing in mind the scale of the power at which the electrolyser works (15 W) a 1m2 photovoltaic panel would be needed (for the same kind of cell used in this experiment). With efficiencies as high as 25% it’s straightforward to figure a much more powerful light source should be used. Since this was not the most important part of the experiment, the power and dimension issues were bypassed by using a small array of PV cells to harvest the energy of the light emitted by the LED 12 panel. By doing so the power delivered by the light source to the PV panel is measured on a small resistor and will then be used to regulate the power delivered by an external source to the electrolyser. The following figures (Fig. 9 and Fig. 10) show the short circuit current and voltage when a PV panel, similar to the one used in the experiment, was exposed to the LED panel at various percentages of the maximum power. Fig. 9 Short Circuit current vs Duty cycle. Fig. 10 Voltage applied to a load vs Duty cycle. 13 2.2 PEM Electrolyser The device used to generate hydrogen is a proton exchange membrane electrolyser. The relation between the power provided to the electrolyser and the amount of hydrogen it can produce is, at a first approach, related through the Faraday’s Law of electrolysis: the production rate of hydrogen is proportional to the current provided to the electrolyser. Assuming electrons or ions do not participate in unwanted side reactions, the ideal chemical equations of the electrodes’ reactions are as follow: (Anode reaction) 2H2 O(l) → O2 (g) + 4H + (aq) + 4e− (3.1) (Cathode reaction) 2H + (aq) + 2e− → H2 (g) (3.2) Fig. 11 PEM electrolyser. As can be seen in Fig. 11, once the electrolyser is fed with the required voltage, the molecular bounds in the water are broken and molecular oxygen, electrons and protons are produced. The membrane allows the protons to travel across it to the cathode, by way of water transport (forming the H3O+ ion). The electrons formed in the anode reaction are channeled through the electrode to the battery. As the protons arrive at the other side of the membrane, the current from the cathode feeds the required electrons in order to form hydrogen atoms. The anode side of the electrolyser, due to the concentration of hydronium H3O+ is a very acidic environment. This leads to the necessity of using materials which can sustain corrosion and conduct the electrons with little losses. 14 Electrolyser main components The main component of the electrolyser consists of a Membrane Electrode Assembly (MEA). Its main tasks in the PEM electrolysis process are to provide a mean to conduct protons, which were obtained by the catalysis of the hydrogen, from the anode to the cathode and to isolate both sub-reactions; In addition, a small grid of stainless steel is used to collect the current and allows the passage of the gases; additional structures are used to provide a solid structure to the device as well as to insure isolation between both sides of the MEA. The MEA is composed of a Nafion membrane– a sulfonated polymer membrane – produced by Dupont and the catalyst embedded directly in both sides of the membrane or in a conducting agent such as carbon. The losses conducting the protons are tied directly to the thickness of the polymer membrane. Basically, the thinner it is, the less resistance it offers to the protonic flow. The nature of the reactions occurring in each electrode dictates some of the requirements of the materials used. In particular due to the presence of protons, the anode side – where water is abundant – can be considered an acidic environment and as such, each of the materials must not be corrodible. This makes the catalyst of choice be platinum, because of its robustness, its activity for the reaction and because of the very small conduction losses. The improvements on the MEA are one of the main research interests today – shared with PEM fuel cell technology – and can be summarized to a substitute to the platinum particles used as catalyst for electrolysis, or at least to use a much smaller amount via an optimized nanostructure to increase the total catalytic area.[9] 15 Performance In Fig. 12 the voltage/current can be seen density characteristic for a typical PEM electrolyser. Fig. 12 I-V characteristic of a typical PEM electrolyser. [Source: Wikipedia] There are three distinct regions in the representation of the stack performance, which are related to three main kinds of overpotentials: Activation losses: these losses are related primarily to the type of catalyst, along with the active area and the support stability. These losses are highly dependent on the catalyst surface’s temperature found in the electrolyser, which can be understood better in the thermodynamical analysis. (10) A simplified model of the Butler-Volmer equation for the activation potential is: Vact = R.T 2.α.F I . ln( ) (3.3) I0 (R is the ideal gas constant; T is the temperature; α the charge transfer coefficient; I0 is the exchange current between both electrodes) We can see that the overpotential varies logarithmically with the current, which means that we can consider the activation voltage almost constant for any high current drained by the device. The amount of voltage required for the process start to take place is the result of the combination of the chemical potential between the electrodes and the electrolytes (shown in the thermodynamics section ahead), and the parasitic capacitance that arises between the electrodes and electrolyte. 16 Because this capacitance is at the heart of the study made in chapter 6, regarding pulsed electrolysis, a brief description of the phenomenon will be made. The double layer capacitance arises from the potential dependence of electrostatic charging on the cathode surface, which is influenced by the concentration of ions (H3O+, which is the proton form in aqueous solution; or from impurities) near the surface. The thickness of the layers is related to an increased potential, which in turn implies an added amount of energy to perform electrolysis. In addition, the interaction of electrons with H3O+ ions at the surface of the cathode gives rise to what is called pseudocapacitance, where an intermediate medium is formed that stores charge in the vicinities of the electrode. In porous electrodes, such as the ones present in PEM MEAs, the charging/discharging pattern may not be the ideal exponential curve, due to ohmic effects which makes potential penetration into the pores more difficult.(11, 12) Fig. 13 Double layer (source: wikipedia) These effects, either by the increased potential caused by the double layer or because of the lost electrons, are a source of additional losses. Ohmic losses: mainly due to protonic ohmic losses, which are tied with the conduction of the protons across the membrane, and to a smaller degree with electron conduction losses. These losses are directly proportional to the membrane thickness and conductivity and to the materials used in the catalyst and separator plates. v = rI (3.4) (v are the ohmic losses; r is the ohmic resistance; I is the current) Mass Transport losses: these losses are associated with the conflict generated by the departure of oxygen from and water access to the anode. It is clear that these losses occur mainly at high oxygen production rates and consequently at high current densities. What happens is because the electric 17 power has no water to interact with, it is dissipated as heat. As can be seen in figure, these losses become relevant for high current densities. Vmt = R.T 2.F I . ln(1 − ( )) (3.5) Il (Vmt are the mass transport losses, R is the ideal gas constant; T is the temperature; Il is the limiting current, F is the constant of Faraday) Some of the factors that maximize the efficiency are: increasing the temperature and pressure at which the device is working at; increasing the concentration of platinum or whatever catalyst is being used, so as to increase the active area for reactions to occur; geometry of the stack – distance and orientation of both electrodes; and detachment of oxygen bubbles from electrode. (13) Thermodynamics A thermodynamical analysis of water electrolysis brings additional insight to the electrolyser. The Gibbs free energy measures the process-initiating work obtainable from a thermodynamic system at a constant temperature and pressure, and is defined as: G = H − TS (3.6) H = U + PV (3.7) (H is the enthalpy; T is the temperature; S is the entropy; U is the internal energy; P is the pressure; V is the volume) For constant temperature, a change in the Gibbs energy is represented as: If ∆G ∆G = ∆H − T∆S (3.8) = 0, the reaction is in equilibrium; if ∆G < 0, it occurs spontaneously; if ∆G > 0, it does not occur. On another note, the enthalpy represents a measure of the total energy of a thermodynamic system and gives us the minimum energy for a reaction to occur, in particular for water to dissociate: H2 O(l) + ∆S → H2 + 1⁄2 O2 (3.9) Because an electrolyser adds electrical energy to the internal energy of the system, energy, converted to its differential form, is given by: dU = 𝑇𝑑𝑆 − 𝑃𝑑𝑉 + 𝑑𝑊𝑒𝑙 (3.10) Wel , the internal (Wel is the electric energy) An application of the Legendre transform to the internal energy provides the enthalpy, which is more convenient to the case being studied. dH = −SdT + VdP + dWel (3.11) For the electrolyser, one can consider that the pressure and temperature are constant, so: dH = dWel = Q. V (3.12) (Q is the charge; V is the reversible potential) 18 Returning to the Gibbs free energy, one can see there’s a component related to electrical work (H) and thermal work (T∆S). The water heat of dissociation is: ∆H = ∆G + T∆S ≈ 285 kJmol−1(3.13) The entropy change is: ∆S = SF (H2 ) + SF (O2 ) + SF (H2 O) ≈ 0.163 kJmol−1 K −1 (3.14) (SF is the standard molar entropy for each of the molecules) Using tables, the energy from heat required at 298 K is T∆S required at 298K is ∆G = 237.4 kJmol−1 . = 48.6 kJmol−1 . The electrical work Thus the voltage required for water dissociation is: V= ∆G Q = ∆G −nF (3.15) (n is the number moles of electrons (2 for each water molecule); F is the constant of Faraday) This gives origin to the lower heating value (LHV), which is equal to 1.23 V if one assumes the water is in a vapor state. Considering the water is in liquid state, which is the correct assumption, the higher heating value (HHV) is found, which is 1.48 V. Because of the pulsed electrolysis tests done by Hotta, O. et al (2006), the efficiency was found using the HHV.(15) To find the least amount of power required to generate hydrogen ∆G = 285 kJmol−1 was used, and at NTP conditions we have that 1 mole of ideal gas occupies 24.465 dm 3. Therefore, the relation between power and flow is given below: PFmin = 11.56 W/cm3 . s −1 (3.16) (Where PF is the minimum power to generate a flow of H2 of 1 cm3 per second) Electrolyser characteristics The particular device used in the remote experiment and in the pulsed electrolysis tests is composed by two parallel electrolysers, with the cathodes joining the same exit. This made the applied voltage rise to around double of a single electrolyser, as expected. This fabrication process enables a crude estimation of the power required. By controlling the physical dimensions of the MEA the current required can be estimated. This occurs, of course, given the contingency that all electrolysers’ impedances are similar (to divide the voltage evenly). 19 The device used had a diode connecting both electrodes in order to remove any AC component – as a protection from misconnections, but also from the transients associated with fast switching behaviors (best seen in chapter 6). This diode was placed by the manufacturer and prevented any parasitic formation of water electrolysis’ products in the wrong electrode. For the automated experiment, there is no need to operate the device outside the ohmic zone, where the I-V characteristic is linear (seen in Fig.14); this was also the region of operation recommended by the manufacturer. Voltage(V) 4 3,5 3 2,5 2 0 0,5 1 1,5 2 2,5 3 3,5 4 Current(A) Fig. 14 Plot of current vs voltage for the electrolyser Fig. 15 Efficiency of the electrolyser As can be seen in Fig. 15, the efficiency of the electrolyser diminishes as the total power increases. Based on the description of the components in the current/voltage curve, it can be seen that as the power consumption increases, more conduction losses occur. 20 2.3 Storage, valves and volume measurement In order to store water, oxygen and hydrogen a system of interconnected reservoirs was created. Fig. 16 Scheme of the containers As can be seen in the illustration in Fig. 16, the quantities of both gases are limited to the volume of the containers. This fuel limitation will give additional importance to the efficiency of the fuel cell section of the experiment. The major challenge in the operation of this system of reservoirs was making sure there were no leaks: not only leaks occurring when the ensemble is functioning – hydrogen and oxygen- but also water. To allow easy replacement of water, at the bottom end of the gases’ reservoirs, two taps were placed. This allows the water to drain once the system’s valves are let open. To measure the amount of hydrogen and oxygen produced, a sensor had to be developed. Since the volume of the gases is proportional to the height of the water inside the gases' containers, the sensor detected variations in the height of the water. The structure of the height sensor is basically an implementation of the astable circuit of the IC ne555 – the 555 timer puts out a continuous stream of rectangular pulses at specific frequencies. 21 The structure of the circuit is shown in Fig. 17. Fig. 17 Astable circuit (taken from the ne555 data sheet) Because the output frequency of the circuit is dependent on the parameters of passive components, the containers served as capacitors by adding a small copper conductor placed in the middle and a nickeled net on its surface at a ground voltage. The following expressions shown the frequency dependency on the components of the circuit and the relations between the periods in high (and low). 𝑓= 1 ln(2).𝐶.(𝑅1 +2𝑅2 ) (3.17) 𝑡ℎ𝑖𝑔ℎ = ln(2) . (𝑅1 +𝑅2 ). 𝐶 (3.18) 𝑡𝑙𝑜𝑤 = ln(2) . 𝑅2 . 𝐶 (3.19) As can be seen, the Duty Cycle of the wave remains constant, and the frequency is the only variant. Because of the cylindrical symmetry of the containers, the proportion between the water and the gas inside the storage units induces changes in the capacitance. This is turn makes the square wave of the output of the astable vary. 22 In Fig.18 and Fig. 19 are the counts acquired by the IC module of the dsPic and the height in each compartment. The calibration process involved adding a measured amount of water and measuring the height and counts. 1700 Hydrogen Counts 1650 1600 y = 8,505x + 1457 R² = 0,9989 1550 1500 1450 1400 0 5 10 15 20 25 Volume(ml) Fig. 18 Volume/counts calibration (hydrogen) 1800 Oxygen 1700 Counts 1600 y = 18,376x + 1334,7 R² = 0,9991 1500 1400 1300 1200 0 5 10 15 Volume(ml) 20 25 Fig. 19 Volume/counts calibration (oxygen) To control the flow of the gases, an electro-valve was used. Due to the delay in the time response of the PEM cell (takes around 30 seconds to produce power), the fuel is injected in two steps. Firstly, the valve is opened in order to fill the volume of the cells’ internal volume. The valve is then closed in order not to let the fuel escape – as in a straw closed at one end – and allowing the reaction to start without losing fuel. Once the reaction starts – known by the voltage measurements of the controller– the remainder of the hydrogen is injected when the valve is opened. These sensors seemed to have an adequate resolution (estimated at 0.5 ml) for the experiment at hand and had an adequate response time (compared to the speed of the events taking place), which provided a quality standard to the measurements. In addition, they were fairly simple to construct, and for the length of the containers – even near the end of the ground voltage net – it worked ideally, i.e. linearly. The differences in both sensors calibration equation may be tied to small differences in the materials used, such as the length and number of copper threads in the conductor or because of the welding. 23 2.4 PEM Fuel Cell The fuel cell used in the experiment was chosen to be a PEM. This was possible because the electrolyser is able to produce high purity hydrogen – in particular, hydrogen free of CO and other of the MEA’s contaminants. This choice brings some advantages, compared to other types of cell: when properly managed it functions at moderate temperatures (around 80ºC) and is quite compact (can output fairly high current densities for its size). However it functions ideally when aided by ancillary equipment able to pressurize the hydrogen. The conversion of hydrogen to electricity using a PEM fuel cell is, to an extent, the reverse of what happens in the electrolyser. Because of that some of the ideas presented before will be reintroduced in this section. As in the case of the electrolyser, an analysis based on the sub-reaction occurring at each electrode brings additional insight. (Anode reaction) (Cathode reaction) 1 2 𝑂2 (𝑔) 𝐻2 (𝑔) → 2𝐻 + (𝑎𝑞) + 2𝑒 − (3.20) + 2𝑒 − + 2𝐻 + (𝑎𝑞) → 𝐻2 𝑂(𝑣𝑎𝑝𝑜𝑟) + 𝐻𝑒𝑎𝑡 (3.21) As one can see, in the anode, when the flow of hydrogen molecules is faced with the MEA – similar to the one found in the cathode of the PEM electrolyser – it’s catalytically split into protons and electrons. The flux of electrons can be used to power a load, while travelling to the cathode of the cell. In the cathode, the reaction is completed contingent on three conditions: In the same location there must be the catalyst – to conduct the returning electrons – molecular oxygen and the protons transported through the membrane. If this takes place, water in vapor state is formed and thermal energy is released. Bearing in mind that the electrolytic reaction at the anode occurs almost spontaneously, with a standard electrode potential of 0 V, and the cathode reaction with a standard electrode potential of 1,229 V, it’s clear that the cathode reaction occurs at a much slower rate – which can be shown to be around ten thousand times slower using platinum catalysts. As in the electrolyser case, ideally the fuel used in the reaction should be proportional to the power provided. Fig. 20 Schematic of a fuel cell operation 24 Cell main components A cell is composed by a MEA – which enables the conduction of the protons across the membrane and isolates both the oxidant and reductant as well as the electrons, from the anode and cathode; the bipolar plates – which conducts current and distributes the hydrogen and oxygen on its opposite sides; there are also gaskets to prevent leakages and other structures that serve to provide stability. To aid in the cathode reaction in open cathode cells, is common in stacks to use a fan – this serves to supply the molecular oxygen’s concentration as well as to cool the cell. A remark must be made, as to the amount of flow the fan is able to produce. In the lab one could observe that there is an optimum flow produced by the fan (by varying the power supplied). This could be explained by the ability to dehydrate the membrane if too much air is forced into the cathode side of the cell. If the flow is too small, and not enough oxygen is supplied as well as the possibility to form excess water – which is as detrimental to the reaction as the lack of it. As seen in the electrolyser section of the chapter, the MEA is composed by a Nafion membrane which embeds the catalyst – platinum particles supported in a thin carbon layer. The membrane is able to conduct the protons by water transport, as described by Grothuss who discovered the mechanism by which water diffuses from the cathode (where it is formed) to the anode making the whole membrane hydrated. Like in the electrolyser, the thickness of the membrane is proportional to the resistance in the conduction of the protons and is tied to the gases’ crossover – the ability to permeate to the other side of the membrane – which gains importance as the operating pressure in the cell increases. The choice of catalyst in the MEA is platinum and is related mainly to the ability of this catalyst to accelerate these reactions, which minimizes losses, as well as the ability to conduct large amounts of current. This holds particularly true when considering the electrodes’ standard electrode potential for both sub reaction: for the anode is occurs at 0 V and for the cathode it requires around 1.23 V. The carbon plated layer which embeds the platinum particles at the cathode presents an interesting compromise regarding its thickness. One the one hand, being thicker it can gather much more protons and thus lend an increased rate to the sub-reaction. On the other hand it increases the resistance to the exit of the water formed. 25 Performance Fig. 21 Thermodynamics of Fuel Cells; chapter 2 Springer [16] In Fig. 21 one can see the typical performance curve for a PEM fuel cell. Like in the electrolyser, one can divide the plot in three sections due to the three dominant losses occurring. Activation losses: these are pronounced in the low current region but exist through all the regions. In this region electronic barriers must be overcome before the current and protonic flow. The activation polarization can be represented as Vact = R.T 2.a.F I . ln( ) (3.22) I0 (α the charge transfer coefficient, F the Faraday constant, I the current density, and I0 the exchange current density) Activation polarization is due to the speed of the electrochemical reactions at the electrode surface, where the species are oxidized or reduced in a fuel cell reaction. Ohmic losses: these losses can be represented as: v = rI (3.23) The origin of ohmic polarization comes from the resistance to the flow of ions in the electrolyte and flux of electrons through the electrodes and the external electrical circuit resistance. The dominant ohmic loss is in the electrolyte, which is reduced by decreasing the electrode separation, enhancing the ionic conductivity of the electrolyte and by modification of the electrolyte properties. Concentration losses: these occur over the entire range of current density, but these become prominent at high limiting currents where it becomes limited for the oxygen flow to reach the fuel cell 26 reaction sites, as well as for the water formed to exit the anodic side of the MEA. These mass transfer losses can be represented as: Vmt = R.T 2.F I . ln(1 − ( )) (3.24) Il (Il is the limiting current density) Thermodynamics Due to the similarities between the electrolyser and the fuel cell – namely the material used as catalyst – the thermodynamics of both reactions are very similar, yet occurring in opposite directions. The process that occurs inside a cell (or a stack of cells) is described in the following equation: 1 𝐻2 (𝑔) + 𝐻2 2 (𝑔) → 𝐻2 𝑂(𝑔) + 𝐻𝑒𝑎𝑡 (3.25) The heat released in the reaction can be seen as the difference of the specific heats of the products and the reactants, and is equivalent to the enthalpy of the reaction. ∆H = HF (H2 O) − HF (H2 ) − 1⁄2 HF (O2 ) (3.26) The heat of formation for water is -285 kJmol-1, the negative sign meaning the release of the energy in the reaction, and the heat of formation of the reactants is defined as zero. At NPT conditions, the heat of formation of water lowers to -237kJmol-1, which causes the enthalpy to decrease. This value is the LHV, as mentioned in the electrolyser section, is tied with the vapor state of the water. This can be seen clearly in the change in the Gibbs energy is represented as: ∆G = ∆H − T∆S (3.27) This means that of the heat released during the reaction (HHV), a part is converted to useful work and the other is wasted due to entropic processes. At NPT, the entropy change is the sum of the entropy of each of the molecules and is: ∆S = SF (H2 ) + SF (O2 ) + SF (H2 O) ≈ 0.163 kJmol−1 K −1 (3.28) This at 298K equals the lower heating value. Following the relation between work and enthalpy found for the electrolyser (considering the pressure and temperature constant during the reaction): dH = dWel = Q. V(3.29) Q is the charge; V is the potential Returning to the Gibbs free energy, one can see there’s a component related to electrical work (H) and thermal work (T∆S). 27 Thus the voltage required for water to be formed is the same as in equation (3.15). This gives a theoretical potential of around 1.23 V for each cell, using the LHV. [14] The overall efficiency, η , is the product of three distinct efficiencies:  The thermodynamical efficiency: ∆G η𝑡ℎ = ∆H (3.30) Which simply represents the ratio of the energy provided to the system coming from the hydrogen ∆H, is converted to electric energy, as the free energy of Gibbs. It can be considered to be 94% if the water is considered to be in a gas state.  The voltage efficiency: η𝑉 = u 𝐸 (3.31) Which is the relation between the voltage (u) of a cell and the ideal value of E=1.23 V. Or for a stack of n cells, U being the total voltage of the stack: η𝑉 =  U 𝑛.𝐸 (3.32) The current efficiency, given by the Faraday efficiency: η𝐹 = 𝑖 𝑛𝑒 .𝑉𝐻2 .𝐹 (3.33) (𝑛𝑒 is 2; 𝑉𝐻2 is the flow of the hydrogen) The reaction in the previous equation represents the current which would be obtained if the conversion of the reactants were ideal. Because of parallel reactions, this is not the case. To find the efficiency associated to the current, the ratio between the used hydrogen and the hydrogen provided is found: µ𝐹 = H reacted 𝐻 𝑝𝑟𝑜𝑣𝑖𝑑𝑒𝑑 (3.34) η𝑖 = η𝐹 . µ𝐹 (3.35) Therefore, the overall efficiency is given by: η𝑉 = η𝑡ℎ . η𝑉 . η𝑖 (3.36) 28 Stack Recovery During the course of the preparation of the devices required for the experiment an extensive amount of time was spent on the study of the recovery of the fuel cell stacks. To understand how to increase the performance of a stack of several fuel cells one has to understand the main events that hinder a cell from outputting the maximum power it ideally could:  Long periods of inactivity or storage in dry environments – This leads either to temporary or permanent damage on the PEM. This occurs because the conduction of protons is done through water transportation, which is difficult if the membrane itself is in a state of partial dryness. If the membrane is completely dry, cracks can be found in the MEA and the platinum particles inadequately dispersed[17] [18]  Over-loading – As the name suggests, this occurs when too much current is drained out of the fuel cell stack; because the amount of current a cell can conduct is proportional to its dimensions, so there is a bound for the maximum current. The excessive loading can be seen by checking if the voltage in each cell does not fall below 0.3 V. Other causes for a lowered performance are contaminants on the membrane, uneven pressure across the device (which favors some regions of the membrane), and corrosion of the materials [22] Initially, the fuel cell used in the remote controlled experiment exhibited clear signs of being in far from ideal conditions – in particular, it could not provide significant current to power even a light load. Because of this, two spare cells in the laboratory were considered as replacements. Because these cells shown signs of being merely dehydrated, though trial and error, the following recovery procedure was found: 1. Hydrate the membrane by filling the stack with water. This can be done by having the stack in a water container and making sure there are no air deposits on the cells. 2. Still filled with water, the stack is submitted to a temperature of 80ºC, during a period of around 12 hours. This can be done using an oven. 3. Remove the remaining water with a low pressure nitrogen flow (or another inert gas). This is to remove all excess water. 4. Provide the cells with hydrogen and relatively high currents (drain currents which leave the short circuit voltage slightly above the threshold mentioned above – 0.3 V per cell) for short amounts of time (6 seconds). 5. Increase the current drained if the short circuit voltage increases (as the cell reaches near its top performance, repeated tests on the same voltage may be required before any improvements). 29 6. Repeat step 5 until an equilibrium is achieved. The behavior of the cell to theses regimes was found because of miscommunications in the interfacing software of the controllable load and the computer. This caused very high currents to be drained. Because the source was submitted to these loads for short periods of time, no damage to the fuel cell occurred, instead, both the maximum short circuit current and open circuit voltage were found to be significantly higher than before. The plots in Fig.22 show the evolution of the voltage, current, resistance and power for one of the stacks recovered. Voltage (V) 17 12 7 0,4 Current (A) 0,2 0 30 Resistance (Ω) 400 200 0 Power (W) 5 0 Fig. 22 Plots of the Voltage, Resistance, Current and Power during the stack recovery In all of the three devices, this protocol – or very similar versions of it – showed significant improvements both on the short circuit current and voltage but on the open circuit voltage, comparing the start and end. In particular, because the cells were submitted to mild operating conditions in the beginning of the recovery process, showing little or no evolution. However, because the stack which was finally used had been submitted to excessive stress, one of the cells’ MEA was found to be permanently damaged. It exhibited the behavior of a typical load (negative potential across its electrodes), potentially working as an electrolyser. Since the cell manufacturer had glued each of the cells, the removal of the damaged cell risked the integrity of the whole stack; to avoid this problem, a short circuit to one of the adjacent cells was performed and with that, the device began working properly. It can also be concluded that because of the increase in the activation voltage of the stack, the internal resistance is lowered. Fuel Cell Characteristics Once functional, the PEM fuel cell stack – originally with 14 working cells, but now reduced to 13 – was tested under a pressurized flow of hydrogen (at around 2 bar). To control the hydrogen output, an hypodermic needle (30 gauge) was placed at the end of the stack. The results available from these conditions present fewer losses than what is possible at normal pressure, and show the best performance possible for the cells. In Fig. 23 one can see the voltage response of the stack as the current was drained. 31 Fig. 23 Voltage/Current curve of the stack As can be seen, the open circuit voltage is around 10 volt, which gives an average of 0.73 V for each cell. This is a sign of a healthy stack, even though it comes behind the difference between the standard electrode potentials of the cathode and anode reactions. It can also be noticed that the cell is able to withstand 0.5 A without having a large voltage drop. This is the maximum current at which the device can operate without being overstressed (the average voltage of each cell is around 0.35 V). In Fig. 24 it’s shown the power the cell can provide dependent on the current drained. Fig. 24 Power/Current curve 32 One can see the typical behavior for cells of this kind, which has a maximum power point clearly visible for a drained current of around 0.45 A. Observing in Fig. 25, one can see the ideal behavior for the stack; however, considering that the stack lost a cell and is not in ideal conditions, as well as being supplied with non-pressurized hydrogen, the power difference of almost 2.5 W for the same current is comprehensible. Fig. 25 Power / Current curve [Source: manufacturer’s technical sheet] At full power, considering the flow of the electrolyser (available in the pulsed electrolysis chapter) and the excess hydrogen found using an inverted tube, the current efficiency given using equation (3.34) and some estimates of the flow: 𝜂𝑖 = 0.083 × µ𝐹 Where µ𝐹 was found to be less than 5%. This gives a very low current efficiency, and could have been improved, had the hydrogen exit been controlled. The overall efficiency using equations (3.30 to 3.36) is estimated to be then: 𝜂 = 0.05 × µ𝐹 Since the manufacturer claims an efficiency of 40%, this makes the value above acceptable considering the facts noted before – damaged cells, fuel leakage, low pressure (…). The maximum power point found in the stack performance could have been important, should the application be focused on efficiency (if it were to charge a battery for instance). A maximum power point tracking algorithm would be required in order to get the most energy out of the cell stack. Because the performance of the load is the main goal, it makes no sense to limit the hydrogen consumption (proportional to the current). In pressurized tests, to minimize the amount of hydrogen that exited the stack without reacting, a hypodermic needle (30 gauge) was placed at the end of the stack. Because the pressure is limited to a few centimeters of water – the pressure from the water columns in the containers – the removal of any obstructing device at the hydrogen output is mandatory: primarily, to allow hydrogen to enter the 33 cell, but also not to obstruct the exit of excess water formed inside the anode side of the bipolar plates (by diffusion from the cathode). Purging excess water without a compressor is not feasible due to insufficient pressure; to minimize this issue, the stack was placed in a position where the liquid water could drain out of the stack because of gravity alone. Because the fuel cell will only operate for a fraction of a minute, the problem of excess water does not have a large effect on the operability of the experiment. To control the fan that eases oxygen access to the cathode side of the MEA – turning it on only when the cell is meant to work – it is powered by the signal that controls the auxiliary power converting circuits. Finally to prevent unnecessary stress on the stack, particularly when the fuel becomes scarce, a cell – found to be the weakest – had its voltage followed by the microcontroller, which will regulate the maximum power drained based on it. 34 Chapter 3 Electronics and Control For the implementation of the experiment, three power circuits were implemented. To regulate the luminosity of the LED Panel, the output of the power source was switched at fixed frequency, which made the total amount of power provided proportional to the ON/OFF ratio. The second circuit is a buck converter (voltage step-down, current step-up), which receives an initial voltage and outputs a voltage of smaller value (𝑉𝑖𝑛 > 𝑉𝑜𝑢𝑡 ) while doing the opposite for the current (𝐼𝑖𝑛 > 𝐼𝑜𝑢𝑡 ). This converter is used to power the PEM electrolyser. Similarly, for the third circuit, which regulates the output voltage of the fuel cell stack to power a magnetic motor, a variation of the step-down converter was implemented. These circuits enable the control of the amount of hydrogen (and oxygen) produced by the electrolyser and the luminosity emitted by the LED panel; in the case of the fuel cell, to control the hydrogen consumption rate. In the following section the functioning principles behind these circuits will be explained, followed by a detailed review of the losses that occur along with the experimental results. 3.1 LED panel regulation Since a LED only emits light when a threshold potential is achieved, the dimming of the light source is done by limiting the current. This is done by switching a Darlington BJT transistor on and off. The intensity of the light emitted by this device, after a certain threshold voltage, increases with the current provided by the power source. This effect is represented in the Fig. 26. Fig. 26 Typical emissivity / current characteristic of a LED 35 The variation in intensity is done by switching the devices ON and OFF at a fast enough rate such that it appears to be a continuous occurrence rather than a discrete one. By doing so, the actual current is proportional to the duty cycle of the controlling signal. Within the experiment the light source was able to perform the following tasks: Emit light in one of the seven different arrangements with the three base colors (B, G, R, BG, BR, GR and BGR). Regulate the intensity of the light emission for each of the modes above. The ability to dim the light is done with a BJT transistor (one for each of the three sets of LEDs). The base of each transistor should ideally be controlled by an output compare pin, because it is able to produce very high frequency signals and easily controlled ON/OFF ratios. Because of the scarcity of output compare channels available (two of four were necessary to control other devices), the switching had to be done using a generic output pin, upon an interruption of a timer. This method does not allow such fast switching frequencies as those available using output compare pins, mainly because constant timer interruptions would interfere with the main routine/UART communications – however, it was still fast enough for the intended application, and because the signal that goes to the ADC channel is filtered with a capacitor, a smoothing effect occurs. For the LED panel to fully function and start to emit light, a threshold voltage of around 48 volt is required. This cannot be easily arranged without using an additional power source. Early tests with converters to step up the voltage were made. However since the highest voltage available in the main power supply is 12V, it would require to drain great amounts of current, even with no losses associated with the converter. 𝑉𝑖𝑛 𝐼𝑖𝑛 = 𝑉𝑜𝑢𝑡 𝐼𝑜𝑢𝑡 (4.1) Because of the simultaneous operation of the LED panel and the electrolyser, the power supply would have to source a total amount of current close to 9 A (ideally), which is beyond what it can supply. The source that provided the power to light the LEDs is a full wave rectifier. The schematic of the circuit can be seen in Fig. 27. 220 V AC 50 Hz C out LED panel Fig. 27 Full wave rectifier schematic 36 The fuse was chosen to be placed at the secondary of the transformer, mainly because it can protect all of the components and at the same time limit the used current – instead of placing it in the primary and having to calculate the correspondent current based on the relation of the windings . 3.2 Buck Converter – PV panel output In Fig. 28 is the asynchronous configuration of the step-down converter. Fig. 28 Schematic of the step-down converter The idea behind the circuit is to alternate the state of the inductor and filter the resulting output in order to achieve a steady DC voltage. In this application the current that goes through the inductor never falls to zero. This is called the continuous operation mode. When the circuit’s switch is on, the inductor’s induced voltage increases linearly up to the voltage of the source, while the current is forming a magnetic field in the inductor. When the switch is not conducting, the voltage induced by the collapsing magnetic field decreases. During this period, current is conducted through the diode, from the ground. By controlling the switch with a square wave, the inductor voltage will be proportional to the Duty Cycle and will be triangular in shape. Obviously, as this process is done at a greater rate (higher switching frequency) the amplitude of the AC component of the signal is lowered. This effect is clear to see in the waveforms presented in figure 29. The relationship of voltage and current for an inductor is: 𝑉=𝐿 1 𝑡 𝑑𝑖 𝑑𝑡 𝑖 = ∫0 𝑉 𝑑𝑡 + 𝑖0 𝐿 (4.2) (4.3) For a constant rectangular pulse we can make the equation assume a discrete representation: 𝑖= 𝑉.𝑇 𝐿 + 𝑖0 (4.4) From this we can see that the current is a linear ramp, when the voltage is a constant pulse. When the switch turns on, the current is: 37 𝑖𝑚𝑎𝑥 = (𝑉𝑖𝑛 −𝑉𝑜𝑢𝑡 )𝑇𝑜𝑛 Or more conveniently, the current ripple is: 𝐿 ∆𝑖 = 𝑖𝑚𝑎𝑥 − 𝑖0 = (𝑉𝑖𝑛 −𝑉𝑜𝑢𝑡 )𝑇𝑜𝑛 𝐿 When the switch is off the current ripple is: ∆𝑖 = By equating through ∆𝑖, we can solve for Vout: (𝑉𝑖𝑛 −𝑉𝑜𝑢𝑡 )𝑇𝑜𝑛 Defining the duty cycle as: 𝐿 + 𝑖0 𝑉𝑜𝑢𝑡 .𝑇𝑜𝑓𝑓 𝐿 = 𝐿 𝑇 𝑜𝑓𝑓 (4.6) (4.7) 𝑉𝑜𝑢𝑡 .𝑇𝑜𝑓𝑓 𝐷 = 𝑇 𝑜𝑛 (4.5) (4.8) (4.9) 𝑉𝑜𝑢𝑡 = 𝐷. 𝑉𝑖𝑛 (4.10) These formulas assume the ideality of the components. A real circuit will have the transfer function dependent on the voltage drop of the diode, transistor and parasitic resistances of the other components or PCB traces, resulting in a higher duty cycle for the same voltage. Taking these values into account has some merit considering that the currents dealt in some of the circuits are high (4 A) and the copper layer of the PCB is very thin (<1mm). 38 In Fig. 29 are the waveforms at various components in the circuit. Fig. 29 Waveforms in the various components of the circuit [23] As can be seen, the quality of the output signal is closely tied to the frequency – because the ripple is linear and proportional to the period – and to the ability to filter the AC signal by the output capacitor. An analysis of the behavior of the passive components based on the switching frequency brings additional insight on the parameters of both the inductor and capacitors required in order to ensure the circuit works in the continuous operation mode (𝑖𝐿 ≠ 0). As can be seen in figure 24, the ripple in the current out of the inductor is the same in T and DT (since∆𝑖(𝑇) = ∆𝑖(𝐷𝑇)). Considerations As seen in the equations above, the input voltage and current are different from the ones outputted by the converter. This implies that the internal resistance of the source is variable. 𝑅𝑠𝑟𝑐 = 𝑉𝑠𝑟𝑐 𝐼𝑠𝑟𝑐 ≠ 𝑅𝑏𝑢𝑐𝑘 = 𝑉𝑏𝑢𝑐𝑘 𝐼𝑏𝑢𝑐𝑘 (4.11) 39 Considering the maximum power transfer theorem (which states that a maximum power transfer occurs when the load and source impedances are equal and losses diminish as the ratio between the load and source impedance increases). This can be seen in Fig. 30. Fig. 30 Variation of the power transfer and efficiency (source: wikipedia) Even with the added circuitry, along with the losses inherent to the extra components, one can see that these converters present advantages to some systems which have dynamic sources or loads. Passive Components As seen both circuits have fairly simple topologies, yet to implement a functioning converter the adequate passive components have to be chosen. For the step-down converter: 𝐿= (𝑉𝑖𝑛 −𝑉𝑜𝑢𝑡 ).𝐷 (4.12) (∆𝑖.𝐹𝑠𝑤 ) The output capacitor is found based on the current ripple out of the inductor. 𝐶 = (𝑉 (∆𝑖. 𝐷⁄𝐹 𝑠𝑤 ) 𝑜𝑢𝑡 −𝑉𝑖𝑛 −∆𝑖.𝐸𝑆𝑅) (4.13) In a first approach one would be tempted to use a very large capacitance, however, if the load happens to be disconnected, the discharge of a large capacitor may cause problems in the other components. On another note, an excessive output capacitance (i.e. greater than the required to properly filter the signal) will hinder a fast response. This is particularly relevant in the pulsed DC experiment, where waveforms are generated based on the variation of the duty cycle. To find the value of the input capacitor one has to analyze the task it performs: Firstly it needs to filter any low frequency ripple associated with the power source and the noise from the mains supply (50 Hz). Secondly it needs to filter the noise associated with the switching frequency – which is typically very high – and any fast transients caused by it. 40 As seen before, the capacitors are not ideal, and have an equivalent resistance. So a capacitor is in fact an R-C circuit, with a time constant associated. This is why two capacitors, of different capacitances are required. One will have an adequate response to filter low frequency noise and the other to filter high frequency noise. As seen the parameters of the passive components are easy to find. The major factors to take into account when choosing what inductance and capacitance to use are: the quality of the output signal – the amount of output current ripple and voltage ripple; the losses due to conduction in these components; the L-C filter time constant; and the size and weight of the components. These factors can be hierarchized according to the intended application (limited space/energy). Active Components The choice of what device would serve as the switch is perhaps the most important for an efficient and reliable converter. Given the power range used in the project, two families of transistors show up as natural candidates: BJT (in particular using a Darlington structure) and power FET. Historically BJTs have smaller conduction losses; however, due to greater demand, the creation of FET devices with smaller conductive resistance was achieved. So the choice between both technologies is ultimately related with switching losses. MOSFETs can switch very quickly (up to some MHz) given a sufficiently high gate drive current. Bipolar transistors can switch even faster (base parasitic capacitance is usually much smaller than the gate parasitic capacitance); however, when operated in the saturation region these devices require the supply and removal of stored charge during each switching period, resulting in extended turn-off delay times. This has a major impact on the practical switching speed applications. Furthermore what has become evident during the search for candidate devices is that there is a much greater choice for FETs for the energy range of the experiment, in particular NMOS, which was the kind of FET used. For the other switching component – the diode – a Schottky device was used since it has a lower forward voltage drop (lower conduction losses when compared with other diodes) and virtually no switching losses (rise and fall time of the order of picoseconds). These components are usually limited to relatively small voltages, as is the case of the loads used in the experiment. Losses The minimization of losses is very important in the electronics of an experiment that is going to be operated without direct supervision. Firstly, it reduces the consumption of electric power. Secondly, it reduces heat dissipation and thus makes the electronics last longer. 41 Transistor In order to properly choose the FET for a switching regulator circuit, there are two kinds of losses that must be considered: Conduction losses are characterized by the resistance between the drain and the source. The resistance varies with two important parameters: it increases with the current drained – which is dependent on the application; and with the voltage between the gate and the source, Vgs : The higher the voltage, the smaller the resistance. Even though the threshold voltage is fairly low for some components (a large amount saturate even when controlled with TTL voltage levels), for high frequency applications the minimization of losses is important for overall power consumption and because of that, for heat management issues. 𝑃𝑐𝑜𝑛𝑑 = 𝑅𝑑𝑠𝑂𝑁 . 𝐼𝑜𝑢𝑡 2 (4.14) Since the output of the dsPic is limited to 5V and can only source up to 25 mA, a Darlington NPN BJT with an open collector (ULN2803), available in the PicNode development board, was used in order to bridge the TTL signal of the controller and the higher power requirements of the NMOS gate. This will allow for the adequate voltage amplitude to fully saturate the transistor as well as the necessary current to enable fast transitions. Fig. 31 RdsON / Id / Vgs Since the voltage at the source pin is constant, applying 12V to the gate will ensure that 𝑅𝑑𝑠𝑂𝑁 will never rise to high values, based on the figure above (taken from the datasheet of the device). The switching losses are dependent on the rise and fall times of the device, which in turn are dependent on the parasitic capacitances of the gate, source and drain. 42 These losses can take a great toll in the overall efficiency of the converter and may limit the switching frequency if high efficiency is required. In Fig.32 it can be seen the way in which energy is lost and how the transition times are important. Fig. 32 Switching losses (24) The losses associated also have an output term, which is related to the output parasitic capacitance, 𝐶𝑜𝑠𝑠 . Detailed explanations of these losses can be found at (25). 𝑉𝑖𝑛 .𝐼d 𝑃𝑠𝑤 = ( 2 ) . (𝑡𝑟𝑖𝑠𝑒 + 𝑡𝑓𝑎𝑙𝑙 ). 𝐹𝑠𝑤 + (𝐶𝑜𝑠𝑠 . 𝑉𝑖𝑛 2 . 𝐹𝑠𝑤 ) (4.15) To drive the gate, energy is required. Even though FET technology does not require additional energy once a state is achieved, it needs a charge 𝑄𝑔 if a transition is to occur. If the states are switched in a given period, 𝑡𝑡𝑟𝑎𝑛𝑠𝑖𝑡𝑖𝑜𝑛 , the expression that gives the current to feed the gate is given below: 𝑖𝑔 = 𝑡 𝑄𝑔 𝑡𝑟𝑎𝑛𝑠𝑖𝑡𝑖𝑜𝑛 (4.16) The only remark is that 𝑖𝑔 has to be below 0.5 A, which is the maximum amount of current the ULN2803 IC can drain. The currents needed to drive the FET are much smaller, so no problem should occur. To drive the gate with the required current a pull-up resistor is added — 𝑉𝑐𝑐 = 𝑟𝑝𝑢𝑙𝑙−𝑢𝑝 . 𝑖𝑔 — and the gate charge is used to find the actual transition times of the transistor. Unlike BJTs, one can assume that both the rise and fall times are similar. 𝑡𝑡𝑟𝑎𝑛𝑠𝑖𝑡𝑖𝑜𝑛 ≈ (𝑡𝑟𝑖𝑠𝑒 + 𝑡𝑓𝑎𝑙𝑙 ) = 2.𝑄𝑔 𝑖𝑔 (4.17) 43 This relation shows how the gate drive current has serious implications on the overall efficiency of the converter. Due to the necessity of very fast transitions, some unwanted effects occur. Because of the parasitic gate capacitance already mentioned and a parasitic gate inductance, high frequency and high amplitude harmonics occur. The amount of noise at the gate is then a function of the pull-up resistor. Gate driver 12V R pull-up Gate Cg Lg 2803 Fig. 33 Schematic of the gate driver and power level shifter A balance between fast transitions and perfect control of the gate is easy to find, in particular if one the parameters for the choice of the transistor was low gate capacitance. The usage of a gate resistor such as the one required to shift the voltage level is the easiest method to minimize the interference in switched power applications (26). However, since it does so by lowering 𝑑𝑖 𝑑𝑡 . In addition, a resistor in series with a capacitor is added in parallel with the source and drain of the FET. This separates and suppresses the AC transients generated by the switching. The structure of the system is shown in Fig. 43: Fig. 34 Structure of the power system 𝑃𝑔𝑎𝑡𝑒 𝑑𝑟𝑖𝑣𝑒 = 𝑉𝑐𝑐 . 𝑖𝑔 (4.18) These losses are constant during the experiment, not depending on the amount of current drained in the experiment. This leads to low efficiencies at low current power drainage. Because the energy used is not provided by the converted power source (which is important for the fuel cell regulator) it will not be accounted for in the calculation of the efficiency. 44 Diode Since the current and voltages dealt with are low enough, a Schottky diode was used. Two main advantages come from this type of diode. First, these devices the transition times can be considered instantaneous (picoseconds) and so, there is no reason to consider losses associated with switching. Secondly, when compared to regular diodes, the voltage drop is smaller; this results in fewer conduction losses. Below are the losses, which are mainly due to conduction: 𝑃𝑐𝑜𝑛𝑑 = 𝑉𝑓𝑤𝑑 . 𝐼𝑜𝑢𝑡 (4.19) Even using Schottky diodes, the forward voltage drop is still significant. Even in a first approach, this component seems to be a serious candidate to waste the greatest amount of energy. Inductor and Capacitors The only losses considered at the frequencies at which the converter is working at (around 120 kHz) are conduction losses due to the parasitic resistance present in the capacitors and inductors, ESR. In the inductors, there are also losses with the core (related with Foucault currents, hysteresis…). However no data regarding the ferrite core of the inductors is available and therefore no core losses were calculated. 𝑃𝑖𝑛𝑑 = 𝐼𝑜𝑢𝑡 2 . 𝐷𝐶𝑅 + 𝑃𝑐𝑜𝑟𝑒 Efficiency Considering 𝑟𝑝𝑢𝑙𝑙−𝑢𝑝 𝑃𝐶𝑎𝑝 = ∆𝑖 2 . 𝐸𝑆𝑅 𝜂=𝑃 𝑃𝑜𝑢𝑡 𝑜𝑢𝑡 +𝑙𝑜𝑠𝑠𝑒𝑠 (4.20) (4.21) (4.22) = 140Ω and 𝐹sw = 75 kHz. For the transistor, at the highest power consumption: 𝑃𝑐𝑜𝑛𝑑 = 0.154 W 𝑃𝑠𝑤 = 0.212 W And, converting for the duty cycle (85%), the power dissipated is then: For the diode: 𝑃𝐹𝐸𝑇 ≈ 0.311 W 𝑃𝑐𝑜𝑛𝑑 =2.68 W As there are no switching losses – the switching times are of the pico order, normalizing to the duty cycle (15%), gives the following value: 45 𝑃diode ≈ 0.40𝑊 As can be seen, even working very little in the circuit, the diode is responsible for losing the most energy. The following term includes an estimation of the losses associated with the passive components and the PCB traces in the section of this converter:(27) 𝑃rem ≈ 0.44 𝑊 Therefore the efficiency for this circuit is no greater than: 𝜂 = 0.93 Or if the gate driving power is added, 𝜂 = 0.88 This value is too high, mainly because the parameters given in the datasheet are found under very particular circumstances. They often provided low junctions temperatures (requiring large heat sinks or fans) or drain the current under very small duty cycles. Thermal Runaway This effect can be summed as an uncontrolled reaction to an increase in temperature, leading to conditions that further increase the temperature – a sort of positive feedback. The following relation is able to provide a safe operating area for the FET, based on the specifications given in the datasheet, namely the thermal resistance 𝑅𝑡ℎ and the maximum junction temperature (175ºC), and an assumed ambient temperature and current. 𝑇𝑗 −𝑇𝑎 𝑅𝑑𝑠 = 𝑅 𝑡ℎ .𝐼𝑑𝑠 2 (4.23) And the relation between the case temperature and the ambient and junction temperatures: 𝑇𝑐 = 𝑇𝑗 − 𝑇𝑎 (4.24) Below there’s the drain-source resistance as a function of the junction temperature and the drain current as a function of the case temperature. 46 Fig. 35 Rds/Junction temperature Fig. 36 Conductivity/Case temperature Solving the equation for an ambient temperature of 75ºC (case temperature of 100ºC) and 5 A the drain resistance is found to be 1.11Ω. Since that value clearly intersects the resistance curve in the graph up to the maximum junction temperature the system can be considered thermally stable. However, the values in the specification sheet may not be entirely reliable, due to very favorable testing conditions (typically very low duty cycles in gate signals). Most importantly is the fact that the switching losses are not accounted for in equation 4.24 and as such this calculation is for the best case scenario. The schematic of the buck converter is depicted in the figure below: RC snubber nmos L=300uH 5V filter CL D1 C3 Rshunt OC1 Electrolyser CH an12 F+Gain an0 Gate driver Fig. 37 Schematic of the buck converter The boxes represent auxiliary circuits such as the gate driver shown above. The others are filters circuits for data acquisition, with or without gain changes. 47 Fig. 38 Transient response - Green: load voltage; Red: load current; Purple: output capacitor current The waveform above shows a relatively quick response, taking less than a millisecond to stabilize. This will be important because of the control algorithm. 3.3 PEM Fuel Cell Power converter The circuit that regulates the output of the fuel cell is based on the typical buck converter described earlier, however, due to the load it is going to power – an magnetic motor – was altered. An electric motor is a reactive load; in particular, it can be considered the series of a resistor and an inductor. So the circuit is as shown in the schematic below: L3 L2 M1 V3 M2 2 10uH 7Vdc D1 12v C2 300u 12v 1 C3 2030u 0 Fig. 39 Schematic of the converter The main differences are the input inductance, the FET paralleled with the Schottky diode and the replacement of the buck inductor for the motor inductor. The input inductor and input capacitor protect the fuel cell against the switching transients caused by the control FET; because of the inductor present in the load, voltage will be induced and will therefore conduct charge from the ground through the diode and through the synchronizing FET. 48 The use of the FET and diode in parallel is justified with the need to reduce losses in the diode, which, as seen in the previous circuit, were the largest. The main idea behind this pair of components is to let the Schottky diode conduct during the switching period – control FET switching off and synchronizing FET switching on and vice-versa. Because having the two transistors conducting simultaneously leads to the components destruction, the gate driving signals are two complementary PWMs separated by a period called dead time, in which both FETs are not conducting. Fig. 40 Waveforms associated with the conducting components Since at the time the synchronizing FET is switching, the diode is conducting, one can consider that the synchronous transistor switches needing much less charge (the datasheet reports a decrease in charge of less than half for this circuit). Once it’s fully switched on, the diode will stop conducting since the resistance in its junction is much larger than 𝑅gs (at the current required). To further maximize the efficiency, one can minimize the switching losses (at the expense of the quality of the output signal). If the pull-up resistance is lowered it will cause the switching losses in the control FET to lower since the transitions occur faster – note that the gate driver is not powered by the fuel cell. In addition, if the frequency is lowered, the losses will decrease even further. Efficiency Considering the current drained by the engine is around 0.5 A and the power provided is around 2 W (0.3x.5x13), 𝑟𝑝𝑢𝑙𝑙−𝑢𝑝 = 120Ω and 𝐹sw = 30 kHz. If the proportion of each device is: control FET=0.80, synchronous FET=0.15 and diode=0.05, the losses occurring are: 𝑃𝐹𝐸𝑇𝑐𝑡𝑟𝑙 ≈ 9.1𝑚𝑊 𝑃𝐹𝐸𝑇𝑠𝑦𝑛𝑐 ≈ 1.2𝑚𝑊 49 𝑃diode ≈ 16.8𝑚𝑊 Not considering the gate driving losses (because they are not related with the fuel cell) and making an estimate concerning the remaining losses, the efficiency becomes: 𝜂 = 0.98 Again, this is the optimum case, not having a clear correspondence to what happens in the actual circuit. Interference caused by power circuits One of the problems when dealing with high variations of current is the change of the magnetic field associated with the current. The main source of noise in the printed circuit board (PCB) is the buck converter used to power the electrolyser — by minimizing the area of the current loops and variations in the area of the loops the amount of noise produced can be improved. The motivation behind the design can be easily seen in the following images: Fig. 41 Ground bounce [28] In addition, one must also consider crosstalk. This is done by not having the controlling signals and high current, switching signals superimposed (in different layers of the board). The ground signals of the circuits are met at only on point of the board 50 Bearing in mind the previous comments regarding noise, some other considerations regarding the capacitors locations were also taken into account. The following references were used to better design the PCB. (26, 29-32) 3.4 Data acquisition and Control The acquisition of data was done using the ADC module of the dsPic30f4013 with the proper electronics in order to filter the high frequency noise and to dimension the signals’ gain accordingly to the microcontroller input voltage range. For the automated experiment a first order low pass filter was used with a cutoff of 5 Hz. Since the two noise sources present are the 50 Hz from the mains supply and the switching at around 120 kHz, it seems adequate. Firstly, the low frequency noise is somewhat filtered with the input capacitor. The high frequency noise associated with the switching does not have a great amplitude and as such it gets proper attenuation, even with a small steep as can be seen in the bode diagram below. One of the main way in which noise affects measurements is when the power ground is connected to the digital ground. The simplicity of the filter assures no oscillation and fast step response times. Having noted that, the filters for the pulsed DC experiment used second order Sallen-Key low pass active filters because no issues with the PCB real-estate existed, and as such, the added complexity had no drawback. Below we see the schematic and the Bode diagrams for the first order active filter used: Fig. 42 Bode plots of the filter 51 If the sampled signal had an amplitude superior to 5 V, an op amp non inverting low pass filter was implemented, and the gain was dimensioned so it would fit the microcontrollers input range. Similarly, the same was done to amplify the voltage drop in the resistor that serve as current probes. 8 amplifier/reducer 5 + 7 anx 4 6 12V Fig. 43 Schematic of the filter, with variable gain To acquire the signal from the PV panel, there was no need to have a gain of 1, and therefore, the filtering consisting only of an RC filter, not connected to an op amp. PID Controller To implement a PID controller in a microcontroller, one requires the standard form of a PID controller to be discretized. The following algorithm was implemented.(33) previous_error = 0 integral = 0 start: error = setpoint - measured_value integral = integral + error*dt derivative = (error - previous_error)/dt output = Kp*error + Ki*integral + Kd*derivative previous_error = error wait(dt) goto start The controller was implemented in two situations:  To control the power supplied to the electrolyser, based on the amount of power the PV panel is at, by measuring the voltage drop across a resistor; the output of the controller will change the duty cycle of the buck converter that controls the power supplied to the device. It is, however, limited to 0.85, which in turn limits the power supplied.  To assure the cells’ voltage never go lower than 0.3 V. By keeping track of the overall voltage in the stack, the PID routine is activated if said voltage goes below 0.3 V (in average), and keeps it at that setpoint. When the duty cycle is lower than 0.03, the PWMs are switched off and no more power can be drained from the PEM stack. 52 The calibration of the constants used by the controller were found through trial and error. One of the main issues with the PID controllers was to adequately find the constants for the control, with a fairly high dt in each update (in order not to interfere with the communications with the e-lab platform). 53 Chapter 4 e-lab 4.1 Technology The software that enables the communication between the machine and the user is called the driver. The driver is a Java programmed code that allows the exchange of data and remote control, of the experimental ensemble. In e-lab’s case, a generic driver, ReC, was developed in an association between IPFN researchers and Linkare. Some advantages arise from the programming language used to code the driver. Since it runs on a JVM, which interprets the code, there is no danger of the code accessing excessive amounts of physical memory or other runtime errors; in addition it runs on all relevant devices because it is able to translate java bytecode to whatever code the device understands. The language itself provides some advantages over older ones, such as the option to program using object-oriented principles and extensive libraries. This allows easy editing, implementing new classes and interfaces easily. Other advantages come from the fact that the libraries are updated regularly with new methods, which in general provide very fast algorithms for many applications. To perform these tasks, the JVM runs the code slower than C or C++. This, however, becomes noticeable for the user only in heavier or poorly programmed applications. Some other virtual machines could be used, such as the flash player, which despite being more appealing to the consumer and as fast, have limitations on the devices they can run on. The communication protocols between the user, the software and finally the hardware are shown in Fig.44. 54 Fig. 44 Diagram of the structure of e-lab [3] As one can see, the structure of the system can be divided in three sections, each with a need to translate the instructions to the other: firstly there is the bridging between the commands of the user, coded in java, to the e-lab server. This is done using the xml file; secondly, the bridge between the computer driving the experiment and the hardware, which is done with the ReC generic driver communication protocols. The xml file is used to describe and markup data. The structure of these files - basically the order and type of data transferred - is defined in the DTD file, which can be seen as the machine's dictionary to understand the content present in the xml file. 4.2 Protocols The driver is able to communicate with the dsPic following rules that are implemented in the microcontroller’s main routine. The hardware can be in four different states: Configuring (the hardware has received the configuration instruction or is implementing the configuration); Starting (the experiment is preparing a required state for some of its devices); Started (running the experiment); Stopped (the experiment is stopped and it is waiting for a configuration). The driver has a correspondence between each of these states and states of its own, namely: Stopped; Configured; Started and Reseted. In addition, it has an Unknown state which occurs when the hardware and software do not have corresponding states, which occurs when the hardware is starting or resetting. 55 The following figure (Fig.45) shows the transitions of states occurring in the driver Fig. 45 State-machine diagram of the driver [3] (1) Transition from unknown state to stopped state only occurs when an identification message is received from the hardware indicating that it is in stopped state. (2) The driver has sent a configuration instruction to the hardware, which if it is processed correctly, both hardware and driver will transit to the configured state. If both machines are in the configured state and the driver again sends a configuration (or reconfiguration in this case) instruction to hardware both machines will stay in the same state after the correct instruction processing. (3) Driver has sent a starting instruction to hardware, which, if acknowledged correctly, both hardware and driver will transit to the started state. (4) A stopping instruction can be sent in the started state in order to put the hardware in stopped state or to stop the running experiment. (5) A stopping instruction can be sent in the configured state in order to put the hardware in stopped state. This forces the tasks performed by the microcontroller to be grouped in protocols. In the case of the automated hydrogen experiment, the protocols follow the natural structure of the system and are as follow: Protocol 1 – this protocol will comprise the operation of the LED panel and the simultaneous regulation of the power supply to generate hydrogen with the electrolyser. 56 Some parameters must be sent and received using the driver. In particular, to initialize the LED panel, a 6 bit binary variable is chosen by the user (3 bits to choose the combination of the 3 colors and 3 bits to choose one of eight different intensity levels), and another to control the electrovalves; The parameters sent from the microcontroller are the amount of gas in both columns and the instant current and voltage supplied to the electrolyser. The amount of power supplied to the electrolyser is dependent on the voltage of the PV panel, which in turn is dependent on the LED’s 6-bit binary variable. There are no preparatory stages in which the experimental devices need to be in before these tasks take place, so the starting state sets only generic pin states. This protocol ensures that the power supplied to the electroliser is shut down when the amount of hydrogen reaches a threshold value. To stop this protocol – and start the following one – the user needs to open the electrovalves. Protocol 2 – This protocol deals with the conversion of the released hydrogen to energy and power a load. The parameter required to be sent from the user is only the variable that regulates the amount of power supplied to the load; the parameters sent from the microcontroller are the amount of gas in both containers and the current and voltage supplied to the load. Because the user does not possesses the experience to properly control the beginning of the energy production, the following tasks are automated in the starting state: to guarantee the air present in the fuel cell is expelled and the inside has only hydrogen, after the user opens the valves, a set period of time passes before the valves are closed again; because after the hydrogen is injected into the cell stack, a time period of around 20 seconds must pass before energy is generated, the user will only be able to control the power after this state. After this state is completed, the user can finally regulate the power supplied to the load. This routine comprises the regulation of the control variable, in order not to drain excessive current from the cell. When the regulation of said variable sets it below a value, the experiment is stopped. 57 Fig. 46 Diagram of the states of the experiment In Fig. 46, shown above it can be seen a simplified relation of the main tasks the hardware performs. 1) After the call for protocol 1, which includes the initialization of the setup and the input of the LED panel parameters (color and intensity) the experiment powers the LED panel which calls the electrolyser power control routine as well as it initializes the volume measurements. A check for the LED parameters is done in a), which enables the control of the H2 generation rate. 2) Once the maximum volume of H2 has been achieved, with b) the setup waits for the command for the electrovalve to release the hydrogen, and with it ends the first protocol. 3) As the fuel enters the cell stack, the routine to properly start the fuel cell starts. This includes the delay required to include the starting period of the cells and the closing of the electrovalves. 4) Once the stack is outputting usable power, the user has the ability to choose the percentage of the maximum power in c). In addition, that percentage is adjusted by a voltage sensor across the first 2 cells of the stack. 5) Once the output power reaches a minimum value, the valves are opened and the experiment ends. 4.3 User Interaction The interaction between the user and the experiment can be divided in two parts. Firstly there is the e-lab GUI which has been mentioned previously. It possesses the following features:  Real time video streaming of the experiment apparatus;  Panels to choose the required parameters;  Plots that show the behavior of the relevant measurements (current, voltage, volume). Secondly, the wiki page which serves to introduce or explain the phenomena witnessed with the e-lab platform. 58 It explains the basic concepts of energy storage and the basic functioning behind the hydrogen technologies used in the experimental setup. To ease the understanding of the experiment, an animation was produced, which depicts the transference of energy from the various media found in the setup. Fig. 47 Frame of the experiment’s animation In Fig.47 one can see a frame of said animation, with the simplified representation for each of the fundamental particles that form the process. 59 Chapter 5 Study on the performance of pulsed electrolysis The motivation to study the efficiency of an electrolyser under a pulsed DC regime comes from two distinct phenomena which occur at different scales. Firstly there are mass transfer losses. These are related with the formation of oxygen at the anode of the electrolyser and the subsequent loss of active area for water to undergo electrolysis. Even though these losses are most prominent at higher current densities, they are present at all operating conditions of the electrolyser. Since the electrolyser worked in the ohmic region – which is by definition not greatly affected by other losses than those by conduction – no visible gain made should be made on the minimization of mass transfer losses. Secondly there is the double layer effect. As seen in chapter 3, the thickness of the layer is related to an increased potential. The minimization of the layer should bring a greater efficiency to the process, namely by reducing the amount of particles that form the layer. The double layer formed adds a capacitive signature to the electrolyser’s transient response, which includes the electrostatic capacitance, responsible primarily for the existence of the double layer; and possibly an electrochemical (or Faradaic) capacitance, which occurs because of the electron charge transfer between the electrode and formed products (hydronium ions) at the cathode. 5.1 Background To better understand the experimental effort towards the study of water electrolysis with a pulsed DC power supply, a brief description of the background and current state of the technique will be made. Most of the experiments and results shown below refer to water electrolysis using an alkaline electrolyser or aluminum plates as the electrodes. This is due to the fact that Proton Exchange Membranes are somewhat recent. However there is a substantial amount of results that is useful because it shows the interaction between the electrodes and water solutions. The study of pulsed electrolysis has its motivation on the beginning of the 1900’s when Helmholtz discovered the existence of a capacitive behavior on the surface of electrodes in water solutions. He claimed that the capacitance gathered a layer of charged ions in the immediate vicinities of the electrode and faded as the distance increases. 60 In later years the model for the double layer was further refined and so was the interaction between electrodes and electrolyte. Since the 1950’s, Bockris made advances in the electrochemistry description of the reactions occurring as well as a description of the behavior of the transient associated with the interruption of power of the electrodes. In 1952, Bockris et al [38] described in great detail the cathodic interaction between several charged metals (including Pt) and hydrogen in water and water solutions. The H3O+ ion’s interactions with various types of metal electrodes were described, and it was assumed to be the particle that formed the double layer. In [39] Bockris et al studied the double layer in greater detail, by measuring the dielectric constant (proportional to the capacitance) as the distance to the electrode increased. The second layer at the interface was further divided base on the evolution of the dielectric constant. Fig. 48 a) Dielectric constant/distance b) potential/distance (39) In Fig. 48, it can be seen the dielectric constant a) and potential b) variations with the distance to the electrode. Transients associated with the formation of the double layer are reported by Bockris et al [40]. A short current spike was reported when the potential was interrupted; it was suggested as being an effect of the discharge of the H3O+ ions, which formed the layer, in the absence of an external applied field. Similar transient responses were observed in other electrochemical systems by Mamantov et al in [41] and by Conway et al in [42]. 61 Fig. 49 Current transient [42] The motivation for pulsed electrolysis was to explore this transient and to possibly perform electrolysis on water, when the double layer is still forming or not formed at all – thus reducing the amplitude of the applied voltage. In 1984 [43], Tseung compiled some of the conclusions made in previous works, where he claimed that the transient current in the electrodes is the maximum attainable current because it utilizes the maximum available electrode area. This however, only seems to offer an advantage in regard to the minimization of mass transfer losses. Previously, in 1979 a numerical method that simulated the phenomena is reported in Electrolysis by intermittent potential. [35] The results reported show that the limiting current densities under any pulsed DC regime tend to the equal the DC limiting currents, never surpassing it. The conclusion of this work is that the maximum rate of electrolysis under any non-DC mass transfer controlled conditions cannot exceed that of DC electrolysis. In 1994, experimental results were reported by Shaaban, AH, where the conclusions were in conflict with past experimental reports, as seen in the background report made above. [34] The hydrogen generation rate was used to compare several modes of operation in the electrolyser, namely the amount of power supplied, the frequency of the pulse and the duty cycle of the pulse. In none of the tests was there evidence of the pulsed DC mode being more efficient than the baseline DC electrolyser performance. In addition, for lower frequencies, it was found an increase in the energy consumption of the device. The pulsed signal ranged from 10 Hz to 25 kHz and up to 80 W. 62 Fig. 50 Waveforms for Fpulse=25 kHz, DC=0.80. Toff=32us. Fig. 51 Power demand vs Pulse frequency. In 2006, experimental results were published by Hotta, O. et al (2006), in which an alkaline electrolyser was powered with a pulsed DC signal ranging from 2 kHz to 25 kHz.[15] The apparatus used was able to produce a duty cycle of around 0.75% at the highest frequency used (25 kHz).It was claimed that very short pulses would serve to avoid the double layer effect, and thus minimize the losses associated with the increase it made in the overpotential. As can be seen below, only one of the tests was able to produce higher efficiencies than that of the DC case. 63 Fig. 52 Power vs Efficiency. Below are the waveforms of both current and voltage in the successful test: Fig. 53 Waveforms for the current and voltage of the applied signal. In 2012 an experiment aimed to measure the efficiency of an electrolyser composed of two aluminum plates as electrodes in An Investigation into the Electrical Impedance of Water Electrolysis Cells – With a View to Saving Energy.[36] The main focus of the work was to minimize the impedance of the cell by way of finding the distance that optimized the mechanical resonance of the ensemble. The electrodes were fed with a pulsed DC power source, with a variable frequency with Duty Cycle of 50%. Note that the current is, by way of the Faraday’s Law, proportional to the hydrogen quantity produced per second. 64 Fig. 54 Variation of current across the electrodes vs frequency. It was then claimed that for each distance between the electrodes, an optimal frequency existed and it was speculated that the same would occur for other electrolysers. An important aspect that would have been interesting is the actual hydrogen generation as a function of the applied frequency. No comments on the shape of the waveform were made. 5.2 Apparatus and measurements The experimental apparatus shared all of its elements with the automated experiment for e-lab described in the previous chapters, with the exception of the printed circuit board which had to be made specifically for this purpose. Fig. 55 Schematic of the Switched step down converter and gate driver circuit. 65 8 amplifier/reducer 5 + 7 anx - 4 6 12V Fig. 56 Second order Sallen-Key Low Pass filter, with gain. Basically the idea behind the circuit is to turn on and off the output of a switched mode power supply, in a set frequency and duty cycle. As in the previous chapter, a step down converter is used, controlled by a square wave signal applied to the gate of the left FET (FET1), which regulates the amplitude of the voltage at the output. The second FET (FET2), farthest to the right, is controlled by another square wave signal, which will give the shape of the output signal. For the proper operation of the circuit, the frequency of the signal controlling FET1, the inductance of L and the capacitance of Cout were found. The time constant associated with the L-C filter must be small enough so that it regulates the output voltage every time the FET2 is set to conduct. In order to assess the time base at which both FETs must switch the following simulation was done, showing the waveforms of the step down converter at Fsw=116kHz, L=25uH and Cout =20uF. The result is shown in the next image. 66 Fig. 57 Red:Load Current; Green: Load Voltage; Purple: Cout current; DC=0.8 We can see that the signal is considered stabilized when the AC current that goes through Cout is zero. This takes place at t=160µs, however much earlier the signal can be considered usable for the intended purposes. Note that any parasitic resistance associated with the PCB traces and other components equivalent series resistance dampens the RLC oscillation faster and thus makes the signal stabilize faster. Following that, the frequency of the FET2 will produce very good signal if kept under 6.250KHz, at the worst case. The readings of the voltage and current were done using non-inverting low pass active filters, with an amplifying feedback loop for the current, much like in the previous chapters. The resistance of the current measuring resistor – Rshunt–was minimized in order to lessen the voltage drop. Since the electrolyser worked at currents of 4 A, an 18 mΩ was used. The voltage drop was of 72 mV at most and further results were corrected taking this into account. During the tests, due to less than ideal grounding, a noise source associated with the switching of FET1 was present. Because of that, digital low pass filters were used upon data treatment to further clean the signal. The analog filters were second order Sallen-Key low pass filters, as shown in the previous chapter. The volume acquisition was done using the input capture module of the microcontroller. However, since the dsPic’s peripherals – output compare and input capture – can only be clocked by two timers (tmr2 and tmr3), and two independent square waveforms are used to control the FETs, it was arranged that one timer would be shared. This would mean that the period of one timer, which set the frequency of the square wave, would be the same for the input capture. Since the pulsing signal would be required to change frequency often, in addition to being the most sensitive parameter of the experiment. Because of that, it was defined 67 that the power controlling signal would share the timer with the input capture, since it has a fixed frequency. Observations showed that at the frequencies first used to control the step down converter – 300+ kHz – the input capture module could not acquire the required amount of counts to make a proper reading of the volume. To bypass this problem and still maintain a good quality to the signal, each time a volume measurement function was called, the period of the timer was set to lower frequencies, while still maintaining the duty cycle. This adds a small perturbation, adding a larger ripple to the current exiting the inductor and headed to the output capacitor. Having noted that, the output signal didn’t seemed to show any change and the volume readings seemed fit to be used in the experiment. To measure the time lapse since the start of each test, a 32-bit timer was set, composed of the timer 4 and timer 5. The need for a 32 bit timer came from the fact that a 16 bit timer would only measure durations of about half a second at the highest prescaler value – which was far from what was needed. The clock seemed to lose about a second in 10 minutes, when compared to an external timer, which seemed accurate enough to the experiment. Constant DC The first set of tests aimed to measure the performance of the electrolyser when supplied with constant DC power. This baseline performance was found because based on the literature, where it was the natural benchmark to compare the results of these experiments. In Fig. 58 and Fig. 59 we can find the calibration between the duty cycle (in steps of 1%) of the square wave that controls the step up converter and the current and voltage of the electrolyser. The values of the duty cycle are only depicted after a certain threshold current, where the electrolyser actually serves as a load (current greater than zero). 68 Fig. 58 Duty cycle vs Current Fig. 59 Duty cycle vs Voltage As can be seen in Fig. 60 the data acquired shows that the current and voltage varies linearly after being in the ohmic region, and Fig. 60 depicts that. Fig. 60 Current-Voltage Characteristic 69 Note that the linear fit was made in the ohmic region; the equation of the fit is quite similar to the one using the 3005 power supply in the first performance curves taken. This validates the acquisition of data made by the microcontroller. Lastly there’s the relation between the power and the hydrogen flow. To find the flow, a scatter of the volume and time was made. Below we have a typical result of these acquisitions. Notice that once the volume of hydrogen reaches 28ml it stabilizes and any excess hydrogen exits through the connection to the water tank. Fig. 61 Volume vs Time Clearly in Fig. 61 a linear fit in the linear region is the best fit, and the slope found is considered the mean hydrogen flow. One can observe some minor variations on the volume readings, which are justified because of the existence of water in the tubes that allow the gases to exit. This causes bubbles which deter a continuous hydrogen transport. However, as a whole, the plots contain a good measure of the electrolyser’s gas production. Having done that for all steps in the duty cycle sweep, the following scatter was found. Fig. 62 DC Flow 70 It’s clear to see in Fig. 62 that the furthest the samples get from the theoretical line (calculated in the apparatus chapter), the least efficient the process becomes. The offset to the theoretical line seems to have a linear nature as well, which makes sense, as it is a product of the voltage/current curve – which is itself a straight line. Below we have the efficiency, calculated for each sample and the corresponding theoretical maximum for its power. Fig. 63 Electrolyser’s efficiency This plot in Fig. 63 shows an interesting insight to the performance of the electrolyser. It validates the high performances claimed by their manufacturers, showing that hydrogen can be produced with efficiencies close to 80%. As the flow is required to be higher, there will be more losses (tied mainly to the conduction losses of the charge carriers) causing a drop in the overall efficiency. It is expected that the efficiency lowers even further at higher power ratings because mass transport losses are inevitable. 71 Pulsed DC The first set of tests aimed to measure the impact of the square wave’s frequency, DC=0.5, on the production of hydrogen, while keeping the power constant. In Fig. 64for a Duty Cycle of 0.80 at 6W was applied to the electrolyser. Other signals were also tested and showed a similar, yet less visible pattern. Fig. 64 Flow response to various frequencies There was a range of frequencies that seemed to be favorable to the production of hydrogen, however after a more detailed search, no evidence of a maximum point for hydrogen production was found. Even so, it was observable that outside this band [1.5, 15] (kHz) the generation of hydrogen was severely affected. The next thing was to find variation of the hydrogen generation rate based on the variation of the duty cycle of the pulsing signal. This was done for several frequencies, between 900 Hz and 40 kHz and the results are shown below. These results were fitted to the surface found in Fig.65. The box is bounded by the DC result data - the H2 flow in the DC case is around 0.7 ml/s – and this value is never reached. 72 Fig. 65 Fitted surface of the data for V=4 volt. The duty cycle goes up to 0.99. Fig. 66 Flux vs Duty Cycle profile of the experimental data The profile of the surface was compared with the efficiency found in Fig. 68 (converting the Duty Cycle at 4V to watts, using the V-I characteristic of the electrolyser). For all the sampled data, there wasn’t a single pulsed regime which was more efficient than the DC operating mode. This implies that part of the energy provided to the electrolyser is used in non-ohmic processes. In fact, this can be seen in the signals at the output of the device. 73 Variable Power The next set of tests intended to submit the electrolyser to a variable power regime. Two waveforms were chosen, a saw tooth wave and a sine wave. These waveforms were generated by varying the duty cycle inside a loop, according to the equation of the corresponding shape. To find the average power of the signals the root mean square (RMS) of the waves has to be found. 𝑅𝑀𝑆𝑆𝑎𝑤𝑡𝑜𝑜𝑡ℎ = Thus the average power of a waveform is: 𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒 √3 𝑃𝑜𝑤𝑒𝑟𝐴𝑣𝑔 = 𝑉𝑅𝑀𝑆 𝐼𝑅𝑀𝑆 (5.1) (5.2) In Fig.67 we can observe one of the tests, with the volume variation on top, followed by the current and voltage measurements. Fig. 67 Sample taken from a saw tooth test For the tests done, using different periods for the waves, ranging from 0.08 Hz to 2 Hz, it was observable that the efficiency would increase to near the constant DC levels, as the period decreased. One can observe the variation of the flow as the power changed. The mean flow was found by doing the same as in the previous tests. No measurement of an efficiency superior to the DC case was made; however these waveforms seem promising for operating regions where mass transfer losses occur. In particular because one can avoid having the device discharge the double layer, with all the implications found before. 5.3 Discussion The following waveforms (seen in Fig. 69) are generated by simulating the whole circuit seen in Fig. 68, at a pulsing frequency of 2.5 kHz. 74 Fig. 68 Schematic of the circuit when the load is purely resistive Fig. 69 Waveforms of the previous circuit (purple=current) These waveforms seem very distant from the ones that were captured in the scope – which can be seen in Fig. 70: Fig. 70 Current transient at Fsw = 2.5 kHz (black lines showing the pulse start and stop instants) One can observe that each time the electrolyser’s power is disconnected, a current spike occurs, consequence of the charged particles that form the double layer abandoning the cathode. This can be seen clearly in Fig. 71. 75 Fig. 71 Current transient at Fsw = 900 kHz For lower frequencies it was observed that, like in Shaaban, AH [34], the electrolyzer draws much more current, and consequently greater power, at lower frequencies. It does not, however, seem to produce relatively greater amounts of hydrogen. Simulating an equivalent circuit, in the Fig.72 where the electrolyser is formed by a resistor paralleled with a capacitor, gives the following waveform: Fig. 72 Schematic using an ohmic load with a capacitive component Fig. 73 Corresponding waveforms As can be seen in Fig. 73, the charge/discharge pattern is quite similar to the one seen, with the exception of the high current spike. This could be explained by the porous nature of the electrode, which constraints the positive ions to exit the vicinities of the electrode, as stated in [11, 12] and 76 therefore inhibit the electrons that form the first layer to present a typical exponential discharge, when returning through the connecting diode and to the current probe. One can see by the purple line – the current that is provided by the battery – that whatever charge is used to form the double layer is not used by the ohmic load, which means that water electrolysis does not occur fully until then. When the layer is discharged, the H3O+ ions (protons in their water form) that form the second layer have two options: either they diffuse in the water or migrate across the membrane via the Grothuss mechanism. If all the ions in the double layer were to diffuse across the membrane they would meet with electrons at the anode (at any potential) and form hydrogen in direct proportion to the current measured at the anode. However, this does not occur, which indicates that a part of the ions in the double layer, and the energy invested in its formation, are wasted. The higher energy requirements of the electrolyser at lower frequencies may be explained by a capacitive transient caused by the double layer formation. It does not seem to have a relation with the diffused protons arriving at the anode, since no extra hydrogen production was verified. 77 Chapter 6 Conclusions During the construction and tuning of the experimental setup, the greatest difficulty found was to have the apparatus functioning without the need of human supervision. The issues found are not present in larger applications because auxiliary devices are used. In this case, the most important device would be a compressor, to increase the pressure of the hydrogen in the cell stack and to perform purges of excess water. This added pressure, however, would require the storage containers and overall tubing to be much more robust, and along with the added complexity, it was found that even at the cost of a smaller efficiency, the compressor was not mandatory. During the recovery of the fuel cell stacks found in the laboratory, it was found that the recovery of devices presenting very feeble performances is usually possible. The main issues holding back the stack are usually an overall lack of hydration and poor catalyst placement or an individual cell with severe damage, which needs to be excluded from the stack. During the pulsed electrolysis tests, it was concluded that the electrolyser had fewer losses in the DC regime than all of the other tested conditions. This was explained by the existence of the double layer, which exhibited a capacitive behavior. The layer was formed when the potential was applied, using energy meant to electrolyze water in the gathering of ions. When the potential was discontinued, those charges were partially discarded the corresponding hydrogen could not be formed. Observing the behavior of the electrolyser under the pulsed DC tests, one could conclude that the hydrogen production occurs even when fed with non-uniform power sources, being able to receive high current densities, which makes it an ideal candidate to receive the variable output available from various special production regime energy sources. For systems including hydrogen technologies and dynamic applications, controllable power conversion seems to be a requirement – both for the electrolyser and fuel cell – because there is the possibility of matching the impedance between power and load, and thus minimize losses. For efficiency purposes, the choices on the active devices in switched power conversion and circuit architecture are of paramount importance. The amount of losses generated by conduction and switching can be, using inadequate devices, superior to the energetic waste of hydrogen leakage. Still regarding the switched converters, due the effects present during its operation – ground bounce, EMI, (…) – the PCB design must be carefully planned, in particular when there are sensitive devices such as microcontrollers, which require stable supplies. 78 Finally, it would be interesting to have the application sending the data from each of the tests performed by the user of e-lab, to an external text file. Over time, valuable data would be gathered, showing the evolution of the PEM evolution until reaching failure, without any significant investment – only the disk space in the application server. 79 References 1. Portal ERSE. Available from: http://www.erse.pt/pt/Paginas/home.aspx. 2. [cited 2013-2014]. Available from: http://www.ree.es/en/red21/energy-storage. 3. Henriques RB, Duarte AS, Fernandes H, Pereira T, Fortunato J, Pereira J. Generic protocol for hardware control @ e - lab. 1st Experiment@ International Conference; Gulbenkian, Lisbon, Portugal17-18 Nov, 2011. 4. P. B. Henriques, Hydrogen Storage for Intermittent Power Sources, 2012 5. Blinov A, Andrijanovits A. New DC/DC Converter for Electrolyser Interfacing with Stand-Alone Renewable Energy System. Electrical, Control and Communication Engineering. 2013;1(1):24–9. 6. Belvedere B, Bianchi M, Borghetti A, Nucci CA, Paolone M, Peretto A. A MicrocontrollerBased Power Management System for Standalone Microgrids With Hybrid Power Supply. IEEE Transactions on Sustainable Energy. 2012;3(3):422-31. 7. Andrijanovitš A, Egorov D, Lehtla M, Vinnikov D. New Method for Stabilization of Wind Power Generation Using Energy Storage Technology2010. 8. Henriques P. Hydrogen Storage for Intermittent Power Sources: IST-UTL; 2012. 9. Tian N, Zhou ZY, Sun SG, Ding Y, Wang ZL. Synthesis of tetrahexahedral platinum nanocrystals with high-index facets and high electro-oxidation activity. Science. 2007;316(5825):7325. 10. Papagiannakis I. Studying and Improving the Efficiency of Water Electrolysis Using a Proton Exchange Membrane Electrolyser: Faculty of Mechanical Engineering in Strathclyde University; 2005. 11. Rasten E, Hagen G, Tunold R. Electrocatalysis in Water Electrolysis with Solid Polymer Electrolyte. Electrochimica Acta. 2003;48(25-26):3945-52. 12. Pell WG, Conway BE. Voltammetry at a de Levie brush electrode as a model for electrochemical supercapacitor behavior. Journal of Electroanalytical Chemistry. 2001;500(1-2):12133. 13. Mazloomi K, Sulaiman N, Moayedi H. Electrical Efficiency of Electrolytic Hydrogen Production. Int J Electrochem Sci. 2012;7:3314-26. 14. Harrison KW, Remick R, Martin GD, Hoskin A. Hydrogen Production: Fundamentals and Case Study Summaries. 18th World Hydrogen Energy Conference Essen; Germany2010. 15. SHIMIZU N, HOTTA S, SEKIYA T, ODA O. A novel method of hydrogen generation by water electrolysis using an ultra-short-pulse power supply. Journal of Applied Electrochemistry. 2006(36):419-23. 16. Bove R, Ubertini S, Winkler W, Nehter P. Thermodynamics of Fuel Cells. Modeling Solid Oxide Fuel Cells. Fuel Cells and Hydrogen Energy: Springer Netherlands; 2008. p. 13-50. 17. Borup R, Meyers J, Pivovar B, Kim YS, Mukundan R, Garland N, et al. Scientific aspects of polymer electrolyte fuel cell durability and degradation. Chem Rev. 2007;107(10):3904-51. 18. Kreitmeier S, Schuler GA, Wokaun A, Büchi FN. Investigation of membrane degradation in polymer electrolyte fuel cells using local gas permeation analysis. Journal of Power Sources. 2012;212:139–47. 19. Kreitmeier S. Local Degradation of the Membrane and Catalyst Support in Polymer Electrolyte Fuel Cells: ETH Zurich; 2013. 20. Lin R, Li B, Hou YP, Ma JM. Investigation of dynamic driving cycle effect on performance degradation and micro-structure change of PEM fuel cell. International Journal of Hydrogen Energy. 2009;34(5):2369-76. 80 21. Travassos MA, Lopes VV, Silva RA, Novais AQ, Rangel CM. Assessing cell polarity reversal degradation phenomena in PEM fuel cells by electrochemical impedance spectroscopy. International Journal of Hydrogen Energy. 2013;38(18):7684–96. 22. Zhang J. PEM Fuel Cell Electrocatalysts and Catalyst Layers: Fundamentals and Applications: Springer; 2008. 23. Irwin JD. Power Electronics Handbook. 3rd ed. 24. APPLICATION NOTE 4266 Maxim Integrated-An Efficiency Primer for Switch-Mode, DC-DC Converter Power Supplies2008. Available from: http://pdfserv.maximintegrated.com/en/an/AN4266.pdf. 25. Orabi M, Abou-Alfotouh A, Lotfi A. Coss Capacitance Contribution to Synchronous Buck Converter Losses. Power Electronics Specialists Conference; Rhodes: IEEE; 2008. p. 666-72. 26. Taylor R, Manack R. Controlling switch-node ringing in synchronous buck converters. Analog Applications Journal. 2012:1-7. 27. . Available from: http://mustcalculate.com/electronics/pcbtraceproperties.php. 28. AN-640-Understanding and Minimizing Ground Bounce. In: style=&quot;font-size: 11.5992px ldd-aqqd-c-wqqd-f-nqHqdqlq, sans-serif f-f, 504.749px l, 179.653px t, transform: rotate(0deg) scale(0.939018, 0px t-o, et al., editors. 2003. 29. PCB Design Guidelines For Reduced EMI. In: Incorporated TI, editor. 1999. 30. Zhang HJ. PCB Layout Considerations for Non-Isolated Switching Power Supplies. Linear Technology. 2012. 31. style=&quot;font-size: 13.3333px ldd-aqqd-c-wqqd-f-nqHqdqlq, sans-serif f-f, 367.183px l, 1133.17px t, transform: rotate(0deg) scale(1.08324, 0px t-o, et al. AN-1149 Layout Guidelines for Switching Power Supplies1999 - revised 2013. 32. Cooper C. Choosing the right input caps for your buck converter2007. 33. PID process control, a “Cruise Control” example 2009. Available http://www.codeproject.com/Articles/36459/PID-process-control-a-Cruise-Control-example. from: 34. Shaaban A. Pulsed DC and Anode Depolarization In water electrolysis for Hydrogen Generation. Civil Engineering LaboratoryTyndall Air Force Base. 35. Viswanathan K, Cheh HY, Standart GL. Electrolysis by intermittent potential. Journal of Applied Electrochemistry. 1980;10(1):37-41. 36. Mazloomi K, Sulaiman N, Moayedi H. An Investigation into the Electrical Impedance of Water Electrolysis Cells – With a View to Saving Energy. Int J Electrochem Sci. 2012;7:3466-81. 37. Leighty W, Holloway J, Merer R, Somerday B, San Marchi C, Keith G, et al. Compressorless hydrogen transmission pipelines deliver large scale stranded renewable energy at competitive cost. 16th World Hydrogen Energy Conference; Lyon France2006. p. 1-14. 38. J. O'M. Bockris. The mechanism of the cathodic hydrogen reaction evolution. 1952 39. B. E. Conway, J. O'M. Bockris and I. A. Ammar . The dielectric constant of the solution in the diffuse and Helmholtz double layers at a charged interface in aqueous solution1951,47, 756-766 40. J. O'M. Bockris, EC Porter. The Mechanism of Hydrogen Evolution at Nickel Cathodes in Aqueous Solutions. 1952 41. Mamantov, G.; Jenkins, H.W.; Manning, D.L. Exchange Current Measurements on the NickelNickel Couple in Molten Fluorides. 1967 42. B. E. Conway, B. MacDougall and H. A. Kozlowska . Anodic Displacement of Adsorbed H in Electrochemisorption of Organic Molecules at Platinum. 1972 81 43. A. C. C. Tseung. Gas evolution on porous electrodes. Journal of Applied Electrochemistry July 1985, Volume 15, Issue 4, pp 575-580 44. P. B. Henriques, Hydrogen Storage for Intermittent Power Sources, 2012 82 Appendices A1. Program used in the Pulsed electrolysis tests #include <p30f4013.h> #include <stdio.h> #include <libpic30.h> #include <uart.h> #include <timer.h> #include <string.h> #include <xc.h> #include <math.h> //Configuration bits _FOSC(CSW_FSCM_OFF & XT_PLL16); _FWDT(WDT_OFF); //watchdog timer off //global variables //uart char RXbuffer[80]; //buffer used to store characters from serial port int str_pos = 0; //position in the RXbuffer //OC float DCsw=0.5, DCp=0.5; int Tsw=250, Tp=1700;//1us=~30 cycles swFre=117kHz //IC int counts1=0, cap1=0,cap2=0, counts2=0; void uart_init(){ U2MODEbits.UARTEN=1; U2MODEbits.USIDL=0; U2MODEbits.LPBACK=0; U2MODEbits.ABAUD=0; U2MODEbits.PDSEL=0; U2STAbits.UTXISEL=0; U2STAbits.UTXBRK=0; 83 U2STAbits.UTXEN=1; U2STAbits.URXISEL=1; _U2RXIE = 1; U2BRG=15; __C30_UART = 2; } void clear_uart(){ int i; str_pos = 0; for(i=0;i<80;i++){RXbuffer[i] = '\0';} } void __attribute__((interrupt,auto_psv)) _U2RXInterrupt(void){ //LED1 = !PORTBbits.RB4; IFS1bits.U2RXIF = 0; // Read the receive buffer until at least one or more character can be read while(U2STAbits.URXDA){ RXbuffer[str_pos] = U2RXREG; str_pos++; if(str_pos >= 80){str_pos = 0;} } } void oc_init(){ //make c13 & c14 pins output TRISDbits.TRISD0 = 0; TRISDbits.TRISD1 = 0; PR2=Tsw; PR3=Tp; TMR2=0; TMR3=0; OC1CONbits.OCTSEL = 0;//tmr2->buck OC2CONbits.OCTSEL = 1;//tmr3->pulse OC1R=0; 84 OC1RS=(int)Tsw*(1-DCsw); OC2R=0; OC2RS=(int)Tp*(1-DCp); //continuous pulses OC1CONbits.OCM=0b101; OC2CONbits.OCM=0b101; T2CONbits.TON=1; // Enable timer 2 T3CONbits.TON=1; // Enable timer 3 } void t45_init(){ T4CONbits.T32= 1;//32bit operation ->erro na datasheet: T45 PR4=0xFFFF; PR5=0xFFFF;//max period for the 32 bit clock: 2^32 cycles T4CONbits.TCKPS= 2; // prescale 1:8 -> timer4 increments once every 267ns @29.491MIPS T4CONbits.TON = 0;//stop any activity in both timers T5CONbits.TON = 0; TMR4=0;TMR5=0,TMR5HLD=0; } void capinit1(void){ IPC0bits.IC1IP = 1; //level 1 priority IFS0bits.IC1IF = 0; //clear IEC0bits.IC1IE = 1; the IC1 interrupt status flag // Enable IC1 interrupts IC1CONbits.ICM = 3; //capture edge every rising edge IC1CONbits.ICI = 3; //interrupt on every capture IC1CONbits.ICTMR = 1; //used tmr2 IC1CONbits.ICSIDL = 0; IPC0bits.IC1IP = 1; //level 1 priority IFS0bits.IC1IF = 0; //clear IEC0bits.IC1IE = 1; the IC1 interrupt status flag // Enable IC1 interrupts TRISDbits.TRISD8=1; // Make RD8/ IC1 pin as an imput 85 } void __attribute__((interrupt,no_auto_psv)) _IC1Interrupt (void) { cap1=IC1BUF; cap2=IC1BUF; IFS0bits.IC1IF = 0; //limpa a flag de interrupcao } void ICSample(){ //period needed for IC to function correctly PR2=1500;//fsw=20kHz OC1RS=(int)1500*DCsw;//maintain duty cycle if(cap1==0&&cap2==0){//bad captures __delay32(30);//~1us } if(((cap1==0)&&(cap2!= 0))||(cap1>cap2)){// prevents negative values for cap2 T2CONbits.TON = 0; TMR2=0; T2CONbits.TON = 1; } PR2=Tsw; OC1RS=(int)Tsw*(1-DCsw); IC1CON = 0x0000;//capclear capinit1(); counts1=(cap2-cap1); } void configure_adc(){ // ADC 12-bits ADCON1bits.ADON=1; //**A/D Operating Mode bit**// ADCON1bits.ADSIDL=0; //**Stop in Idle Mode bit**// ADCON1bits.FORM=0; //**Sata Output Format bits**// ADCON1bits.SSRC=7; //**Conversion Trigger Source Select bits**// ADCON1bits.ASAM=0; //**A/D Sample Auto-Start bit**// 86 ADCON1bits.SAMP=0; //**A/D Sample Enable bit**// ADCON2bits.VCFG=0; //**Voltage Reference Configuration bits**// _CSCNA=0; //**Scan Input Selections for CH0+ S/H Input for MUX A Multiplexer Setting bit**/ _BUFS=0; //**Buffer Fill Status bit**// _SMPI=0; //**Sample/Convert Sequences Per Interrupt Selection bits**// _BUFM=0; //**Buffer Mode Select bit**// _ALTS=0; //**Alternate Input Sample Mode Select bit**// _SAMC=3; //**Auto Sample Time bits**// _ADRC=0; //**A/D Conversion Clock Source bit**// _ADCS=20; //**A/D Conversion Clock Select bits**// _CH0NB=0; //**Channel 0 Negative Input Select _CH0SB=0; _CH0NA=0; _CH0SA=0; } void configure_adc_channel(int channel){ TRISB |= (1 <<channel); // ADC_CHANNEL defined as input ADPCFG &= ~(1 <<channel); // ADC_CHANNEL defined as analog } int read_adc(int channel){ int x; _CH0SA = channel; _SAMP=1; while(_SAMP); while(!_DONE); x=ADCBUF0; return x; } int main(void){ oc_init(); 87 uart_init(); capinit1(); configure_adc(); configure_adc_channel(1); configure_adc_channel(2); t45_init(); float v,i, vol; int j=0; double Fp; /*main loop*/ // while(1){ // //// T4CONbits.TON = 1;//start measuring time //// ICSample(); //// //// printf("%d %1.5f s\n",counts1, 0.142857*TMR5);//each TMR4 cycle takes 142ms @1:8 prescaler //// __delay32(9830333);//volume sampling rate @ 3sps //// // OC1RS=Tsw*(1-DCsw); // } //int n=0, N=100; // // while(1){ __delay32(30000); // // // Update duty cycle // n = n + 1; // if (n >= N) n = 0; // DCsw = 0.9 - 0.25*n/N; // // OC1R = 0; // OC1RS = 10+(1-DCsw) * (Tsw); /*measure dc in ~4 sec*/ // j++; // while(j>40){ 88 // DCsw=DCsw+0.01;j=0; // } T4CONbits.TON = 1;//start measuring time T5CONbits.TON = 1; while(1){ v=read_adc(1)/819.0+0.01;//c3 i=(read_adc(2)/(819.0)+0.01)/(21.4*0.018);//c4 vol=-0.0293*counts1+73.19; Fp=1/(Tp*33.9E-9); ICSample();//take sample of volume //printf("%f %1.3f %1.3f %1.5f \n",DCsw ,v, i,v*i);//each TMR4 cycle takes 142ms @1:8 prescaler printf("%1.3f %1.3f %1.3f %1.3f %1.3f %1.3f %d %1.3f\n",DCsw, DCp, Fp, v, i, vol, counts1, 0.142857*TMR5); PR3=Tp; OC2R=0; OC2RS=(int)Tp*(1-DCp); if(RXbuffer[str_pos-1] == 97){//a DCsw=DCsw+0.01;//sweep power clear_uart(); } if(RXbuffer[str_pos-1] == 100){//d DCsw=DCsw-0.01;//sweep power clear_uart(); } if(RXbuffer[str_pos-1] == 119){//w Tp=Tp+1;//sweep pulse freq clear_uart(); } if(RXbuffer[str_pos-1] == 115){//s 89 Tp=Tp-1;//sweep pulse freq clear_uart(); } if(RXbuffer[str_pos-1] == 103){//f Tp=Tp+100;//sweep pulse freq clear_uart(); } if(RXbuffer[str_pos-1] == 104){//g Tp=Tp-100;//sweep pulse freq clear_uart(); } if(RXbuffer[str_pos-1] == 105){//j DCp=DCp+0.01;//sweep pulse freq clear_uart(); } if(RXbuffer[str_pos-1] == 106){//k DCp=DCp-0.01;//sweep pulse freq clear_uart(); } if(RXbuffer[str_pos-1] == 13){//enter TMR5=0;//reset timer clear_uart(); } __delay32(3000000);//~0.1 sec delay } } 90 A2. Functions used in the e-lab experiment #include #include #include #include #include #include #include #include <p30F4013.h> <stdio.h> <libpic30.h> <uart.h> <timer.h> <string.h> <xc.h> <math.h> #define LED_R LATBbits.LATB8 //C9 #define LED_G LATBbits.LATB9 //C10 #define LED_B LATBbits.LATB10 //C11 #define valve LATBbits.LATB11 //C12 _FOSC(CSW_FSCM_OFF & XT_PLL16); _FWDT(WDT_OFF); //watchdog timer off /*uart*/ char RXbuffer[80]; int str_pos = 0; //buffer used to store characters from serial port //position in the RXbuffer void uart_init(){ U2MODEbits.UARTEN=1; U2MODEbits.USIDL=0; U2MODEbits.LPBACK=0; U2MODEbits.ABAUD=0; U2MODEbits.PDSEL=0; U2STAbits.UTXISEL=0; U2STAbits.UTXBRK=0; U2STAbits.UTXEN=1; U2STAbits.URXISEL=1; _U2RXIE = 1; U2BRG=15; __C30_UART = 2; } void clear_uart(){ int i; str_pos = 0; for(i=0;i<80;i++){RXbuffer[i] = '\0';} } void __attribute__((interrupt,auto_psv)) _U2RXInterrupt(void){ //LED1 = !PORTBbits.RB4; IFS1bits.U2RXIF = 0; // Read the receive buffer until at least one or more character can be read while(U2STAbits.URXDA){ RXbuffer[str_pos] = U2RXREG; str_pos++; if(str_pos >= 80){str_pos = 0;} } } /*adc config*/ void configure_adc(){ // ADC 12-bits //****************************// //ADCON1: A/D Control Register 1 //****************************// ADCON1bits.ADON=1; //**A/D Operating Mode bit**// // 0-A/D converter is off // 1-A/D converter module is operating ADCON1bits.ADSIDL=0; //**Stop in Idle Mode bit**// // 0-Continue module operation in Idle mode // 1-Discontinue module operation when device enters Idle mode ADCON1bits.FORM=0; // 0-Integer //**Sata Output Format bits**// 91 // 1-Signed integer // 2-Fractional // 3-Singed fractional ADCON1bits.SSRC=7; //**Conversion Trigger Source Select bits**// // 0-Clearing SAMP bit ends sampling and starts conversion // 1-Active transition on INT0 pin ends sampling and starts conversion // 2-General purpose Timer3 compare ends sampling and starts conversion // 3-Motor Control PWM interval ends sampling and starts conversion // 4-Reserved // 5-Reserved // 6-Reserved // 7-Internal counter ends sampling and starts conversion (auto convert) ADCON1bits.ASAM=0; //**A/D Sample Auto-Start bit**// // 0-Sampling begins when SAMP bit set // 1-Sampling begins immediately agter last conversion completes. SAMP bit is auto set. ADCON1bits.SAMP=0; //**A/D Sample Enable bit**// // 0-A/D sample/hold amplifiers are holding // 1-At least one A/D sample/hold amplifier is sampling //****************************// //ADCON2: A/D Control Register 2 //****************************// ADCON2bits.VCFG=0; //**Voltage Reference Configuration bits**// _CSCNA=0; //**Scan Input Selections for CH0+ S/H Input for MUX A Multiplexer _BUFS=0; //**Buffer Fill Status bit**// // 0-A/D is currently filling buffer 0x0-0x7, user should access data in 0x8-0xF // 1-A/D is currently filling buffer 0x8-0xF, user should access data in 0x0-0x7 _SMPI=0; //**Sample/Convert Sequences Per Interrupt Selection bits**// _BUFM=0; //**Buffer Mode Select bit**// // 0-Buffer configured as one 16-word buffer ADCBUF(15...0) // 0-Buffer configured as one 8-word buffer ADCBUF(15...8), ADCBUF(7...0) _ALTS=0; //**Alternate Input Sample Mode Select bit**// // 0-Always use MUX A input multiplexer settings /* 1-Uses MUX A input multiplexer settings for first sample, then alternate between MUX B and MUX A input multiplexer settings for all subsequent samples*/ //****************************// //ADCON3: A/D Control Register 3 //****************************// _SAMC=3; //**Auto Sample Time bits**// // (0-31) Tad _ADRC=0; //**A/D Conversion Clock Source bit**// // 0-Clock derived from system clock // 1-A/D internal RC clock _ADCS=20; // (1-64)*Tcy/2 //**A/D Conversion Clock Select bits**// // Usou-se Tad=1000ns, logo obtem-se ADCS=14 //******************************// //ADCHS: A/D Input Select Register //******************************// _CH0NB=0; //**Channel 0 Negative Input Select _CH0SB=0; _CH0NA=0; _CH0SA=0; 92 //*************************************// //ADPCFG: A/D Port Configuration Register //*************************************// // Este registo e configurado na funçao configure_adc_channel // //*************************************// //ADCSSL: A/D Input Scan Select Register //*************************************// // Este registo nao precisa ser configurado, pois o CSCNA é 0 // } void configure_adc_channel(int channel){ TRISB |= (1 <<channel); // ADC_CHANNEL defined as input ADPCFG &= ~(1 <<channel); // ADC_CHANNEL defined as analog } int read_adc(int channel){ int x; _CH0SA = channel; _SAMP=1; while(_SAMP); while(!_DONE); x=ADCBUF0; return x; } /*pwm config*/ float DCpv=0.5, DCfc=0.3; int Tpv=600, Tfc=1000;//1us=~30 cycles Fpv=50khz Ffc=30khz void ocPV_init(){ //make c13 pins output TRISDbits.TRISD0 = 0; PR3=Tpv; TMR3=0; OC1CONbits.OCTSEL = 1; OC1R=0; OC1RS=0; //continuous pulses OC1CONbits.OCM=0b101; T3CONbits.TON=1; // Enable timer 3 } void ocFC_init(){ //configure pins to output TRISDbits.TRISD2 = 0;//c15 c16 TRISDbits.TRISD3 = 0; PR3=Tfc; TMR3=0; //oc mode OC3CONbits.OCM = 0b101; OC4CONbits.OCM = 0b101; //oc tmr 3 OC3CONbits.OCTSEL = 1; OC4CONbits.OCTSEL = 1; //set deadtime, etc OC3R=20; OC3RS=(DCfc)*Tfc;//c15 OC4R=(DCfc)*Tfc + 20; OC4RS=Tfc;//c16 T3CONbits.TON=1; } // Enable timer 3 /*control routines for pv and fcell*/ float setpointPV,setpointFC, PV, error, output; float preError=0,integral=0, derivative=0 ; 93 float Dt=0.0005, Kp=0.01, Ki=0.001, Kd=0.0001; void PID_FC(){ PV=read_adc(5)/819.0;//process value:voltage measured in cell //if(PV<0.3){ if(0){ error=0.6-PV; integral=integral+error*Dt; derivative=(error-preError)/Dt; output=Kp*error+Ki*integral+Kd*derivative; preError=error; DCfc=DCfc-output; } //20 cycles of dead time -> diode conducts for 5% of Tfc OC3R=20; OC3RS=(DCfc)*Tfc;//c15 OC4R=(DCfc)*Tfc + 20; OC4RS=Tfc;//c16 T3CONbits.TON=1; if(DCfc<0.03){//OC3RS > dead time OC3CONbits.OCM = 0b0; OC4CONbits.OCM = 0b0; T3CONbits.TON=0; //Disable tmr3 printf("End"); break; } } void PVctrl(){ setpointPV = read_adc(12)/819.0;;//voltage of pv panel:up to 5V /*control routine*/ DCpv=setpointPV/6.25; if(DCpv>0.85)DCpv=0.85; OC1R=0; OC1RS=(int)Tpv*(1-DCpv); T3CONbits.TON=1; // Enable timer 3 } /*LED control*/ int DC_R=0,DC_G=0,DC_B=0; int intensity=0, color=0; void LED_init(){ TRISBbits.TRISB8=0; //AN8 (C9) output TRISBbits.TRISB9=0; //AN9 (C10) TRISBbits.TRISB10=0;//AN10(C11) TRISBbits.TRISB11=0;//AN11(C12) Valve pin PR4=3000000; //P=0.1s T4CONbits.TCKPS= 2; // prescaler 1:8 -> timer4 incrementes every 267ns @29.491MIPS T4CONbits.TON = 0;//stop any activity in both timers IFS1bits.T4IF = 0; IEC1bits.T4IE = 1; TMR4=0; } void __attribute__((__interrupt__, no_auto_psv)) _T4Interrupt (void) { //working at 0.25*total power if(intensity<DC_R) LED_R=1; else LED_R=0; if(intensity<DC_G) LED_G=1; else LED_G=0; if(intensity<DC_B) LED_B=1; else LED_B=0; intensity++; if(intensity==32)intensity=0; IFS1bits.T4IF = 0; } 94 void color_update(){ switch(color); case (1):DC_R=0,DC_G=0,DC_B=0; case (2):DC_R=1,DC_G=0,DC_B=0; case (3):DC_R=0,DC_G=1,DC_B=0; case (4):DC_R=1,DC_G=1,DC_B=0; case (5):DC_R=0,DC_G=0,DC_B=1; case (6):DC_R=1,DC_G=0,DC_B=1; case (7):DC_R=0,DC_G=1,DC_B=1; case (8):DC_R=1,DC_G=1,DC_B=1; } /*input capture*/ int counts1=0, cap1=0,cap2=0;//ic1 int counts2=0, cap3=0,cap4=0;//ic2 void capinit1(void){ IPC0bits.IC1IP = 1; //level 1 priority IFS0bits.IC1IF = 0; //clear the IC1 interrupt status flag IEC0bits.IC1IE = 1; // Enable IC1 interrupts IC1CONbits.ICM = 3; //capture edge every rising edge IC1CONbits.ICI = 3; //interrupt on every capture IC1CONbits.ICTMR = 1; //used tmr2 IC1CONbits.ICSIDL = 0; IPC0bits.IC1IP = 1; //level 1 priority IFS0bits.IC1IF = 0; //clear the IC1 interrupt status flag IEC0bits.IC1IE = 1; // Enable IC1 interrupts TRISDbits.TRISD8=1; // c28 IC1 pin as an imput } void capinit2(void){ IPC0bits.IC1IP = 1; //level 1 priority IFS0bits.IC2IF = 0; //clear the IC2 interrupt status flag IEC0bits.IC2IE = 1; // Enable IC2 interrupts IC2CONbits.ICM = 3; //capture edge every rising edge IC2CONbits.ICI = 3; //interrupt on every capture IC2CONbits.ICTMR = 1; //used tmr2 IC2CONbits.ICSIDL = 0; IFS0bits.IC2IF = 0; IEC0bits.IC2IE = 1; //clear the IC2 interrupt status flag // Enable IC2 interrupts TRISDbits.TRISD9=1; // c30 IC2 pin as an imput } void IC1Sample(){ if(cap1==0&&cap2==0){//bad captures __delay32(30);//~1us } if(((cap1==0)&&(cap2!= 0))||(cap1>cap2)){// prevents negative values for cap2 T2CONbits.TON = 0; TMR2=0; T2CONbits.TON = 1; } IC1CON = 0x0000;//capclear capinit1(); counts1=(cap2-cap1); } void IC2Sample(){ if(cap3==0&&cap4==0){//bad captures __delay32(30);//~1us } if(((cap3==0)&&(cap4!= 0))||(cap3>cap4)){// prevents negative values for cap2 T2CONbits.TON = 0; TMR2=0; T2CONbits.TON = 1; } IC2CON = 0x0000;//capclear 95 capinit2(); counts2=(cap4-cap3); } void __attribute__((interrupt,no_auto_psv)) _IC1Interrupt (void) { cap1=IC1BUF; cap2=IC1BUF; IFS0bits.IC1IF = 0; //limpa a flag de interrupcao } void __attribute__((interrupt,no_auto_psv)) _IC2Interrupt (void) { cap3 = IC2BUF; cap4 = IC2BUF; IFS0bits.IC2IF = 0;//clear flag } /*main*/ int main(){ uart_init(); capinit1(); configure_adc(); float vol=-0.0293*counts1+73.19;//calib /*photovoltaic panel and LED panel routine*/ while(1){ /*insert led control and scanf*/ LED_init(); ocPV_init(); configure_adc_channel(12); configure_adc_channel(0); configure_adc_channel(1); printf("color(1-8) intensity(1-8) \r\n"); if(RXbuffer[str_pos-1] == 13){ sscanf(RXbuffer, "%d %d",&color,&intensity); //printf("%f %f %d\r\n",DCsw,DCpulse,Tpulse); clear_uart(); } if(RXbuffer[str_pos-1] != 78){//x(cape) color_update(); PVctrl(); IC1Sample(); printf("%1.3f %1.3f %1.3f %d \r\n",DCfc, PV, vol, counts1); //controls if(RXbuffer[str_pos-1] == 13){ sscanf(RXbuffer, "%d %d",&color,&intensity); //printf("%f %f %d\r\n",DCsw,DCpulse,Tpulse); clear_uart(); } if(RXbuffer[str_pos-1] == 97){//a valve=1; clear_uart(); } if(RXbuffer[str_pos-1] == 100){//d valve=0; clear_uart(); } if(RXbuffer[str_pos-1] == 119){//w T4CONbits.TON = 0; //LED panel off IEC1bits.T4IE = 0; //stop t4 interruptions clear_uart(); } if(RXbuffer[str_pos-1] == 115){//s clear_uart(); } __delay32(15000000);//~0.5 sec delay } else break; } /*Fuel cell and engine control routine*/ while(1){ ocFC_init(); configure_adc_channel(2);//Ifc configure_adc_channel(3);//Vfc configure_adc_channel(5);//1st and 2nd cells if(RXbuffer[str_pos-1] != 78){//x(cape) PID_FC(); 96 IC1Sample(); printf("%1.3f %1.3f %1.3f //controls if(RXbuffer[str_pos-1] valve=1; clear_uart(); } if(RXbuffer[str_pos-1] valve=0; clear_uart(); } if(RXbuffer[str_pos-1] clear_uart(); } if(RXbuffer[str_pos-1] clear_uart(); } __delay32(15000000);//~0.5 } else break; %d \r\n",DCpv, setpointPV, vol, counts1); == 97){//a == 100){//d == 119){//w == 115){//s sec delay } return 0; A3. PCB layouts 97