Vous êtes sur la page 1sur 56

Project report on IMPLEMENTATION OF AUTOMATED SWITCHING CIRCUIT FOR BATTERY CHARGING DURING LOW LIGHT INTENSITY IN SOLAR PUMPS

Project report submitted for partial fulfillment of the requirements for the Award of the Degree of B.Tech., In ELECTRICAL & ELECTRONICS ENGINEERING,

SASTRA UNIVERSITY.
Submitted by SAKET, V (Reg. No-113005123)

Under the Guidance of (Mr.S.Venkatesh) (Assistant Professor-III) Department of EEE, SEEE, SASTRA University, Thanjavur. Department of Electrical & Electronics Engineering School of Electrical & Electronics Engineering Shanmugha Arts, Science, Technology & Research Academy SASTRA UNIVERSITY Thirumalaisamudram, Thanjavur - 613 401

APRIL 2013

SCHOOL OF ELECTRICAL & ELECTRONICS ENGINEERING

BONAFIDE CERTIFICATE

This is to certify that the project work entitled Implementation of automated switching circuit for battery charging during low light intensity in solar pumps is the bonafide work done by Chi. SAKET,V (113005123) of VIII semester B.Tech. Degree in Electrical & Electronics Engineering during the academic year 2012-2013 in partial fulfillment of the requirements for the award of Degree of Bachelor of Technology in EEE at SASTRA university.

_________________________ Internal Project Guide

____________________ External Project Guide

_____________________ Internal Examiner

_____________________ External Examiner

Submitted for the university examination held on


ii

__________________________

____________________

SCHOOL OF ELECTRICAL & ELECTRONICS ENGINEERING

DECLARATION

We / I submit this project entitled TITLE OF THE PROJECT to SASTRA University, in partial fulfillment of the requirement for the award of B.Tech., Degree in ELECTRICAL AND ELECTRONICS ENGINEERING and we in full consciousness, declare this dissertation as our original and independent work carried out under the guidance of GUIDE NAME WITH DESIGNATION, EEE Department, SEEE, SASTRA University, Thanjavur.

Date : ______________ Place : ______________

Signature:

1. ____________________ 2. ____________________ 3. ____________________

iii

ACKNOWLEDGEMENTS

