You are on page 1of 40

DOUBLE INPUT BUCK BOOST CONVERTER

Project By Zain-Ul-Abideen Shah Muhammad Umair 2008-NUST-BE-EL-436 2008-NUST-BE-EL-490

A project report submitted as partial fulfillment of the requirement for the degree of Bachelors in Electrical Engineering (BEE)

School of Electrical Engineering and Computer Sciences National University of Sciences and Technology H-12, Islamabad, Pakistan (2013)

CERTIFICATE

It is certified that the contents and form of this thesis entitled Double Input Buck Boost Converter submitted by Zain-Ul-Abideen Shah (2008-NUST-BE-EL436) and Muhammad Umair (2008-NUST-BE-EL-490 have been found satisfactory for the requirement of the degree.

Advisor: ______________________________ (Engr. Sikandar Hayat)

Co-Advisor: ______________________________ (Dr. Usman Younis)

DEDICATION

To all the students who will one day become Electrical Engineers

ACKNOWLEDGMENT
Firstly we would like to acknowledge the fact that it is due to The Almighty Allah that we are here today and without His blessings we would not have been able to work on this project let alone complete it. Furthermore the undying and consistent support of our advisor Engr. Sikandar Hayat was undoubtedly what enabled us to transform this project from a mere idea to the reality that it is today. Even through his busy schedule he always found time to provide feedback and share his views on what changes would help develop the project into an enhanced product. Our Co advisor Dr Usman Younis was also a source of constant guidance, sharing with us his invaluable knowledge and technical expertise. We cannot thank our advisors enough for assisting us with such conviction and patience throughout the course of this final year. Without your help and especially encouragement, we would not have achieved the success we have. We would also like to acknowledge the immense help that Mr. Manzoor of RCMS provided us. Without his technical knowledge, we would never have been able to troubleshoot the circuits properly. Last but definitely not the least we greatly appreciate the priceless help, support and guidance provided by Engr. Anam Malik throughout the project. And not to forget all the random but important help that Engr. Ameera Taseer and Engr. Uzair Baqai provided as true friends.

Contents

ABSTRACT .............................................................................................................................. 9 INTRODUCTION ................................................................................................................... 10 1.1 MOTIVATION ........................................................................................................ 10

REVIEW OF LITERATURE ....................................................................................................... 12 2.1 SINGLE INPUT BUCK BOOST CONVERTER .................................................................... 12 2.2 DOUBLE INPUT BUCK BOOST CONVERTER .................................................................. 14 METHODOLOGY ................................................................................................................... 16 3.1 CALCULATIONS ........................................................................................................... 16 3.1.1 Choosing Inductor ............................................................................................... 16 3.1.2 Choosing Capacitor .............................................................................................. 17 3.2 SIMULATIONS............................................................................................................. 18 3.3 HARDWARE ................................................................................................................ 20 3.3.1 Physical Elements ................................................................................................ 20 3.3.2 Implementation ................................................................................................... 21 3.3.3 Working............................................................................................................... 25 RESULTS ............................................................................................................................... 28 4.1 OUTPUT ..................................................................................................................... 28 4.2 DATA AND DISCUSSION .............................................................................................. 29 CONCLUSION AND FUTURE RECOMMENDATIONS ................................................................ 31 REFERENCES ........................................................................................................................ 33 6.1 Research Papers ......................................................................................................... 33 6.2 Books ......................................................................................................................... 33 6.3 Internet Links ............................................................................................................. 33 6.4 Personal Help ............................................................................................................. 34

APPENDICES......................................................................................................................... 35 7.1 POWER MOSFET - IRF 1404 ........................................................................................ 35 7.2 POWER DIODE - RHR 15120 ........................................................................................ 36 7.3 OPTOCOUPLER - TLP 250 ............................................................................................ 36 7.4 ARDUINO CODE .......................................................................................................... 37

LIST OF TABLES

Table 1: Output voltages for different values of input voltages and duty cycles .................... 29

LIST OF FIGURES

Figure 1: Typical Buck Boost Converter ................................................................................ 12 Figure 2: Two single input converters connected together ................................................... 14 Figure 3: Double Input Converter Design .............................................................................. 15 Figure 4: Proposed Double Input Buck Boost Converter ....................................................... 15 Figure 5: Simulation Schematics ........................................................................................... 18 Figure 6: Simulation Output ................................................................................................. 20 Figure 7: Breadboard Implementation ................................................................................. 22 Figure 8: Gate Drive Circuit .................................................................................................. 23 Figure 9: Double Input Buck Boost Converter ....................................................................... 24 Figure 10: Clockwise from top: Converter Circuit, Voltage Divider, Arduino, Gate Drive Circuit. ............................................................................................................................................ 24 Figure 11: Four Modes of Operation .................................................................................... 25 Figure 12: Voltage and Current Waveforms .......................................................................... 27 Figure 13: Output Voltage .................................................................................................... 28 Figure 14: IRF 1404 Datasheet .............................................................................................. 35 Figure 15: RHR 15120 Datasheet .......................................................................................... 36 Figure 16: TLP 250 Datasheet ............................................................................................... 36

ABSTRACT

Energy crisis in the recent years have increased the demand for alternate energy sources. Alternate energy based systems which use wind or solar energy have resulted in several sources of energy each having their own distinct specifications. For example the efficiency of solar cell arrays can be increased by connecting them in parallel whereas the efficiency of the wind turbines can be increased by using series connection to increase the voltage and therefore decrease the armature current. This project is about the implementation of an IEEE research paper which focuses on a unique double-input pulse width-modulation (PWM) converter for high and low voltage sources which was proposed to incorporate both of the above mentioned cases. With a Pulse Width Modulation scheme, this converter can extract power from two different voltage sources individually or at the same time. The output is a predetermined voltage whereas the input may be higher or lower than it. The circuit bucks, boosts or buck-boosts the input voltages to create a regulated output voltage.

Chapter 1 INTRODUCTION

1.1 MOTIVATION

Energy demands in the recent years have grown exponentially. With fossil fuel reserves depleting at an alarming rate, and environmental damage caused by burning fossil fuels, the demand for cleaner and sustainable energy has increased. Unfortunately, renewable energy sources are expensive and hence cannot be incorporated in commercial energy supply. Speaking specifically in terms of cost, a 1 kW solar panel system costs Rs 5 lakh. Adjusting it with the current rates of electricity, the payback for this takes anywhere between three and ten years. Yet powering the house with a solar panel is more feasible. Currently customers invest in UPS and generators to compensate for power failures, but there are several shortcomings. In Pakistan the UPS efficiencies are very low i.e. between twenty and forty percent. Their power delivered is also not pure. Also, the charging of the batteries constantly adds to the electricity bills all year long. On the other hand, the generators are around eighteen percent efficient and their maintenance cost is also rather high. Another drawback of generators is their noise as well as environmental pollution. This highlights the need for a highly efficient solar panel system to increase the efficiency of energy supplied to the households and so it became sufficiently necessary for us to undertake this area as our research of study. The research paper which we implemented is highly feasible for using solar energy to obtain a voltage using double input buck/boost converter, the details of which will be mentioned in the following pages. It must be noted that this converter is

10

not merely restricted for use with solar cells. Any two voltage sources may be used as input for the converter and the desired output may be obtained from it.

11

Chapter 2 REVIEW OF LITERATURE

Before coming up with an appropriate buck/boost converter to ensure a regulated output, it was necessary to perform a literary survey on existing designs of the converters already implemented in this area. We start with the single input buck boost converter working and later take it further to justify the particular design that we plan to implement.

2.1 SINGLE INPUT BUCK BOOST CONVERTER


A buck boost converter creates an output voltage which can be lesser or greater in magnitude than its input voltage, with the polarity of the output being reversed. Therefore its also called the inverting converter.

Figure 1: Typical Buck Boost Converter

12

There are two modes in which this circuit operates. In mode 1, Q1 is turned on and Dm is reverse biased therefore the current flows through the inductor only. The inductor intrinsically makes its polarity such that its upper end becomes positive and the lower end becomes negative to oppose the flow of current through it. In mode 2, Q1 is switched off. Although the input current is now no longer flowing, the inductor intrinsically tries to keep the current flowing. To achieve this, the inductor reverses its polarity so that the upper end becomes negative whereas the lower end becomes positive. The inductor begins dissipating its current through the capacitor C, the now forward biased diode D m and the load. As the energy of the inductor is dissipated across the load, the inductor current decreases. This continues until Q1 is turned on again. The output voltage is given by:

Va = -L
where I = I2 I1 is peak to peak rippled current of the inductor and the input current Is relates to the output current Ia in the following relation:

Is =
The converter may operate in one of the two conditions, either continuous or discontinuous. In continuous mode, the inductor current does not fall to zero whereas in the discontinuous mode, the inductor completely discharges before the transistor turns on again and current begins flowing through the inductor again.

13

2.2 DOUBLE INPUT BUCK BOOST CONVERTER


It is often required to buck boost multiple voltages. For this, there are commonly two approaches which are carried out. Two converters may be cascaded in series or attached in parallel.

Figure 2: Two single input converters connected together

The drawback of the series approach is that both input voltages have to be present in order for the converter to function. The problem with the parallel approach is that two different voltages cannot exist at the same node simultaneously. Therefore time sharing concept has to be applied i.e. the voltages are applied in different time periods. This however not only complicates the circuitry and raises the cost, it is also less efficient as far as the matter of handling two input voltages simultaneously is concerned. Therefore we look into a double input converter as an alternate to two single input converters. A block diagram is given below:

14

Figure 3: Double Input Converter Design

The authors of the research paper proposed the following design for the double input buck boost converter:

Figure 4: Proposed Double Input Buck Boost Converter

15

Chapter 3 METHODOLOGY

3.1 CALCULATIONS

The first step was to calculate the first iteration of values for the circuit components like capacitor and inductor. For this we initially researched the commonly available solar panels and chose a model that had a power rating of 3.2W which we assumed would be providing our input voltage(s). Since there is no standard approach for choosing an inductor value, we researched and chose a method which is used for buck converter design. This resulted in the following calculations: P=3.2W Vout = P/Vo (V0 was self-defined to be 12V) Io = P/Vo = 3.2/Vo = 0.267A

3.1.1 Choosing Inductor

According to the Inductor Law: V = L.di/dt Also D = Ton/Ts = Fsw.Ton (1) (2)

where Fsw = switching frequency and D=duty cycle From (2) dt = D/Fsw

16

Substituting this in (1) reveals that L= (Vin-Vout)(D/Fsw)(1/Iripple) L = (Vin-Vout)(D/Fsw)(1/Iripple) Iripple = 30%of Io (Chosen arbitrarily) Iripple = 0.08A Fsw = 50 KHz (Chosen arbitrarily; the switching frequency is usually a large number so that the delay form input to the output because of Ts is smaller) (delta) = Vout /Vin = 12/17.4=0.69 L = (17.4-12)(0.69/50,000)(0.08)-1 L=931.5 H

3.1.2 Choosing Capacitor V = Iripple (ESR + T / C + ESL / T) ESR is the Equivalent Series Resistance and ESL is the Equivalent Series Inductance. ESL is assumed 0 for frequencies lower than 1MHz. = I ripple (ESR) + I ripple Ts/C Assuming ESR = 0.03 and (Delta V) = 100mv 0.1/0.08 = 0.03 + 0.00002/C 1.22 = 0.00002/C C = 0.0000164 F = 16.4 F

17

3.2 SIMULATIONS

The next step was to simulate the circuit before we attempted to patch and implement it. The software we chose was LTspice IV which is high performance software that can perform simulations, capture schematics and display waveforms. The simulation schematics are given in Figure 5:

Figure 5: Simulation Schematics

The circuit is governed by the following equation given in the research paper:

VO =

VH1 +

VLO

where: Vo = Output Voltage


18

VHI = Higher Voltage Source VLO = Lower Voltage Source dHI = Duty Cycle of the switch handling VHI dLO = Duty Cycle of the switch handling VLO We ran the simulations with the following values: VHI = 15 V VLO = 10 V dHI = 0.5 dLO = 0.2 The desired output was kept 12 V. The equation suggested that the theoretical possible output was 11.875 V. Output obtained from simulations was 11.04 V which was highly accurate (Figure 6).

19

Figure 6: Simulation Output

With this accurate level of output, we then proceeded to implement our hardware.

3.3 HARDWARE

3.3.1 Physical Elements

The first step in our hardware implementation was the choosing of the circuit parts. The following parts were eventually used:

20

Diode: We decided to use RHR 15120 diode. It is a hyper fast (trr < 65 ns) diode which is ideal for high switching frequencies (50kHz).Also it has a very high reverse breakdown voltage (1200V) ideal for high power applications

Capacitor: After a lot of tweaking and testing on the simulations, the final value chosen for the capacitor was 470F to ensure a smooth output with the ripples minimized

MOSFET: We chose power MOSFET IRF 1404 which is ideal for fast switching and also allows very high currents to flow (162 A) with very less on resistance (RDS(on) = 0.004 )

Inductor: The inductance was earlier calculated to be 931.5 mH and we made no changes to it Resistor: The load was modeled by a 50 power resistor rated at 10 W. DC Power Supplies: Used to provide input voltages as well as for biasing of the MOSFETs Function Generators: Used to do the biasing of the MOSFETs and for their switching Oscilloscope: To observe the output waveforms

3.3.2 Implementation

A lot of problems were faced when we were implementing the circuit. The first issue was the inductor construction. We initially used the inductors available in the lab but due to their small size and high resistance, they were highly affecting the output of the buck-boost part of the circuit. Therefore we decided to make our own inductor. Our initial attempts were foiled by the small size of the inductor core which did not let us get enough wire turns to reach our desired value of 931.5 mH. So we then bought an inductor core with an outer diameter of 2.5 inches. 18 turns were used to reach the

21

required value of the inductance. We used three parallel strands of wires to increase the current carrying capability and also to reduce any losses due to skin effect. We did not get the required output after initially patching the circuit on the breadboard (Figure 7). The buck and the buck-boost part worked separately but not together. We then realized that both the function generators have to be isolated for proper results. Having done that, we obtained the correct functionality.

Figure 7: Breadboard Implementation

The circuit was then interfaced with an Arduino Board (Arduino Uno R3). For this, firstly a gate drive circuit (Figure 8) consisting of an optocoupler was needed which would connect the Arduino outputs to the MOSFET gates. A voltage divider circuit was also required at the Arduino input to prevent it from being exposed to voltages beyond its maximum tolerable range.

22

Figure 8: Gate Drive Circuit

The Arduino took the output voltage as its analogue input and then generated two PWM outputs on pins 5 and 6. These outputs were basically responsible for controlling the duty cycles of the MOSFETS in the buck boost converter. The coding (see section 8.4) was done in such a way that the PWM outputs (and hence the duty cycles of the MOSFETS) would change if the output of the buck boost converter was not 12V. The PWM pulses would increase or decrease depending on the sensed voltage, until the sensed voltage i.e. the output of the converter became the required 12V. A PCB of the circuit was then made (Figures 9 and 10).

23

Figure 9: Double Input Buck Boost Converter

Figure 10: Clockwise from top: Converter Circuit, Voltage Divider, Arduino, Gate Drive Circuit.

24

3.3.3 Working

The circuit has four modes of operation which are explained under the diagram given below:

Figure 11: Four Modes of Operation

MODE1 (with SHI ON and SLO OFF): Figure 11(a) shows the resultant circuit. When SHI is switched on with SLO switched off, the diode becomes reverse biased. Meanwhile DLO is forward biased and as a result provides the alternate path for the current of the inductor to flow. VHI charges the inductor and capacitor and also supplies current to load. MODE2 (with SHI OFF and SLO ON):

25

Figure 11(b) shows the resultant circuit. When SLO is switched on with SHI switched off, the diode becomes reverse biased. Meanwhile DHI conducts and provides the current of the inductor with an alternate path to flow. VLO charges the inductor and the capacitor and also supplies current to load. MODE3 (with SHI OFF and SLO OFF): Figure 11(c) shows the resultant circuit. Here both the power switches are switched off. Both DLO and DHI will provide the alternate path for the current of the inductor. Since the DC sources are considered open, thus the load will be provided with the current via the capacitor as well as the inductor. MODE4 (with SHI ON and SLO ON): Figure 11(d) shows the resultant circuit. Here the power switches are switched on and both the power diodes are reverse biased. The two input voltages VLO and VHI are added up and provide energy to the inductor which charges it. The capacitor provides current to the load. In this mode of operation both the input voltages will transfer their energies simultaneously. Figure 12 shows the waveforms of the key components of the circuit. It can be noted that the switches SHI and SLO conduct for different time periods i.e. duty cycle for SHI is greater than that of SLO. 3 levels exist of the inductor voltage. They depend upon whether the switches are on or off. These voltage levels in turn generate 3 levels of the current of the inductor. The capacitor current is used to create a compensating current which will result in a stable dc load current.

26

Figure 12: Voltage and Current Waveforms

27

Chapter 4 RESULTS

4.1 OUTPUT

Figure 13: Output Voltage

28

4.2 DATA AND DISCUSSION

Table 1: Output voltages for different values of input voltages and duty cycles

No.

VHI (V) 5 10 10 15 15 15 20 20 20

dHI

VLO (V) 5 5 10 5 10 15 10 15 20

dLO

Theoretical

(V) 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 4.375 7.5 8.75 10.63 11.875 13.125 15 16.25 17.5

Actual (V) 3.01 7.41 7.64 10.13 11.575 12.34 14.10 15.5 17.12

Error (V) -1.365 -0.09 -1.11 -0.5 -0.3 -0.785 -0.9 -0.75 -0.38

1 2 3 4 5 6 7 8 9

0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5

Table 1 shows how the output voltage is affected by the input parameters such as the DC voltages and the duty cycles of the MOSFETs. For the sake of convenience and for minimizing output variations, the duty cycles were kept constant while the inputs were varied. By comparing the inputs with the respective output voltages it can be seen that the buck-boost function was successfully performed. The output appears in the form of almost square wave pulses due to the very high switching speed of the MOSFETs (we used 50k for the frequency) and the charging and discharging of the inductor and the capacitor. Thus the average or resultant waveform is what appears above in Figure 13. In our experiments we found out that dHI had a greater impact on the output, which is what Figure 13 also clearly shows.

29

The circuit has a number of features worth mentioning: 1. Both the sources can transfer power simultaneously or individually. In the case where SHI is open, the circuit behaves as a traditional buck-boost converter. In the case where SLO is open, the circuit behaves as a traditional buck converter. When both switches are closed, the circuit behaves as it is designed to be i.e. a Double Input Buck Boost Converter. And when both switches are open, it obviously does not work and is turned off. 2. There are four operation modes, depending on the state of our switches i.e. the MOSFETS 3. There are not too many variations or fluctuations in the output voltage. 4. The magnitude of the output may be greater, lower or in between the inputs, depending on what the duty cycle has been set. It can be therefore seen that the circuit is fit for practical usage. As mentioned earlier, it can be used in any renewable energy application such as solar panels or wind turbines. Solar energy has numerous advantages. Foremost is that it is a renewable source meaning there is no threat of it ever depleting unlike our fossil fuel reserves. Secondly, once the initial cost of installing the solar system is taken care of, its a cheap energy source. In a place like Pakistan where the sunny days are ample and where a substantial amount of money is spent on importing oil for electricity generation, free energy from the sun is a very suitable solution. Also its an earth friendly, pollution free, way of generating power which is almost free from maintenance and fuel needs.

30

Chapter 5 CONCLUSION AND FUTURE RECOMMENDATIONS

The main motivation behind doing this project was to contribute towards finding a solution for the prevailing power crisis in the country. With the constantly increasing electrical load and the not so constant raise in our electricity production, it is essential we turn to renewable energy. Since the renewable energy systems like solar panels have a high initial cost, they are only attractive for the average consumer if they are feasible in the long run once the initial cost has been paid. To make it feasible however, it must be ensured that high efficiency systems are used which contain high efficiency sub systems and components. This is where our project comes in. We have tested its output with 10W solar panels. However that is far too small an amount of power to be of any practical use. The circuit can firstly be operated on higher voltages to deliver higher power. We kept output voltage at 12V but both the power MOSFET as well as the power diodes allow for higher voltages (at least up to 40V for the IRF 1404) to be used. This is one idea to make it a more practical circuit. Also, for even higher voltages, some other models of the power diodes and MOSFETs can be used in the circuit, which have higher power ratings enabling them to handle the more power hungry loads. The solar panels themselves can also be substituted with ones having a higher power rating. Our panels were barely strong enough to light an energy saver bulb in a practical situation. However solar panels of far higher power ratings are available commercially at competitive prices. They can be connected in series to further raise the voltage that they produce as output.

31

Last but not least, an array of such panels attached to such double input buck boost converters can be cascaded with each other. This would ensure that while each individual converter handled a high voltage within its safety threshold, the resultant output of all the converters would be an even higher voltage which could deliver more power. In this way, this project may be modified in the future to become a very useful component of commercial solar energy based systems.

32

Chapter 6 REFERENCES

6.1 Research Papers

Chen, Y.M., Liu, Y.C. and Lin, S.H., (2006), Double-Input PWM DC/DC Converter for High-/Low-Voltage Sources, IEEE Transactions on Industrial Electronics, Vol.53, no. 5, pp. 1538 1545.

6.2 Books
Mohan, N., Undeland, T. M. and Robbins, W. P., (2002). Power Electronics: Converters, Applications, and Design, 3rd ed., Wiley. Rashid, M.H, (2003), Power Electronics: Circuits, Devices and Applications (3rd Edition), Prentice Hall

6.3 Internet Links

http://satcom.tonnarelli.com/files/smps/SMPSBuckDesign_031809.pdf http://en.wikipedia.org/wiki/Buck%E2%80%93boost_converter http://www.datasheetarchive.com/RHR15120-datasheet.html http://pdf1.alldatasheet.com/datasheetpdf/view/32418/TOSHIBA/TLP250.html http://www.google.com.pk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&v ed=0CCgQFjAA&url=http%3A%2F%2Fwww.irf.com%2Fproduct-

33

info%2Fdatasheets%2Fdata%2Firf1404.pdf&ei=UasUfHvJMLGOeqZgfAB&usg=AFQjCNEFVUKMDP3lqmlPbFvtjBbIq1AGx A&bvm=bv.47244034,d.ZWU&cad=rja

6.4 Personal Help


Muhammad Zubair Muhammad Kamran Mughees Sarwar Awan

34

Chapter 7 APPENDICES

7.1 POWER MOSFET - IRF 1404

Figure 14: IRF 1404 Datasheet

35

7.2 POWER DIODE - RHR 15120

Figure 15: RHR 15120 Datasheet

7.3 OPTOCOUPLER - TLP 250

Figure 16: TLP 250 Datasheet

36

7.4 ARDUINO CODE

const int analogInPin = A0; const int analogOutPin = 9; int sensorValue = 0; float voltage=0; int pwml=128; int pwmh=128; float setpoint=10.10; float tol=0.5; //change setpoint void setup() { Serial.begin(9600); pinMode(13, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); } void setPwmFrequency(int pin, int divisor) { byte mode; if(pin == 5 || pin == 6 || pin == 9 || pin == 10) { switch(divisor) { case 1: mode = 0x01; break; case 8: mode = 0x02; break; case 64: mode = 0x03; break;

37

case 256: mode = 0x04; break; case 1024: mode = 0x05; break; default: return; } if(pin == 5 || pin == 6) { TCCR0B = TCCR0B & 0b11111000 | mode; } else { TCCR1B = TCCR1B & 0b11111000 | mode; } } else if(pin == 3 || pin == 11) { switch(divisor) { case 1: mode = 0x01; break; case 8: mode = 0x02; break; case 32: mode = 0x03; break; case 64: mode = 0x04; break; case 128: mode = 0x05; break; case 256: mode = 0x06; break; case 1024: mode = 0x7; break; default: return; } TCCR2B = TCCR2B & 0b11111000 | mode; } } void loop() {

38

// read the analog in value: setPwmFrequency(6.0, 0.8); sensorValue = analogRead(analogInPin); //Serial.println(sensorValue); voltage=(50.0/1023.0)*sensorValue; Serial.println(voltage); if(voltage>=(setpoint+tol+2.0)) { digitalWrite(13, LOW); pwml=pwml-1; pwmh=pwmh; } else if(voltage>setpoint+tol && voltage<setpoint+tol+2 ) { digitalWrite(13, LOW); pwml=pwml; pwmh=pwmh-1; } else if(voltage<=(setpoint+tol) && voltage>=(setpoint-tol)) { digitalWrite(13, HIGH); pwml=pwml; pwmh=pwmh; }

39

else if(voltage<(setpoint-tol-2.0)) { digitalWrite(13, LOW); pwml=pwml+1; pwmh=pwmh; } else if(voltage>=(setpoint-tol-2.0)&& voltage<(setpoint - tol)) { digitalWrite(13, LOW); pwmh=pwmh+1; pwml=pwml; } analogWrite(5,pwml); analogWrite(6,pwmh); Serial.print("Voltage= " ); Serial.println(sensorValue); Serial.print("pwml= " ); Serial.println(pwml); Serial.print("pwmh= " ); Serial.println(pwmh); delay(1000); }

40

You might also like