First and foremost, I would like to thank Prof R Sethuraman, Vice Chancellor, SASTRA University for providing all the facilities and necessary encouragement during the course of study. I would also like to extend our thanks to the Registrar Dr G Balachandran for giving us permission to undertake the four month intern in Kirloskar Brothers Limited, and also for all the opportunities provided by him and the management during our course. I would also like to thank Dr B Viswananthan, Dean School of Electrical and Electronics Engineering (SEEE for his moral support. I owe a debt of gratitude to Mr. S.Venkatesh whose encouragement and guidance helped me immensely throughout this project period. I wish to express my immense gratitude to Mr. Ajay Shirodkar, General Manager and Head-Solar Division, Kirloskar Brothers Limited, for guiding me throughout this project and allowing me to access the valuable resources at KBL. I would also like to thank Mr. Pradeep Sharma and Mr. Santosh Singh Pujari for their guidance on approaching the problem. Special thanks to Mr. Sham Sundar Chendake and Dr. Vijay Mehta from Khyatee electronics for providing me their expertise in electronic design. It has been an amazing experience that I had for the last three months and I had very good exposure on how to go about a research problem, and Kirloskar Brothers Limited provided me the valuable opportunity to work on this real time problem and for this I am grateful to KBL.

ABSTRACT The idea of harnessing the energy of the sun is not a new one. In fact, way back in 7th century BC our ancestors were using crude magnifying glasses to focus the Suns energy and light fires. Then, fast forward to 1767, when Swiss scientist Horace de Saussure built the world's first solar collector. However, it would not be until 1839 that the basis of most of our more modern solar power energy would be discovered by French scientist Edmond Becquerel, who named his discovery the photovoltaic effect. PV power is one of the most environmentally safe forms of energy that we have in use. This, plus the fact that solar power is a renewable energy source, makes PV power very attractive for the future of our energy production. Current energy production methods such as fossil fuels are non-renewable and greatly harmful to our environment. If we want to continue to lead healthy, long lives, we need to start looking to the future, and that is solar power. The photovoltaic effect is one by which PV cells (there are many different materials which PV cells can be made of) convert light energy into electrical energy at the atomic level. Light, however, may be reflected, absorbed, or pass right through the PV cell, and it is only the absorbed light that generates electricity. PV power is of higher significance in rural areas of India where conventional grid supply is intermittent and loads are heavy due to requirements of irrigation and agriculture. Hence, KIRLOSKAR BROTHERS LIMITED came up with the innovative idea of using solar PV cells to power three phase induction motors through an inverter to drive pumps. This project aims at developing an add-on circuit for this system, which can automatically switch between battery charging and pumping operations based on the input power from the solar panels. This input power is dependent on the intensity of light incident on the solar panels and thus the circuit switches according to the light intensity incident on the solar panels.

LIST OF FIGURES 2.1 SILICON SOLAR CELL..3 2.2 ENERGY BANDS IN SOLAR CELLS4 2.3 PV MODULES AND ARRAYS...4 2.4 I-V CURVES AND CHARACTERISIC CURVES..6,7 2.5 SOLAR RADIATION VS TIME CURVE...8 2.6 LIGHT INTENSITY VS VOLTAGE CURVE...9 2.7 GENERAL BLOCK DIAGRAM OF R5F2127..11 2.8 PIN CONFIGURATION OF R5F2127...12 2.9 MEMORY MAP OF R5F2127...16 3.1 LM 338 CONNECTION DIAGRAM.18 3.2. CIRCUIT DIAGRAM FOR SWITCHING..21 3.3 INTERFACING WITH R5F212722 3.4 SWITCHES AND REFERENCE VOLTAGES..23

LIST OF TABLES 3.1 PIN FUNCTIONS OF R5F2127..13,14 3.2 PIN FUNCTIONS OF LCD DISPLAY20

NOTATIONS AND ABBREVIATIONS

1.KBL-Kirloskar Brothers Limited 2.SVPWM- Space Vector Pulse Width Modulation 3.MPPT- Maximum Power Point Tracking 4.Wp- Watt Peak 5.ADC- Analog to Digital Converter 6.AM- Atmospheric Mean 7.Vref- Reference Voltage 8.Vout-Output Voltage 9.Iadj- Adjustment Current 10.P0_x-Port 0 pin x 11.RLY1,RLY2- Relay 1 and 2 12. SW1 and SW2- Switches 1 and 2 13. RS- Register Select 14.RW- Read/Write 15.EN-Enable 16. RxD, TxD- Receive/Transmit Data serially 17. Voc Open Circuit Voltage 18.Vmp Volatage at maximum power 19. Isc- Short Circuit Current 20. Imp Current at Maximum Power

TABLE OF CONTENTS

Acknowledgements Abstract List of figures List of Tables Notations and Abbreviations

i ii iii iv v

1. Chapter 1 1.1 Introduction...1 1.2 The Concept..1 1.3 Problem Statement.. .1 1.4 Objective1-2 1.5 Line Diagram2 2. Chapter 2-Review of related Literature 2.1 Fundamentals of solar power3-5 2.2 I-V Characteristics of Solar cells6-10 2.3 Effect of Light intensity on solar efficiency..10-13 2.4 Introduction to the Renesas R5F2127 Microcontroller..13-18 3. Chapter 3- Methods and Procedure 3.1 Describing the elemental Design..19 3.2 Basic design of the circuit.19 3.3 Code for the microcontroller.26 3.4Testing the circuit...48 3.5 Battery sizing.49 4. Chapter 4- Results and Summary..52 5. References..54

CHAPTER 1 1.1 INTRODUCTION Kirloskar brothers limited (kbl) is one of the world's leading manufacturers of pumps. Ranging from submersible to solar pumps, they offer a wide variety of options for its valued customers. KBL has recently enterred into the solar pumping business and in a short span of time has created revolutionising technology for its solar pumps. The following project in based on solar powered pumps that have been rolled out by Kirloskar recently. As we all know, solar power can be harnessed in two forms: Thermal form( using solar power plants). Photovoltaic form(using photovoltaic cells) The solar pumps that have been developed by KBL use the second form, i.e, they use an array of photovoltaic cells to harness solar energy to power the motor-pump set. This is done by using solar cell modules to obtain DC current and then using a patented inverter to convert the DC power into AC power and to maximise the efficiency of the solar pumps. This power is then fed to a 3-phase induction motor that is used to run the pump set. 1.2 THE CONCEPT The solar pumps at KBL use 3 phase AC induction motors to drive a pump. These are supplied through a large solar panel(of adequate size) and a patented solar power conditioning unit (SPCU) called the JALVERTER. The main function of the Jalverter is to convert the DC power output from solar panels into 3 phase SVPWM(Space Vector Pulse Width Modulated) AC power to supply to the induction motor. It also performs certain optimisation functions so as to maximise the efficiency of the entire system using a technique called MPPT(Maximum Power Point Tracking). 1.3 PROBLEM STATEMENT During morning and evening hours when the intensity of solar radiation is too low to supply enough power to drive the motor, the power produced (around 600Wp from a 2400Wp module) , is wasted. We can use this power to charge a suitably sized battery during morning and evening hours so that the power from this battery can be used to drive light loads such as household loads like TV, lighting,etc.during hours when power is unavailable, through the Jalverter. This is useful in rural areas where the solar pumps are most likely to be used(for irrigation etc.) due to the absence of power supply or the erratic nature of supply.

10

Objective: 1.The design will require the use of a current sensor/voltage sensor that senses the current/voltage variations from the solar panel. The sensor is interfaced to a micrococontroller via an ADC . 2.When the current/voltage is below a certain level , the controller is programmed in such a way that it switches ON the charging unit. When power is sufficient for the pump to be driven, the controller switches the pump ON and the charger OFF 3.The switching action can be achieved through MOSFETs or SCRs or GTOs ,etc or power relays such as sugar cube relays.. 4.The battery is sized according to the power available for charging. This battery is connected to the Jalverter(which is basically an inverter) to provide 1-Phase power supply to rural households for a specified amount of time. 1.4 LINE DIAGRAM During low solar intensitySOLAR PANELSAuto Switch ckt.BATTERY During High Solar intensitySOLAR PANELSJALVERTERPUMP During Night(No Solar Incidence)BATTERYJALVERTERHOUSEHOLD

Thus during low solar intensity hours, the power obtained from the solar modules can be diverted to the battery instead of wasting it in supplying the losses of the motor(copper losses,iron losses,etc.). This battery is appropriately sized and can be used to power household supplies. Thus the two objectives are: 1. Design of switching circuitry(automated). 2. Appropriate sizing of battery.

11

CHAPTER 2 REVIEW OF RELATED LITERATURE 2.1 FUNDAMENTALS OF SOLAR POWER As mentioned earlier, there are two methods of harnessing solar power, these are: 1. Thermal methods(solar ponds,etc.) 2. Photovoltaic method( Using solar cells). In this project, we have used solar cells to power the solar pumps. Solar Cells:

Fig.2.1 Silicon solar cell The above diagram shows a typical crystalline silicon solar cell. The electrical current generated in the semiconductor is extracted by contacts to the front and rear of the cell. The top contact structure, which must allow light to pass through, is made in the form of widely spaced thin metal strips (usually called fingers) that supply current to a larger bus bar. The cell is covered with a thin layer of dielectric material - the anti-reflection coating, ARC - to minimise light reflection from the top surface.

12

Fig.2.2 Energy bands in solar cells Solar cells are essentially semiconductor junctions under illumination. Light generates electron-hole pairs on both sides of the junction, in the n-type emitter and in the p-type base. The generated electrons (from the base) and holes (from the emitter) then diffuse to the junction and are swept away by the electric field, thus producing electric current across the device. Note how the electric currents of the electrons and holes reinforce each other since these particles carry opposite charges. The p-n junction therefore separates the carriers with opposite charge, and transforms the generation current between the bands into an electric current across the p-n junction. When solar cells are arranged in a series-parallel connection to obtain a desired voltage, the resulting structure is called a solar module. These modules are then connected in series to form a panel and these panels are grouped to form arrays of solar cells.

Fig.2.3 PV modules and arrays


13

2.2 I-V CHARACTERISTICS OF A SOLAR CELL:

I= Is(exp(qv/kt)-1-Iph Iph=qaG(Lh+Le) On Open Circuit:

14

The current is zero hence solar cell delivers maximum voltage. Also, power= Vx I=0 On Short Circuit:

The voltage across the diode is zero. The solar cell delivers maximum current. Power Output= VxI=0. Also, on short circuit, the current Isc= -Iph=-qaG(Lh+Le) On Arbitrary Load:

15

The dashed region shows the range of external bias where power is generated. P=VxI<0 Thus , the following is the I-V curve of a solar cell:

Fig.2.4(a). I-V curves of a solar cell

16

As shown in the above figure, the I-V curve of the solar cells has been plotted at 1sun,i.e at Temp=25 deg. Celsius AM=1.5 Energy=1000W/m2 Voc denotes the open circuit voltage while Isc denotes the short circuit current. Imp and Vmp denote the voltage and current at maximun power(Ump). The maximum power point is Pmpp and is denoted at the knee of the curve. This is the point where power obtained from the solar cell is maximum and the voltage and current at this point are Vmp and Imp respectively. The following figure shows the effect of decrease in the intensity of solar incidence on the I-V characteristics of the solar cell:

Fig.2.4(b). Characteristic curves of a solar cell As seen from the above figure, if the intensity of solar radiation per sq. metre decreases, the Voc and the Vmp remain relatively constant but the Isc and the Imp decrease. Thus we can see that the output voltage of a solar panel reduces gradually with decrease the intensity of solar radiation but the output current decreases drastically with a decrease in the intensity of solar radiation.

17

Also , with an increase in temperature(by around 25 degrees), both the output current and voltage from the solar panels tend to decrease. But since the variation of temperatures during day time is very less (around + or 5 degrees celsius), we consider the effect of temperature to be negligible.

Concept of Peak Sun Hours: Solar power per unit area falling on earth normally follows a flatter at top, bell shaped curve similar to one shown below. The energy received during morning and evening hours is less than that during the period say, 11 am to 2 pm. If we add up all the energy from just after sunrise to just before sunset (7 am to 5 pm), in India, it Approximately adds up to 5.5 kWhrs / sq.m.. In other words, this is as if 1000W solar power is falling continuously for 5.5 hours on 1 sq.m. area kept horizontally. This 5.5 hours is then called as Peak Sun Hours ( in India ) , which can be defined technically as the equivalent number of hours per day if solar irradiance had averaged at 1000 W/m2 .

Hence, the approximate power produced by a solar module is P=kWpx Peak sun hours Wp= the power produced by a solar module under test conditions i.e at 1sun.

2.3 EFFECT OF LIGHT INTENSITY ON SOLAR EFFICIENCY Hypothesis For non-ideal solar cells, voltage output related to varying light intensity exhibits diminishing returns: that is, as light intensity increases, the increase in voltage output drops off. Setup
18

Materials: Lamp with 60W light bulb Variable transformer, 120V Cardboard box Solar cell panel (9V, 50mA) Electronic voltmeter with 0-20V range Electronic Light probe Computer with light probe software Procedure: 1. Set up your materials as shown in picture. The lamp, solar cell panel and light probe should all be inside the cardboard box, to avoid light pollution by ambient light. The light probe should be propped up at such an angle that it is directly facing the light that the lamp is providing. Connect the lamp to the transformer, and connect the transformer to your power source. The solar cell panel should be connected to the voltmeter, and the light probe connected to the computer or other device to interpret the readings of the light probe. 2. Start by taking your baseline readings. Record the amount of light intensity in lux and amount of voltage that is output by the solar cell when there is no power to the lamp. 3. Next, turn the transformer to 100% of its power source (to avoid artificially deflated lux values due to hysteresis) and record the power output by the solar cell. Also, to record the light intensity, set the light probe to get data points for five seconds, with five probes per second. This way you can record the fluctuating light intensity and determine the average light intensity for that power output. 4. Repeat step 3 at 90% of the transformer's power, then continue to reduce the power at 10% intervals until reaching 0% again. 5. Take off the cardboard box for about five minutes, as the temperature inside the box builds up and might skew results. 6. Repeats steps 3 through 5 two more times, to provide more data for accurate results.

Fig.2.5. Voltage vs Light intensity curve


19

Inference Our hypothesis is completely justified, given the results of our experiment. As the light intensity increases, the increase in voltage production drops off. It took nearly 3 times as much light intensity to create a 10 volt output as it did to produce 7.5volts of output: a onethird increase in productiveness for a 3x increase in solarraw materials.The strengths of our approach are many. First, the use of the electronic light probe enabled us to take 25 samples for each trial for three trials, resulting in 75measures of light intensity. This helps reduce the margin of error for the independent variable. Second, the setup shielded the solar cell as much as possible from ambient light, and used a non-reflective surface and container (black butcher paper and cardboard box) which ensures that the cell and the probe are exposed to the same proportion of the available light. Additionally, a five-minute cooldown period between each trial was given, which limits interference from raised temperatures. Most of the limitations of the approach are related to the poor quality of the equipment used, specifically the solar cell itself. Series resistance in the structure ofthe cell is a part of what creates the diminishing returns effect, and the low quality of our cell exaggerates this tendency beyond what may be considered reasonable in one of industrial or research quality. Additionally, because we did not stop between each different lux value but instead between different trials, accumulated radiant heat would deflate the voltage output at later values within each trial.

Results: Hence we find that: 1.With an increase in light intensity, the voltage output of the solar cell increases and vice versa. 2. The rate of increase of voltage is linear at first then it gradually drops off and saturates near open circuit voltage.

20

2.4 INTRODUCTION TO RENESAS R5F2127 16-BIT MICROCONTROLLER: GENERAL BLOCK DIAGRAM OF R5F2127

Fig.2.6. General block diagram of R5F2127

The Renesas R5F2127SDF microcontroller is a 16 bit microcontroller. It has the following specifications: Program ROM: 16Kb RAM: 1Kb Data Flash: 1Kb x 2

21

PIN CONFIGURATION:

Fig.2.7.Pin Configuration of R5F2127

22

TABLE OF PIN FUNCTIONS:

Table 2.1 List of pin functions of R5F2127

23

Table 2.1(contd.) CENTRAL PROCESSING UNIT: Data Registers (R0, R1, R2, and R3) R0 is a 16-bit register for transfer, arithmetic, and logic operations. The same applies to R1 to R3. R0 can be split into high-order bits (R0H) and low-order bits (R0L) to be used separately as 8-bit data registers. R1H and R1L are analogous to R0H and R0L. R2 can be combined with R0 and used as a 32-bit data register (R2R0). R3R1 is analogous to R2R0. Address Registers (A0 and A1) A0 is a 16-bit register for address register indirect addressing and address register relative addressing. It is also used for transfer, arithmetic, and logic operations. A1 is analogous to A0. A1 can be combined with A0 to be used as a 32-bit address register (A1A0). Frame Base Register (FB) FB is a 16-bit register for FB relative addressing. Interrupt Table Register (INTB) INTB is a 20-bit register that indicates the start address of an interrupt vector table. Program Counter (PC) PC is 20 bits wide and indicates the address of the next instruction to be executed. User Stack Pointer (USP) and Interrupt Stack Pointer (ISP) The stack pointers (SP), USP, and ISP, are each 16 bits wide. The U flag of FLG is used to switch between USP and ISP. Static Base Register (SB) SB is a 16-bit register for SB relative addressing. Flag Register (FLG) FLG is an 11-bit register indicating the CPU state. Carry Flag (C) The C flag retains carry, borrow, or shift-out bits that have been generated by the arithmetic and logic unit.

24

Debug Flag (D) The D flag is for debugging only. Set it to 0. Zero Flag (Z) The Z flag is set to 1 when an arithmetic operation results in 0; otherwise to 0. Sign Flag (S) The S flag is set to 1 when an arithmetic operation results in a negative value; otherwise to 0. Register Bank Select Flag (B) Register bank 0 is selected when the B flag is 0. Register bank 1 is selected when this flag is set to 1. Overflow Flag (O) The O flag is set to 1 when an operation results in an overflow; otherwise to 0. Interrupt Enable Flag (I) The I flag enables maskable interrupts. Interrupt are disabled when the I flag is set to 0, and are enabled when the I flag is set to 1. The I flag is set to 0 when an interrupt request is acknowledged. Stack Pointer Select Flag (U) ISP is selected when the U flag is set to 0; USP is selected when the U flag is set to 1. The U flag is set to 0 when a hardware interrupt request is acknowledged or the INT instruction of software interrupt numbers 0 to 31 is executed. Processor Interrupt Priority Level (IPL) IPL is 3 bits wide and assigns processor interrupt priority levels from level 0 to level 7. If a requested interrupt has higher priority than IPL, the interrupt is enabled. Reserved Bit If necessary, set to 0. When read, the content is undefined. MEMORY: Figure below shows a Memory Map of R8C/26 Group. The R8C/26 group has 1 Mbyte of address space from addresses 00000h to FFFFFh. The internal ROM is allocated lower addresses, beginning with address 0FFFFh. For example, a 16-Kbyte internal ROM area is allocated addresses 0C000h to 0FFFFh. The fixed interrupt vector table is allocated addresses 0FFDCh to 0FFFFh. They store the starting address of each interrupt routine. The internal RAM is allocated higher addresses beginning with address 00400h. For example, a 1-Kbyte internal RAM area is allocated addresses 00400h to 007FFh. The internal RAM is used not only for storing data but also for calling subroutines and as stacks when interrupt requests are acknowledged. Special function registers (SFRs) are allocated addresses 00000h to 002FFh. The peripheral function control registers are allocated here. All addresses within the SFR, which have nothing allocated are reserved for future use and cannot be accessed by users.

25

Fig.2.8. Memory map of R5F2127

26

CHAPTER 3 METHODS AND PROCEDURE The following section describes the methodology observed for designing the circuit. 3.1 DESCRIBING THE ELEMENTAL DESIGN This section deals with a basic outline of the circuit to be designed. It goes over the elements required for the circuit and the block or line diagram layout of the circuit. It was earlier observed that the output voltage and current from a solar cell decreases with decrease in the intensity of light. Hence to detect the change in light intensity we can use voltage or current sensors. In the following circuit we have used voltage sensors which are interfaced with the microcontroller via its ADC. A current sensor has also been interfaced for future use and reprogramming. Since the model being designed is a miniature version of the actual circuit, we have used a 20 watt panel instead of a much larger one which is used with a solar pump. The switching operation in the circuit can be provided using various methods such as using SCRs, Relays, etc. In this model, sugar cube relays have been used for performing switching. Hence we can draw the line diagram as follows: Solar panelVoltage sensorscontrollerRelay 1Pump or battery SwitchcontrollerRelay 2 JALVERTER

3.2 BASIC DESIGN OF THE CIRCUIT: The input power to the circuit is provided from the solar panel. This panel also powers the Relays for switching and provides the voltage for the microcontroller. Hence, to provide a constant voltage for the Relays (14V) and for the microcontroller (5V), we use voltage regulators, i.e, LM338 and LM 317. To increase the current capacity we use two LM338 ICs. Voltage Regulators (LM338): The LM338 series of adjustable 3-terminal positive Voltage regulators is capable of supplying in excess besides replacing fixed regulators or discrete of 5A over a 1.2V to 32V output range. They require only 2 resistors to set the output voltage. In operation, the LM138 develops a nominal 1.25V reference voltage, VREF, between the output and adjustment terminal. The reference voltage is impressed across program resistor R1 and, since the voltage is constant, constant current I1 then flows through the output set resistor R2, giving an output voltage have

27

Representation of connection:

Fig.3.1.Representation of connection of LM338 An input bypass capacitor is recommended. A 0.1 F disc or 1 F solid tantalum on the input is suitable input bypassing for almost all applications. In the circuit designed For LM 338 R1=270 ohms R2=22k parallel to 3.3k Vout=14.60V For LM 317 R1=270 ohms R2=22k parallel to 820 ohms Vout=5V A 0.1F input bypass capacitor has been provided for input bypassing. Also, a 2200f capacitor has been provided so as to filter out any ripples from the solar panel. In the absence of solar input, the relays and the controller can be powered by the battery. To prevent the backflow of current into the solar panel a diode D1 has been provided. Sensing the input voltage and Current: The input voltage from the solar panel is sensed using a voltage sensor that consists of a small voltage division circuit. This circuit uses resistors to set 2.4V output for a 22V input. The resistors are depicted as R10=270k and R11=33k. This circuit is then interfaced to the microcontroller via its ADC pin P0_7.
28

The current sensing circuit consists of a .33-ohm resistor, which converts the current into equiavalent voltage (like a current shunt). This voltage is amplified using an op-amp and is interfaced with the microcontroller via ADC pin P0_5. Hence using the above circuitry, current and voltage inputs from the solar panel are sensed by the microcontroller. The voltage from the Battery terminals is also sensed similar to that of the solar panel. The two resistors used here are R13=270k and R16=33k to set an output of 1.5V for 14V DC. This is interfaced to the microcontroller via ADC pin P0_6. Relays: The circuit developed uses two sugar cube relays RLY1 and RLY2. These are rated at 12V and 7.5A. A sugar cube relay is a basic electromagnetic relay, which is used to switch between two independent functions. In this case, RLY1 switches between pumping and battery charging. The relay is connected to the output port of the microcontroller P0_2 via a mosfet. The Mosfet amplifies the signal from the controller, which turns the relay ON. When Relay 1 is OFF, the battery charging occurs. When Relay 1 is turned on, it switches to Pumping operation via the JALVERTER. Relay 2 is used to divert the power from the Battery to the JALVERTER. This relay is turned ON manually by the user using a switch SW2 and turned OFF using switch SW3. When Relay 2 is switched ON the terminal S1 and S2 are short circuited so that the power from the battery is given to the JALVERTER. This way we can use the battery to supply households via the JALVERTER. LED Indication: L1-Power ON L2- JALVERTER ON L3- Battery ON. L4- Setting mode.

LCD Display Interfacing: Liquid Crystal Display also called, as LCD is very helpful in providing user interface as well as for debugging purpose. The most common type of LCD controller is HITACHI 44780, which provides a simple interface between the controller & an LCD. In this circuit, we have used a 16x2 LCD display (16 characters with 2 lines). The LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data lines. The number on data lines depends on the mode of operation. If operated in 8-bit mode then 8 data lines + 3 control lines i.e. total 11 lines are required. And if operated in 4-bit mode then 4 data lines + 3 control lines i.e. 7 lines are required.

29

Pin 1 2 3 4 5 6

Symbol Vss Vdd Vo RS R/W En

Function Ground Supply Voltage Contrast Setting Register Select Read/Write Select Chip Enable Signal Data Lines Gnd for the backlight Vcc for backlight

7-14 DB0-DB7 15 16 A/Vee K

Table 3.2. Pin configuration of LCD The above table shows the functions of the various pins in the LCD display. These pins are interfaced with pins with ports P1 and P3 of the microcontroller. This display is used to show the Voltage and current from the PV panel and also the battery. It is also used to set the voltage threshold for the switching operations. Switches: There are four switches provided in the circuit. These are basic Tact switches that are interfaced to the pins 1,4,6 and 26 of the controller respectively. The various functions of the switches are: SW1-Mode select for selecting Threshold Voltage. SW2-Increment threshold/ RLY 2 ON SW3-Decrement threshold/RLY 2 OFF SW4- Enter/LED ON. RS232 Interface: To transmit information regarding the Panel voltage, current, battery voltage, etc., serially, an RS232 connector has been provided. This is interfaced via the MAX232 IC to match the Voltage levels between TTL and CMOS logics. TxD represents serial transmission from the controller and RxD represents serial reception by a modem or a PC.

3.3 CODE FOR THE MICROCONTROLLER: The Renesas controller has been programmed using C as a platform and this Renesas software has been used to convert this C code into hex code and burn it into the controller. The following is the program burnt into the controller for automated switching, LCD display operation etc.

30

#include"sfr_r827.h" //LCD CONTROL #defineLCD #defineRS #defineEN //BUZZER #defineBUZZER //SWITCH #defineMODE #defineINC #defineDEC #defineENTER //RELAY #defineRELAY1 #defineRELAY2 #defineMOSFET //LED INDICATION #defineBAT_LED #defineSET_LED //ADC CHANNEL #definePV_CH #define BAT_CH #define I_CH

p1 p3_4 p3_3

p0_0

p3_5 p4_7 p4_6 p0_4

p0_2 p0_1 p3_6

p0_3 p3_1

0 1 2

//INTER FLASH ADDRESS #define BLOCK_A 0x2400; //CURRENT 0.00A-2.00A #define UPPERLIMIT_I #define LOWERLIMIT_I #define SET_SPAN_I #define I_OFFSET #define I_SIZE

970 1 (UPPERLIMIT_I - LOWERLIMIT_I) 1 199

//BATTERY VOLTAGE 00.0V-16.0V #define UPPERLIMIT_BV 694 #define LOWERLIMIT_BV 1 #define SET_SPAN_BV (UPPERLIMIT_BV - LOWERLIMIT_BV) #define BV_OFFSET 1 #define BV_SIZE 159 //PV VOLTAGE 00.0V-22.0V #define UPPERLIMIT_PV 975
31

#define LOWERLIMIT_PV 1 #define SET_SPAN_PV #define PV_OFFSET 1 #define PV_SIZE #define RELAY_DELAY #define BAT_DELAY #define SET_BAT_VOLTAGE #define RESET_BAT_VOLTAGE

(UPPERLIMIT_PV - LOWERLIMIT_PV) 229 12 10 120 100

//DELAY 0 - 65535 void DELAY(unsigned int NUM1); void DELAY_MSEC(unsigned int NUM2); //SELECT 10MHz void SET_WORKING_FREQ(void); //SET IO void SET_IO(void); //LCD 2x16 void SET_LCD(void); void COM_DATA(unsigned char VALUE,unsigned char ORDER); Void LCD_POS (unsigned char LINE, unsigned char POS); void PRINT(unsigned char I); void CURSOR_OFF(void); void CURSOR_BLINK(void); void CURSOR_STADY(void); //SET ADC SETTING void SET_ADC(void); //READ ADC CHANNEL unsigned int ADC_READ(unsigned char CHANNEL_NO); //CALCULATE CURRENT 000A-200A unsigned int CURRENT(unsigned int I_DATA); //CALCULATE BATTERY VOLTAGE 00.0V-16.0V unsigned int BATV(unsigned int V_DATA); //CALCULATE PV VOLTAGE 00.0V-22.0V unsigned int PVV(unsigned int V_DATA); //DISPLAY CURRENT AND VOLTAGE void DISPLAY_CURRENT(unsigned char HEX); void DISPLAY_VOLTAGE(unsigned char HEX); //SERIAL COMMUNICATION void LOAD_UART1(const unsigned char *PTR); void SEND_UART1(unsigned char VALUE); void SET_UART1(void); //BUZZER BEEP void BUZZER_BEEP(unsigned char I);
32

void SET_PV(void); //FLASH READ WRITE void READ_FLASH(void); void EraseBlock(void); void WriteBlock(void); void SEND_VOLTAGE(unsigned char HEX); void SEND_CURRENT(unsigned char HEX); void CONVERT_HTOS(unsigned int HEX); //FLASH ADDRESS unsigned char *flash_addr; //16-BIT VALUE unsigned int ADC_COUNT = 0; //8-BIT VALUE unsigned char PV_VOLTAGE = 0; unsigned char BAT_VOLTAGE = 0; unsigned char PV_CURRENT = 0; unsigned char COUNTER1 = 0; unsigned char COUNTER2 = 0; unsigned char COUNTER3 = 0; unsigned char COUNTER4 = 0; unsigned char COUNTER5 = 0; unsigned char COUNTER6 = 0; unsigned char SET_PV_VOLTAGE = 0; unsigned char RESET_PV_VOLTAGE = 0; unsigned char SETTING_COUNTER = 0;

//BIT FLAG _Bool RELAY1_FLAG = 0; _Bool BAT_LOW_FLAG = 0; _Bool SETTING_FLAG = 0; _Bool SHOW_SCREEN = 0; _Bool MOSFET_FLAG = 0; unsigned char STORE_VALUE[3]; //LCD DATA const unsigned char TABLE[12][17] = { " ",//0 " Kirloskar ",//1 " Brothers Ltd ",//2 "PV: I: ",//3 "BAT: ",//4 "Set PV: 00.0V",//5 "Use UP/DOWN Key ",//6
33

"Factory Restored",//7 " Set PV Voltage ",//8 " Exit From ",//9 " Setting Menu ",//10 "BAT: LOW ",//11 };

void main(void) { asm("FCLR I"); //DISABLE GLOBLE INTERRUPT prc0 = 1; //PROTECTION OFF SET_WORKING_FREQ(); SET_IO(); prc3 = 1; vw0c0 = 1; vw0c6 = 1; vca25 = 1; prc3 = 0;

//Voltage monitor 0 reset enable bit //Voltage monitor 0 circuit mode select bit //Voltage detection 0 enable bit

prc0 = 0; //PROTECTION ON asm("FSET I"); //ENABLE INTERRUPTS SET_LCD(); SET_ADC(); SET_UART1(); READ_FLASH(); //LCD INITIALISE //ADC INITIALISE //SET UART1 //RESTORE

LCD_POS(1,0); PRINT(1);//" Kirloskar ",//1 LCD_POS(2,0); PRINT(2);//" Brothers Ltd ",//2 DELAY_MSEC(2000); SHOW_SCREEN = 0;

while(1) { if(!SHOW_SCREEN) { SHOW_SCREEN = 1; LCD_POS(1,0); PRINT(3);//"PV:00.0V I:00.0A",//3 LCD_POS(2,0);


34

PRINT(4);//"BAT:00.0V

",//4

SET_PV_VOLTAGE = STORE_VALUE[1]; RESET_PV_VOLTAGE = SET_PV_VOLTAGE - 20; RELAY1_FLAG = 0; BAT_LOW_FLAG = 0; SETTING_FLAG = 0; }

//450ms ADC_COUNT = ADC_READ(PV_CH); PV_VOLTAGE = PVV(ADC_COUNT); ADC_COUNT = ADC_READ(BAT_CH); BAT_VOLTAGE = BATV(ADC_COUNT); ADC_COUNT = ADC_READ(I_CH); PV_CURRENT = CURRENT(ADC_COUNT); LCD_POS(1,3); DISPLAY_VOLTAGE(PV_VOLTAGE); LCD_POS(1,11); DISPLAY_CURRENT(PV_CURRENT); LCD_POS(2,4); DISPLAY_VOLTAGE(BAT_VOLTAGE); //JALWATER ON if(PV_VOLTAGE >= SET_PV_VOLTAGE && !RELAY1_FLAG) { COUNTER1 = COUNTER1 + 1; } else { COUNTER1 = 0; } if(COUNTER1 >= RELAY_DELAY) { RELAY1 = 1;RELAY1_FLAG = 1; BUZZER_BEEP(2); } //JALWATER OFF if(PV_VOLTAGE <= RESET_PV_VOLTAGE && RELAY1_FLAG) { COUNTER2 = COUNTER2 + 1; } else { COUNTER2 = 0;
35

} if(COUNTER2 >= RELAY_DELAY) { RELAY1 = 0;RELAY1_FLAG = 0; BUZZER_BEEP(1); } //REALY2 ON/OFF if(!INC && BAT_VOLTAGE !BAT_LOW_FLAG) { RELAY2 = 1; BUZZER_BEEP(1); DELAY_MSEC(500); } else if(!DEC) { RELAY2 = 0; BUZZER_BEEP(1); DELAY_MSEC(500); } //MOSFET ON/OFF if(!ENTER && !MOSFET_FLAG) { MOSFET = 1;MOSFET_FLAG = 1; BUZZER_BEEP(1); DELAY_MSEC(1000); } else if(!ENTER && MOSFET_FLAG) { MOSFET = 0;MOSFET_FLAG = 0; BUZZER_BEEP(1); DELAY_MSEC(1000); } //BAT LOW ON if(BAT_VOLTAGE < RESET_BAT_VOLTAGE && !BAT_LOW_FLAG) { COUNTER5 = COUNTER5 + 1; } else { COUNTER5 = 0; } if(COUNTER5 >= BAT_DELAY) { BAT_LED = 0;BAT_LOW_FLAG = 1; LCD_POS(2,0); PRINT(11);//"BAT: LOW ",//11 COUNTER5 = 0;
36

>=

SET_BAT_VOLTAGE

&&

} //BAT LOW OFF if(BAT_VOLTAGE >= SET_BAT_VOLTAGE && BAT_LOW_FLAG) { COUNTER6 = COUNTER6 + 1; } else { COUNTER6 = 0; } if(COUNTER6 >= BAT_DELAY) { BAT_LED = 1;BAT_LOW_FLAG = 0;RELAY2 = 0; LCD_POS(2,0); PRINT(4);//"BAT:00.0V ",//4 COUNTER6 = 0; } //SERIAL DATA SEND LOAD_UART1(" PV:"); SEND_VOLTAGE(PV_VOLTAGE); LOAD_UART1(" PV I:"); SEND_CURRENT(PV_CURRENT); LOAD_UART1(" BAT:"); SEND_VOLTAGE(BAT_VOLTAGE); //SETTING if(!MODE) { SETTING_COUNTER = SETTING_COUNTER + 1; } else { SETTING_COUNTER = 0; } if(SETTING_COUNTER >= 5) { SETTING_COUNTER = 0;SET_LED = 0; LCD_POS(1,0); PRINT(8);//" Set PV Voltage ",//8 LCD_POS(2,0); PRINT(6);//"Use UP/DOWN Key ",//6 BUZZER_BEEP(1); RELAY1 = 0; RELAY2 = 0; BAT_LED = 1; DELAY_MSEC(1000); SETTING_FLAG = 1; LCD_POS(1,0); PRINT(5);//"Set PV: 00.0V",//5
37

} while(SETTING_FLAG) { SET_PV(); } }//WHILE-1 }//MAIN //*********************************************************** //DELAY (1 - 65535) //*********************************************************** void DELAY(unsigned int NUM1) { while(NUM1--) { asm("NOP"); } } void DELAY_MSEC(unsigned int NUM2) { while(NUM2--) { DELAY(300); } } //*********************************************************** //SET CONTROLLER WORKING FREQUENCY 10MHz //*********************************************************** void SET_WORKING_FREQ(void) { fra20 = 0;//HIGH-SPEED DIVIDE BY-2 MODE fra21 = 0;//40MHz/2 = 20MHz fra22 = 0; cm13 = 0; cm05 = 1; cm02 = 0; cm14 = 0; ocd0 = 0; ocd1 = 0; fra00 = 1; fra01 = 1; ocd2 = 1;//SYSTEM CLOCK DIVIDE BY-2 cm16 = 1;//20MHz/2 = 10MHz cm17 = 0; cm06 = 0;
38

asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP"); asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP"); asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP"); asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP"); asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP"); asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP"); asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP"); asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP"); asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP"); asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP"); } //*********************************************************** //SET IO //*********************************************************** void SET_IO(void) { //I/P PORT PIN SET - 0 //O/P PORT PIN SET = 1 //PV_CH,BAT_CH,I_CH,SW4,SET_LED,RL1,RL2,BUZZER prc2 = 1; pd0 = 0b00001111; //LCD OP pd1 = 0b11111111; //TxD,MOSFET,SW1,RS,EN,NC,BAT_LED,NC pd3 = 0b11011111; //SW2,SW3,RxD,NC,NC,REFF,NC,NC pd4 = 0b00011011; pd5_3 = 1;//SCL pd5_4 = 1;//SDA RELAY1 = 0; RELAY2 = 0; BAT_LED = 1; SET_LED = 1; } //********************************************************************** //LCD INITIALISE //********************************************************************** void SET_LCD(void) { COM_DATA(0x38,0); DELAY_MSEC(50);
39

COM_DATA(0xC,0); DELAY_MSEC(50); COM_DATA(1,0); DELAY_MSEC(50); COM_DATA(6,0); DELAY_MSEC(50); COM_DATA(0xC,0); DELAY_MSEC(50); } //********************************************************************** //LCD DATA AND COMMAND //********************************************************************** void COM_DATA(unsigned char VALUE,unsigned char ORDER) { if(!ORDER) { asm("NOP"); RS = 0; } else { asm("NOP"); RS = 1; } asm("NOP"); LCD = VALUE; asm("NOP"); EN = 1; DELAY(100); EN = 0; DELAY(100); } //********************************************************************** //DISPLAY DATA ON LCD //********************************************************************** void PRINT(unsigned char I) { unsigned char J = 0,DATA = 0; for(J = 0; J < 16; J++) { DATA = TABLE[I][J]; COM_DATA(DATA,1); } } //********************************************************************** //LCD POSITION
40

//********************************************************************** void LCD_POS(unsigned char LINE,unsigned char POS) { if(LINE == 1) { COM_DATA(128 + POS,0); } else { COM_DATA(192 + POS,0); } } //********************************************************************** //LCD CURSOR BLINK AND STABLE COMMAND //********************************************************************** void CURSOR_BLINK(void) { COM_DATA(0x0F,0); } void CURSOR_STADY(void) { COM_DATA(0xE,0); } //********************************************************************** //LCD CURSOR OFF //********************************************************************** void CURSOR_OFF(void) { COM_DATA(0xC,0); } //********************************************************************** //SET ADC SETTING //********************************************************************** void SET_ADC(void) { cks0_adcon0 = 0;//DIVIDE BY-4 cks1_adcon1 = 0; md = 0; bits = 1; vcut = 1; smp = 1; } //********************************************************************** //READ ADC CHANNEL //**********************************************************************
41

//10-BIT ADC SELECT //EXTERNAL REFF SELECT //SAMPLE AND HOLD SELECT

unsigned int ADC_READ(unsigned char CHANNEL_NO) { unsigned char FOR_COUNT = 0; unsigned int ADC_READ = 0,ADC_VALUE = 0; //150msec for(FOR_COUNT = 1; FOR_COUNT <= 10; FOR_COUNT++) { adcon0 = CHANNEL_NO; adst = 1; DELAY_MSEC(10); ADC_READ = 0x03FF & ad; ADC_VALUE = ADC_VALUE + ADC_READ; DELAY_MSEC(5); } ADC_VALUE = ADC_VALUE / 10; return ADC_VALUE; } //********************************************************************** //CALCULATE CURRENT 000A-200A //********************************************************************** unsigned int CURRENT(unsigned int I_DATA) { unsigned long int I = 0; unsigned int DATA = 0; DATA = I_DATA; if(DATA < LOWERLIMIT_I) { DATA = LOWERLIMIT_I; } else if(DATA > UPPERLIMIT_I) { DATA = UPPERLIMIT_I; } DATA = DATA - LOWERLIMIT_I; I = (unsigned long int)DATA * I_SIZE;//(0.5A-30A) DATA = (I / SET_SPAN_I) + I_OFFSET; if(DATA == I_OFFSET) { DATA = 0; } return DATA; }
42

//********************************************************************** //CALCULATE BATTERY VOLTAGE 00.0V-16.0V //********************************************************************** unsigned int BATV(unsigned int V_DATA) { unsigned long int I = 0; unsigned int DATA = 0; DATA = V_DATA; if(DATA < LOWERLIMIT_BV) { DATA = LOWERLIMIT_BV; } else if(DATA > UPPERLIMIT_BV) { DATA = UPPERLIMIT_BV; } DATA = DATA - LOWERLIMIT_BV; I = (unsigned long int)DATA * BV_SIZE; DATA = (I / SET_SPAN_BV) + BV_OFFSET; if(DATA == BV_OFFSET) { DATA = 0; } return DATA; } //********************************************************************** //CALCULATE PV VOLTAGE 00.0V-22.0V //********************************************************************** unsigned int PVV(unsigned int V_DATA) { unsigned long int I = 0; unsigned int DATA = 0; DATA = V_DATA; if(DATA < LOWERLIMIT_PV) { DATA = LOWERLIMIT_PV; } else if(DATA > UPPERLIMIT_PV) { DATA = UPPERLIMIT_PV; }

43

DATA = DATA - LOWERLIMIT_PV; I = (unsigned long int)DATA * PV_SIZE; DATA = (I / SET_SPAN_PV) + PV_OFFSET; if(DATA == PV_OFFSET) { DATA = 0; } return DATA; } //************************************************************** //DISPLAY VOLTAGE //************************************************************** void DISPLAY_VOLTAGE(unsigned char HEX) { unsigned char POS = 0,VALUE = 0; VALUE = HEX; POS = VALUE / 100; //5 POS = 0x30 + POS; COM_DATA(POS,1); VALUE = VALUE % 100;//55 POS = VALUE / 10; //5 POS = 0x30 + POS; COM_DATA(POS,1); COM_DATA('.',1); POS = VALUE % 10;//5 POS = 0x30 + POS; COM_DATA(POS,1); COM_DATA('V',1); } //************************************************************** //DISPLAY CURRENT //************************************************************** void DISPLAY_CURRENT(unsigned char HEX) { unsigned char POS = 0,VALUE = 0; VALUE = HEX; POS = VALUE / 100; //5 POS = 0x30 + POS;
44

COM_DATA(POS,1); COM_DATA('.',1); VALUE = VALUE % 100;//55 POS = VALUE / 10; //5 POS = 0x30 + POS; COM_DATA(POS,1); POS = VALUE % 10;//5 POS = 0x30 + POS; COM_DATA(POS,1); COM_DATA('A',1); }

//*********************************************************** //UART1 SETTING BAUDE RATE 9600 //*********************************************************** void SET_UART1(void) { uart1sel1 = 0; //P4_5(RXD1) uart1sel0 = 1; //P3_7(TXD1) u1pinsel = 1; txd1sel = 1; txd1en = 0; //UART mode transfer data 8 bits long selected smd0_u1mr = 1; smd1_u1mr = 0; smd2_u1mr = 1; //Internal clock selected ckdir_u1mr = 0; //1 stop bit selected stps_u1mr = 0; //Parity disabled prye_u1mr = 0; //BRG count source f8 selected clk0_u1c0 = 1; clk1_u1c0 = 0; //TXD0 pin CMOS output nch_u1c0 = 0; //Transfer LSB first
45

uform_u1c0 = 0; //Setting UART0 baud rate generator(max 255). //Calculated value is round to the nearest whole number u1brg = 15; asm("NOP"); te_u1c1 = 1; asm("NOP"); re_u1c1 = 1; s1ric = 0x07; } void SEND_UART1(unsigned char VALUE) { asm("NOP"); u1tb = VALUE; while(!txept_u1c0); DELAY(250);//1-MSEC } void LOAD_UART1(const unsigned char *PTR) { while(*PTR != '\0') { asm("NOP"); u1tb = *PTR; while(!txept_u1c0); DELAY(300);//1-MSEC PTR++; } }

void BUZZER_BEEP(unsigned char I) { while(I--) { BUZZER = 1; DELAY_MSEC(150); BUZZER = 0; DELAY_MSEC(100); } } void SET_PV(void) { _Bool SCAN = 0; unsigned char ESC_COUNTER = 0;

46

SET_PV_VOLTAGE = STORE_VALUE[1]; LCD_POS(1,11); DISPLAY_VOLTAGE(SET_PV_VOLTAGE); DELAY_MSEC(1000); BUZZER_BEEP(2); while(!SCAN) { ESC_COUNTER = ESC_COUNTER + 1; SET_LED =! SET_LED; if(!INC) { SET_PV_VOLTAGE = SET_PV_VOLTAGE + 1; if(SET_PV_VOLTAGE > 200) { SET_PV_VOLTAGE = 100; } DELAY_MSEC(150); ESC_COUNTER = 0; } else if(!DEC) { SET_PV_VOLTAGE = SET_PV_VOLTAGE - 1; if(SET_PV_VOLTAGE < 100) { SET_PV_VOLTAGE = 200; } DELAY_MSEC(150); ESC_COUNTER = 0; } DELAY_MSEC(200); LCD_POS(1,11); DISPLAY_VOLTAGE(SET_PV_VOLTAGE); if(!ENTER || ESC_COUNTER >= 75) { SCAN = 1; SETTING_FLAG = 0; STORE_VALUE[1] = SET_PV_VOLTAGE; EraseBlock(); WriteBlock(); SET_LED = 1; LCD_POS(1,0); PRINT(9);//" Exit From ",//9 LCD_POS(2,0); PRINT(10);//" Setting Menu ",//10 BUZZER_BEEP(4); DELAY_MSEC(1000); SHOW_SCREEN = 0; } } }
47

//********************************************************** //CLEAR ALL FLASH RAM //********************************************************** void EraseBlock(void) { asm("FCLR I"); // Turn off maskable interrupts fmr01 = 0; fmr01 = 1; fmr11 = 0; fmr11 = 1;

// Set EW0 select bit // Set to EW1 mode

flash_addr = &(unsigned char)BLOCK_A; *flash_addr = 0x50; *flash_addr = 0x20; *flash_addr = 0xD0; // Clear status register // Send erase command // Send erase confirm command

/* Note: In EW1 Mode, the MCU is suspended until the operation is completed */ fmr0 = 0; /* Disable CPU rewriting commands by clearing EW entry bit */ asm("FSET I"); } //********************************************************** //WRITE FLASH RAM //********************************************************** void WriteBlock(void) { unsigned char I = 0; flash_addr = &(unsigned char)BLOCK_A; asm("FCLR I"); fmr01 = 0; fmr01 = 1; fmr11 = 0; fmr11 = 1; *flash_addr = 0x50; // Turn off maskable interrupts // Restore I flag to previous setting

// Set EW0 select bit // Set to EW1 mode // Clear status register

/* Write to the flash sequencer by writing to that area of flash memory */ for(I = 1; I <= 2; I++) { *flash_addr = 0x40; // Send write command *flash_addr = STORE_VALUE[I]; // Write next word of data flash_addr++; }

48

/* Note: In EW1 Mode, the MCU is suspended until the operation completed */ /* NOTE: The R8C writes to flash a 8 bits at a time where as the M16C /* Disable CPU rewriting commands by clearing EW entry bit */ fmr0 = 0; asm("FSET I"); } //********************************************************** //READ FLASH //********************************************************** void READ_FLASH(void) { unsigned char I = 0; flash_addr = &(unsigned char)BLOCK_A; for(I = 1; I <= 2; I++) { STORE_VALUE[I] = *flash_addr;//ORDLOAD TRIP CURRENT flash_addr++; } //RESET DEFAULT if(STORE_VALUE[2] != 1 || !MODE) { STORE_VALUE[1] = 160; STORE_VALUE[2] = 1; EraseBlock(); WriteBlock(); LCD_POS(1,0); PRINT(0);// LCD_POS(2,0); PRINT(7);//"Factory Restored",//7 DELAY_MSEC(2000); BUZZER_BEEP(3); } } //************************************************************** //DISPLAY VOLTAGE //************************************************************** void SEND_VOLTAGE(unsigned char HEX) { unsigned char POS = 0,VALUE = 0;

// Restore I flag to previous setting

49

VALUE = HEX; POS = VALUE / 100; //5 POS = 0x30 + POS; SEND_UART1(POS); VALUE = VALUE % 100;//55 POS = VALUE / 10; //5 POS = 0x30 + POS; SEND_UART1(POS); SEND_UART1('.'); POS = VALUE % 10;//5 POS = 0x30 + POS; SEND_UART1(POS); SEND_UART1('V'); } //************************************************************** //DISPLAY CURRENT //************************************************************** void SEND_CURRENT(unsigned char HEX) { unsigned char POS = 0,VALUE = 0; VALUE = HEX; POS = VALUE / 100; //5 POS = 0x30 + POS; SEND_UART1(POS); SEND_UART1('.'); VALUE = VALUE % 100;//55 POS = VALUE / 10; //5 POS = 0x30 + POS; SEND_UART1(POS); POS = VALUE % 10;//5 POS = 0x30 + POS; SEND_UART1(POS); SEND_UART1('A'); } void CONVERT_HTOS(unsigned int HEX) {
50

unsigned int VALUE = 0; unsigned char POS = 0; VALUE = HEX; VALUE = VALUE % 1000; POS = VALUE / 100; POS = 0x30 + POS; COM_DATA(POS,1); VALUE = VALUE % 100;//35 POS = VALUE / 10; //3 POS = 0x30 + POS; COM_DATA(POS,1); POS = VALUE % 10;//5 POS = 0x30 + POS; COM_DATA(POS,1); }

51

3.4 TESTING THE CIRCUIT: The circuit is tested using a Regulated power supply unit (RPSU). The loads are provided using bulbs and the voltage is varied from the power supply. Switching is tested by reducing the voltage below the threshold levels. When the voltage is below threshold(14V default setting) , the bulb connected to the battery terminal lights up. The output voltage and current can be seen on the LCD screen or tested using a multimeter. When the voltage is increased above threshold (16V by default), the bulb connected to the inverter terminal lights up. The current and voltage are displayed on the LCD screen.

3.5 BATTERY SIZING: Battery bank capacity - calculating amp hour needs Inverter size To determine the inverter size we must find the peak load or maximum wattage of the home. This is found by adding up the wattage of the appliances and devices that could be run at the same time. This includes everything from microwaves and lights to computers and clocks. The sum will indicate which inverter size is needed. Appliances take more than their rated power at start-up are accounted for. The inverter's surge rating should cover these temporary increases.

Example: A room has two 60-watt light bulbs and a 300-watt desktop computer. The inverter size is 60 x 2 + 300 = 420 watts

Daily energy use Next we find the energy the home uses in a day. We Figure out how long each electronic device will be run in hours per day and Multiply the wattage of each device by its run-time to get the energy in watt-hours per day. Add up all the watt-hour values to get a total for the home. This estimate is likely too low as there will be efficiency loses. To get a rough idea of the real value with system loses, multiply by 1.5. This will help account for decreasing performance when temperature increases.

Example: Light bulbs run for 5 hours a day. Computer runs for 2 hours a day. 120 x 5 + 300 x 2 = 1200 watt-hours. 1200 x 1.5 = 1800 watt-hours Days of autonomy

52

Now decide how many days worth of energy is to be stored in the battery bank. Generally this is anywhere from two to five. Battery bank capacity Finally we can calculate the minimum battery AH capacity. Take the watt-hours per day and multiply them by the number you decided upon in step 3. This should represent a 50% depth of discharge on your batteries. Therefore multiply by 2 and convert the kwh result into amp hours (AH). Dividing by the battery voltage does this.

Example: The battery bank has to last three days without recharging and usage 1.8 kWh per day. As 1.8 x 3 x 2 = 10.8kwh, this is the capacity we need from the batteries. Converting this to AH we have to divide by the voltage of your system. This can be 12, 24 or 48 for commercial application. If we choose to use 48V, the minimum AH capacity is then 10 800/48 = 225 AH. Now if you divide by your battery's rating you find the number of batteries you must use. Careful, this only applies to certain wiring set-ups. Charge controllers Charge controller sizing is the next step when sizing the system. Overview Charge controllers regulate the power coming from the solar panels to the batteries. They are a key part of any off-grid system and prevent batteries from over-charging. We will discuss two kinds of charge controllers: PWM and MPPT. PWM (Pulse-Width Modulation) controllers are cheaper than MPPT but create large power loses. Up to 60% of power can be lost. This is because PWM controllers do not optimise the voltage going to the batteries. This limitation makes a PWM controller a poor choice for a large system. However, in smaller systems their low price makes them a viable option. MPPT (Maximum Power Point Tracking) controllers optimise the voltage coming from the solar panels so that the maximum amount of energy is transferred to the battery bank. The maximum power point, or the optimal conversion voltage, will fluctuate with changes in light intensity, temperature and other factors. The digital optimisation process performed by the MPPT controller find and adjusts to the maximum power point quickly. Sophisticated electronics are needed in MPPT controllers to do this, which explains their high price. There is a significant pay-off though: MPPT controllers are 93-97% efficient in converting power. Calculation

53

Once the battery bank has been sized and solar panel array, determining which charge controller to use is comparatively straightforward. All we have to do is find the current through the controller by using power = voltage x current. Take the power produced by the solar panels and divide by the voltage of the batteries. For example:

Example: A solar array is producing 1 kiwi and charging a battery bank of 24V. The controller size is then 1000/24 = 41.67 amps. Introduce a safety factor by multiplying the value you have found by 1.25 to account for variable power outputs: 41.67 x 1.25 = 52.09 amps

54

CHAPTER 4 RESULTS AND SUMMARY Hence the circuit for automated switching for battery charging during low light intensity has been designed according to the above description and tested for successful operation. The above circuit can be used for various other switching operations. For example: Hence, using the above circuit, the automated switching operations between battery charging and pumping have been implemented. The Battery sizing varies according to the households to be powered and can thus be varied according to the necessary output power required. The above circuit can also be used for performing other switching operations. For eg. If a building is powered using grid supply, a solar panel may be installed on the building to charge a battery. In the absence of the grid supply, the building may be powered using the solar panels and the batteries.

LIMITATIONS OF PROJECT: 1. The above constructed model is a miniature version of the actual circuit to be implemented so it cannot handle heavy loads(beyond 25V and 7A). 2. Voltage sensors have been used for switching. Current sensors provide a more dynamic switching range. 3. Another method can be calculating power using both voltage and current sensors so as to perform switching based on input power rather than input voltage. 4. Voltage boosters are required for if output voltage has to be high. 5. If MPPT is done by holding the voltage constant, then this circuit has to be connected before the MPPT circuit so as to have varying voltage

REFERENCES

[1] Kirloskar solar pump pack guidebook and presentation.


55

[2] Embedded Lab-An online teaching resource for microcontrollerswww.embeddedlab.com/renesascontrollers/R8cseries/prog [3] Interfacing LCDs -http//www.dnatechnology.com/Interfacing-LCD-to-8051.html4. [4] Renasas R5F2127 datasheet R8C/26 Hardware manual-renesas technolodies-Rev 2.1026 September 2008. [5] All about solar cells-http// www.tech6.com/all about solar cells. [6] LM138/LM338 5-Amp adjustable regulators-Texas Instruments-Revised November 2004. [7] Effect of light intensity on solar cell efficiency- Leighann Vanncleef and Aaron Baker. [8] Solar cell characteristics- www.nrel.gov.in/thinfilm/docs [9] Battery and Inverter Sizing-http://www.solartown.com/learning/solarpanels/choosing- and-sizing-batteries-charge-controllers-and-inverters-for-your-off-gridsolar-energy-system/

56

Vous aimerez peut-être aussi