Raja Sekar An

Embed Size (px)

Citation preview

  • 7/30/2019 Raja Sekar An

    1/83

    DESIGN AND PERFORMANCE ANALYSIS OF

    WATE PUMPING USING SOLAR PV

    A PROJECT REPORT

    Submitted by

    1. RAJASEKARAN.E (44109105008)

    2. THIRUMALAI.E (44109105015)

    3. PARTHIBAN.E (44109105307)

    4. VENKATESAN.D (44109105313)

    In partial fulfillment for the award of the degree

    Of

    BACHELOR OF ENGINEERING

    IN

    ELECTRICAL AND ELECTRONICS ENGINEERING

    SRI ARAVINDAR ENGINEERING COLLEGE

    SEDARAPET

    ANNA UNIVERSITY :: CHENNAI 600 025

    APRIL 2013

  • 7/30/2019 Raja Sekar An

    2/83

    ANNA UNIVERSITY :: CHENNAI 600 025

    BONAFIDE CERTIFICATE

    Certified that this project report DESIGN AND PERFORMANCE

    ANALYSIS OF WATER PUMPING USING SOLAR PV is the

    bonafide work of RAJASEKARAN.E (44109105008), THIRUMALAI.E

    (44109105015) , PARTHIBAN.E (44109105307), VENKATESAN.D

    (44109105313) who carried out the project work under my supervision.

    SIGNATURE SIGNATURE

    Mr. R.VENKADESH Mr. M . RAJKUMAR

    HEAD OF THE DEPARTMENT SUPERVISOR

    Lecturer Lecturer

    Electrical And Electronics Engineering Electrical And Electronics Engineering

    Sri Aravindar Engineering College Sri Aravindar Engineering College

    Sedarapet 605 111 Sedarapet 605 111

    Submitted for the project work and viva-voce held on ..

    INTERNAL EXAMINER EXTERNAL EXAMINER

  • 7/30/2019 Raja Sekar An

    3/83

    ACKNOWLEDGEMENT

    First and foremost i thank ALMIGHTY for showering his abundant and

    gracious blessings for the completion of the project successfully heartfelt

    thanks to our respected Chairman MR. S.NITIYANANDAN for granting

    permission and giving inspiration for completion of the project work.

    My faithful thanks to our Principal Dr. S.RAJARAJAN for the

    motivation in studies and completion of the project.

    With my heart full pleasure to thank our Head Of The Department

    Mr. R.VENKADESH for his thought suggestions regarding the project and

    my thanks to project Co-Ordinator Ms. T.PREMA Lecturer in Department Of

    Electrical And Electronics Engineering.

    We alone express our sincere thanks to the internal project Guide

    Mr. .RAJKUMAR for his kind help constant encouragement and his

    technical advice then and there.

    I also extend my thanks to all our staff members in Department Of

    Electrical And Electronics Engineering for the completion of the project

    successfully.

    I express my sincere gratitude to the management for providing the

    excellent library, computing and other facilities for my completion of the

    project .

    Last but not least i like to express my sincere thanks to my beloved

    Parent and friends for their constant love and support that gave their considerable

    assistance in shaping out this project successfully alone.

  • 7/30/2019 Raja Sekar An

    4/83

    ABSTRACT

    This paper deals with the design and performance analysis of a DC

    photovoltaic water pumping system. A DC solar water pump is built and

    experimented to observe the results with a direct connection from solar array.

    Various methodologies to increase the efficiency of the system have been

    discussed to implement in the system. Finally DC-DC buck converter is designed

    and constructed to provide current boosting to the DC pump for having a better

    performance from the system. All components in the system are procured from

    locally available markets which eventually decrease the overall cost. The designed

    DC water pumping system has a great prospect to solve out the energy crisis in the

    irrigation season as well as it can be used to cultivate lands throughout the year.

    In this paper, a simple but efficient photovoltaic water pumping system is

    presented. It provides the operation of a DC solar water pump in both the direct-

    coupled method and the pump controller connected method. A pump-controller

    with the help of Buck converter design is constructed and finally implemented

    into the system to increase the overall efficiency of pumping system.Solar

    photovoltaic pumping offers a way out to the people from the energy crisis.

    Numerous technological challenges were overcome through engineering solutions

    and finally a representative model of system is built which can be implemented in

    the field. Upfront cost of the solar pumping system potentially hinder to popularize

    the system in the rural areas but private companies, bank and govt. Can come

    forward for a solution that can fit to rural people.

  • 7/30/2019 Raja Sekar An

    5/83

    CHAPTER 1

    INTRODUCTION

    Energy crisis is the most important issue in todays world. Availability of

    Power supply is one of the most important factors for a countrys economic

    growth. Energy, water and agriculture together form a formidable synergy, which

    when appropriately utilized and managed, can drive any nation way forward.

    Despite being blessed with a fertile soil for agriculture, Indias food and

    agricultural products production is so low due to the gaps between the strong

    demand of energy and supply of energy. Applying solar photovoltaic panels for

    irrigation can change the scenario of the country.

    1.1 EXISTING SYSTEM:

    At present there is no system in existence which uses solar power in

    irrigation procedure. In the existing system the motor pump is made to run using

    available AC power. This increases power consumption which is the maindisadvantage.

    1.2 SCOPE OF THE PROJECT:

    In this project aims at, the solar power is used to run the pump motor. The

    solar power is stored in a battery and the power stored is used to run the DC Pump

    Motor. The voltage and current taken by the Pump Motor is measured andmonitored using the PIC Microcontroller.

    1

  • 7/30/2019 Raja Sekar An

    6/83

    1.3 LITERATURE SURVEY:

    TITLE 1: PERFORMANCE OF MINOR IRRIGATION IN KRISHNA

    BASIN OF KARNATAKA-AN ECONOMIC PERSPECTIVE:

    ABSTRACT :

    Water, the most precious natural resource covers almost three-fourths of

    earths Surface. Its abundance as well as scarcity has been greatly instrumental in

    shaping the lifestyle and culture of the people inhabiting the earth.Early

    civilizations developed and flourished on the shores of major rivers like Tigris and

    the Eupharates in Mesopotamia, the Nile in Egypt, the Huang-Ho in China andIndus valley in India. For all types of agriculture such as geoponic, aeroponic and

    hydroponic water is a basic component.

    TITLE 2: PERFORMANCE ENHANCEMENT OF PV SOLAR SYSTEM

    BY DIFFUSED REFLECTION:

    ABSTRACT :

    Various methods are being adopted to enhance the performance of a solar

    panel. The most common method is to track the sun for performance enhancement.

    Such method needs complicated control and drive circuits for implementation.

    Also, the power required for the tracking motor has to be provided by the solar

    panel and the battery system. Although better performance is achievable by the sun

    tracker, higher cost and frequent maintenance are required. In this paper,

    performance enhancement of solar panels has been experimented utilizing diffused

    reflectors.

    2

  • 7/30/2019 Raja Sekar An

    7/83

    Application of diffused reflectors is cheap, simple and does not require any

    additional equipments or devices. Simple white reflectors can be used to optimize

    the performance of the solar panel. Experimental results indicate appreciable

    enhancement in the overall output of the solar panel. For comparative study,

    experimental readings were simultaneously taken with i) sun tracking, ii)

    the panel aligned at 23.50 with the horizontal using diffused reflectors and iii) the

    panel aligned at 23.50 with the horizontal without diffused reflectors. Comparative

    results depicted for different conditions show encouraging enhancement of the

    performance of the solar panel.

    TITLE 3:ANNUAL ACTIVITIES REPORT:

    ABSTRACT:

    With the change in priorities and imperatives of development functions of

    the State, Planning & Co-ordination Department has emerged as one of the major

    nodal departments of Government. This Department plays a vital role in evolving

    Effective and sustainable short term and long term strategies for overall

    development of the State. This Department prepares policy framework for

    development and is also responsible for co-ordinating the efforts of different

    Development Departments. Keeping in view the needs and aspirations of the

    people and within the broad framework of the long term development strategies

    and priorities envisaged for the State, the Department formulates Annual and Five

    Year Plans in accordance with the guidelines of the Planning Commission and as

    per the directions received from the Government.

    3

  • 7/30/2019 Raja Sekar An

    8/83

    CHAPTER2

    NUMBER OF UNITS

    The Number Of Units Are Given By,

    1. Power supply unit

    2. Microcontroller Unit

    3. Sensor Unit

    4. Device Driver Unit

    5. Display Unit

    6. Software Unit

    2.1 POWER SUPPLY UNIT:

    The supply of 5V DC given to the system, which is converting from

    230V AC supply. Firstly, the step down transformer used here is for converting the

    230V AC into 12V AC. The microcontroller will support only the DC supply, so

    the AC supply is converted to DC using the bridge rectifier. The output of the

    rectifier will have ripples so we are using the 2200uf capacitor for filtering those

    ripples.

    The output from the filter is given to the 7805 voltage regulator, which will

    convert the 12V DC into 5V DC. The output from the regulator will be filtered

    using the 1000uf capacitor, so the pure 5V DC is getting as the output from the

    power supply unit. Here we are using the PIC microcontroller, which will be

    capable of getting the supply of 5V DC so we have to convert the 230V AC supply

    into 5V DC supply.

    4

  • 7/30/2019 Raja Sekar An

    9/83

    2.2 MICROCONTROLLER UNIT:

    2.2.1 Pic 16f877a Microcontroller

    Here the PIC microcontroller is interfaced with current, voltagesensors and solar panel. The sensors are connected to inbuilt analog to

    digital converter pins of PIC microcontroller. The voltage from the solar

    panel is given to drive the pump motor and the voltage and current

    consumption of the pump motor is calculated. The microcontroller is the

    heart of the overall system.

    2.3 SENSOR UNIT:

    2.3.1 Voltage Sensor

    The voltage sensor is used to measure the voltage consumed by the

    pump motor. The output of the sensor is given to the ADC which in turn is

    given to microcontrollers input for further processing.

    2.3.2 Current Sensor

    The current sensor is used to measure the amount of current consumed

    by the pump motor and is fed to the microcontroller for further processing.

    2.4 DEVICE DRIVER UNIT :

    2.4.1 Relay Driving

    It nothing but a simple relay driver circuit it is used to connect anddisconnect the load and solar panel.

    5

  • 7/30/2019 Raja Sekar An

    10/83

    2.4.2 ULN2003

    The induction motors will be controlled by using the driving circuit in whichthe ULN2003 driver IC will be used to provide the proper current rating to

    the motor. The sinking current of the ULN driver is around 500ma.

    2.5 DISPLAY UNIT:

    2.5.1 LCD

    A liquid crystal display (LCD) is a flat panel display, electronic visual

    display, or video display that uses the light modulating properties of liquid

    crystals (LCs). LCDs do not emit light directly. The status of the system like

    the voltage and current is displayed through the LCD.

    2.6 SOFTWARE UNIT:

    Software is used to compile the coding of the desired application for the

    corresponding embedded system.

    2.6.1 MPLAB (or ) CCS Compiler

    The PIC16F877A microcontroller is founded by Microchip and they

    had designed a compiler to develop user-defined programs for different kind of

    applications which is namely called as MPLAB Compiler.Both Assembly and C

    programming languages can be used with MPLAB IDE v8. It is also a cross

    compiler which can also be used other kind of architectures. For PIC series of

    controllers only MPLAB compiler is used. In this project we are using

    PIC16F877A Microcontroller and for that controller Microchip developed a

    compatible and user-friendly compiler for programming which is named

    MPLAB or hi-tech compiler. Hence we choose that controller.

    6

  • 7/30/2019 Raja Sekar An

    11/83

    CHAPTER3

    BLOCK DIAGRAM OF WATER PUMPING

    3.1 BLOCK DIAGRAM

    Fig 3.1 Block Diagram Of Water Pumping

    3.2 GIVEN INPUT AND EXPECTED OUTPUT

    3.2.1 POWER SUPPLY UNIT:

    In the power supply unit the 230V AC is converted into 5V DC.

    Given Input:

    230V AC supply is given as the input to the power supply unit.

    7

    Battery & Power

    Su l

    PIC

    16F877A

    Micro

    Controller

    LCD

    Driver Circuit12V Solar

    Panel

    Pump

    Motor Voltage Sensor

    Current Sensor

  • 7/30/2019 Raja Sekar An

    12/83

    Expected Output:

    The 5V DC supply is getting as the output from the power supply unit.

    3.2.2 MICROCONTROLLER UNIT:

    Given input

    The sensor is the input of the microcontroller.

    Expected output

    The sensor senses means the output voltage given to the microcontroller.

    3.2.3 SENSOR UNIT:

    Voltage Sensor:Given input

    The voltage is the input to the sensor.

    Expected output

    The output value given to the microcontroller.

    Current Sensor:Given input

    The current value is the input to the sensor.

    Expected output

    The output value given to the microcontroller.

    8

  • 7/30/2019 Raja Sekar An

    13/83

    3.2.4 DISPLAY UNIT :

    LCD:Given input

    The microcontroller gives input to the lcd module.

    Expected output

    The operations are displayed in Lcd.

    3.2.5 DRIVER CIRCUIT UNIT:

    Relay driver:Given input

    The trigger is given from microcontroller.

    Expected output

    Based on the trigger input the motor will run.

    Pump motor:Given input

    The relay output is given to the pump motor.

    Expected output

    Based on the output voltage the motor will run.

    9

  • 7/30/2019 Raja Sekar An

    14/83

    CHAPTER 4

    CIRCUIT DIGRAM

    BLOCK DIAGRAM DESCRIPTION

    Block 1: PIC16F877A Microcontroller with Power Supply

    Block 2: 12V,1.2A Battery

  • 7/30/2019 Raja Sekar An

    15/83

    CHAPTER 5

    5. BLOCK DIAGRAM DESCRIPTION

    Block 1: PIC16F877A Microcontroller with Power Supply

    Block 2: 12V,1.2A Battery

    Block 3: 12V Solar Panel

    Block 4: LCD

    Block 3: 12V Solar Panel

    Block 4: LCD

    Block 5: Current Sensor

    Block 6: Voltage Sensor

    5.1 BLOCK 1: PIC16F877A MICROCONTROLLER WITH POWER

    SUPPLY

    The ac voltage, typically 220V rms, is connected to a transformer, which steps

    that ac voltage down to the level of the desired dc output. A diode rectifier then

    provides a full-wave rectified voltage that is initially filtered by a simple capacitor

    filter to produce a dc voltage. This resulting dc voltage usually has some ripple or

    ac voltage variation.

    11

  • 7/30/2019 Raja Sekar An

    16/83

    A regulator circuit removes the ripples and also remains the same dc value

    even if the input dc voltage varies, or the load connected to the output dc voltage

    changes. This voltage regulation is usually obtained using one of the popular

    voltage regulator IC units.

    Fig 5.1 Block Diagram of Power supply

    5.1.1 WORKING PRINCIPLE

    TRANSFORMER :The potential transformer will step down the power supply voltage (0-230V) to

    (0-6V) level. Then the secondary of the potential transformer will be connected to

    the precision rectifier, which is constructed with the help of opamp. The

    advantages of using precision rectifier are it will give peak voltage output as DC,

    rest of the circuits will give only RMS output.

    BRIDGE RECTIFIER:When four diodes are connected as shown in figure, the circuit is called as

    bridge rectifier. The input to the circuit is applied to the diagonally opposite

    corners of the network, and the output is taken from the remaining two corners.

    12

    TRANSFORMER RECTIFIER FILTER IC REGULATOR LOAD

  • 7/30/2019 Raja Sekar An

    17/83

    Let us assume that the transformer is working properly and there is a

    positive potential, at point A and a negative potential at point B. the positive

    potential at point A will forward bias D3 and reverse bias D4. The negative

    potential at point B will forward bias D1 and reverse D2. At this time D3 and D1

    are forward biased and will allow current flow to pass through them; D4 and D2

    are reverse biased and will block current flow.

    The path for current flow is from point B through D1, up through RL,

    through D3, through the secondary of the transformer back to point B. this path is

    indicated by the solid arrows. Waveforms (1) and (2) can be observed across D1

    and D3.One-half cycle later the polarity across the secondary of the transformer

    reverse, forward biasing D2 and D4 and reverse biasing D1 and D3.

    Current flow will now be from point A through D4, up through RL, through

    D2, through the secondary of T1, and back to point A. This path is indicated by the

    broken arrows. Waveforms (3) and (4) can be observed across D2 and D4. The

    current flow through RL is always in the same direction. In flowing through RL

    this current develops a voltage corresponding to that shown waveform (5).

    Since current flows through the load (RL) during both half cycles of the applied

    voltage, this bridge rectifier is a full-wave rectifier.

    The peak voltage developed between points X and y is 1000 volts in

    bothcircuits. In the conventional full-wave circuit shownin view A, the peak

    voltage from the center tap to either X or Y is 500 volts. Since only one diode can

    conduct at any instant, the maximum voltage that can be rectified at any instant is

    500 volts.

    13

  • 7/30/2019 Raja Sekar An

    18/83

    The maximum voltage that appears across the load resistor is nearly-but

    never exceeds-500 v0lts, as result of the small voltage drop across the diode. In the

    bridge rectifier shown in view B, the maximum voltage that can be rectified is the

    full secondary voltage, which is 1000 volts. Therefore, the peak output voltage

    across the load resistor is nearly 1000 volts.

    IC VOLTAGE REGULATORS:Voltage regulators comprise a class of widely used ICs. Regulator IC units

    contain the circuitry for reference source, comparator amplifier, control device, and

    overload protection all in a single IC. The regulators can be selected for operation

    with load currents from hundreds of milli amperes to tens of amperes,

    corresponding to power ratings from milli watts to tens of watts.

    Fig 5.1.1 Circuit Diagram Of Power Supply

    14

  • 7/30/2019 Raja Sekar An

    19/83

    A fixed three-terminal voltage regulator has an unregulated dc input voltage,

    Vi, applied to one input terminal, a regulated dc output voltage, Vo, from a second

    terminal, with the third terminal connected to ground. The series 78 regulators

    provide fixed positive regulated voltages from 5 to 24 volts. Similarly, the series

    79 regulators provide fixed negative regulated voltages from 5 to 24 volts.

    For ICs, microcontroller, LCD --------- 5 volts For alarm circuit, op-amp, relay circuits ---------- 12 volts

    PIC 16F877A MICROCONTROLLER:This section describes how to generate +5V DC power supply. The power

    supply section is the important one. It should deliver constant output regulated

    power supply for successful working of the project. A 0-12V/1 mA transformer

    used for this purpose. The primary of this transformer is connected in to main

    supply through on/off switch& fuse for protecting from overload and short circuit

    protection. The secondary is connected to the diodes to convert 12V AC to 12V

    DC voltage. And filtered by the capacitors, Which is further regulated to +5v, by

    using IC 7805.

    Introduction Of Pic16f877aIt features 200 ns instruction execution, 256 bytes of EEPROM data

    memory, self programming, an ICD, 2 Comparators, 8 channels of 10-bit Analog-

    to-Digital (A/D) converter, 2 capture/compare/PWM functions, a synchronous

    serial port that can be configured as either 3-wire SPI or 2-wire I2C bus, a USART,

    and a Parallel Slave Port.

    15

  • 7/30/2019 Raja Sekar An

    20/83

    5.1.2 MICROCHIP PIC16F877A FEATURES:

    High-Performance Risc Cpu Operating speed: 20 MHz, 200 ns instruction cycle Operating voltage: 4.0-5.5V Industrial temperature range (-40 to +85C) 15 Interrupt Sources 35 single-word instructions All single-cycle instructions except for program branches (two-cycle)

    Special Microcontroller Features Flash Memory: 14.3 Kbytes (8192 words) Data SRAM: 368 bytes Data EEPROM: 256 bytes Self-reprogrammable under software control In-Circuit Serial Programming via two pins (5V) Power-saving Sleep mode Selectable oscillator options In-Circuit Debug via two pins

    Peripheral Features 33 I/O pins; 5 I/O ports Timer0: 8-bit timer/counter with 8-bit prescaler Timer1: 16-bit timer/counter with prescaler

    o Can be incremented during Sleep via external crystal/clock

    16

  • 7/30/2019 Raja Sekar An

    21/83

    Timer2: 8-bit timer/counter with 8-bit period register, prescaler andpostscaler

    Two Capture, Compare, PWM moduleso 16-bit Capture input; max resolution 12.5 nso 16-bit Compare; max resolution 200 nso 10-bit PWM

    Synchronous Serial Port with two modes:o SPI Mastero I2C Master and Slave

    USART/SCI with 9-bit address detection Parallel Slave Port (PSP)

    o 8 bits wide with external RD, WR and CS controls Brown-out detection circuitry for Brown-Out Reset

    Analog Features 10-bit, 8-channel A/D Converter Brown-Out Reset Analog Comparator module

    o 2 analog comparatorso Programmable on-chip voltage reference moduleo Programmable input multiplexing from device inputs and internal

    VREF

    o Comparator outputs are externally accessible

    17

  • 7/30/2019 Raja Sekar An

    22/83

    5.1.3 PIN DIAGRAM:

    Fig.5.1.3 Pin Diagram

    5.1.4 TYPES OF MEMORIES FOR PIC16F877A

    1.Program Memory- A memory that contains the program (which we hadwritten), after we've burned it. As a reminder, Program Counter executes

    commands stored in the program memory, one after the other.

    2. Data MemoryThis is RAM memory type, which contains a specialregisters like Special Faction Register and General Purpose Register.

    18

    http://www.microcontrollerboard.com/pic_memory_organization.html#ProgMemhttp://www.microcontrollerboard.com/pic_memory_organization.html#ProgMemhttp://www.microcontrollerboard.com/pic_memory_organization.html#ProgMemhttp://www.microcontrollerboard.com/pic_memory_organization.html#DataMemhttp://www.microcontrollerboard.com/pic_memory_organization.html#DataMemhttp://www.microcontrollerboard.com/pic_memory_organization.html#DataMemhttp://www.microcontrollerboard.com/pic_memory_organization.html#ProgMem
  • 7/30/2019 Raja Sekar An

    23/83

    These two memories have separated data buses, which makes the access to each

    one of them very easy.

    3. Data EEPROM (Electrically Erasable Programmable Read-OnlyMemory) - A memory that allows storing the variables as a result of

    burning the written program.

    Each one of them has a different role. Program Memory and Data Memory

    two memories that are needed to build a program, and Data EEPROM is use to

    save data after the microcontroller is turn off. Program Memory and Data

    EEPROM they are non-volatile memories, which store the information even afterthe power is turn off. These memories called Flash Or EEPROM. In contrast, Data

    Memory does not save the information because it needs power in order to maintain

    the information stored in the chip.

    1. PIC16F87XA Program Memory:

    The PIC16F87XA devices have a 13-bit program counter capable of

    addressing an 8K word x 14 bit program memory space. This memory is used to

    store the program after we burn it to the microcontroller. The PIC16F876A/877A

    devices have 8K words x 14 bits of Flash program memory that can be electrically

    erased and reprogrammed. Each time we burn program into the micro, we erase an

    old program and write a new one.

    Program Memory is divided into the pages, where the program is stored.Data Memory is divided into the banks. The banks are located inside the RAM,

    where the special registers and the data located.

    19

    http://www.microcontrollerboard.com/pic_memory_organization.html#DataEEMemhttp://www.microcontrollerboard.com/pic_memory_organization.html#DataEEMemhttp://www.microcontrollerboard.com/pic_memory_organization.html#DataEEMemhttp://www.microcontrollerboard.com/pic_memory_organization.html#DataEEMemhttp://www.microcontrollerboard.com/pic_memory_organization.html#DataEEMem
  • 7/30/2019 Raja Sekar An

    24/83

    Fig.5.1.4 a) V Pic16f87xa Program Memory:

    2. PIC16F87XA Data Memory :

    The data memory is partitioned into multiple banks which contain the

    General Purpose Registers and the Special Function Registers. Number of banks

    may vary depending on the microcontroller. The lower locations of each bank are

    reserved for the Special Function Registers.

    Above the Special Function Registers are General Purpose Registers,

    implemented as static RAM. While program is being executed, it is working with

    the particular bank. The default bank is BANK0.

    20

  • 7/30/2019 Raja Sekar An

    25/83

    Fig.5.1.4 b) PIC16F87XA Data Memory

    21

  • 7/30/2019 Raja Sekar An

    26/83

    PIC16F876A/877A Register File MapIn order to start programming and build automated system, there is no need

    to study all the registers of the memory map, but only a few most important ones:

    STATUS registerchanges/moves from/between the banks PORT registersassigns logic values (0/1) to the ports TRIS registers - data direction register (input/output)

    You can learn about other registers at a later stage or as needed.

    a) STATUS register:In most cases, this register is used to switch between the banks (Register

    Bank Select), but also has other capabilities.

    PIC STATUS registerWith the help of three left bits (IRP, RP1, and RP0) one can control the

    transition between the banks:

    IRP - Register Bank Select bit, used for indirect addressing method. RP1:RP0: - Register Bank Select bits, used for direct addressing method.

    22

  • 7/30/2019 Raja Sekar An

    27/83

    To distinguish between the two methods, at this point, the will use the

    definition of fundamental concepts. Later on, the two methods will be studied in

    detail. When the IRP Equal to 0, the program will work with banks 0,1.

    When the IRP Equal to 1, the program will work with banks 2, 3.

    The following table demonstrates, which of the Banks the program is

    working with, based on the selection of the RP0 and RP1 bits:

    RP1:RP0 BANK

    00 0

    01 1

    10 2

    11 3

    Table 5.14 Selection Of The RP0 And RP1 Bits

    An example of using STATUS register and Register Bank Select bit:

    1.bsf STATUS, 5 ; Change to Bank 12. clrf TRISB ; Set PORTB as output3.bcf STATUS, 5 ; Change to Bank 0

    In the first line, we are in changing/setting the 5th bit, RP0, in the STATUS

    register to 1, and thus, base on the table we are switching/selecting Bank 1.

    23

  • 7/30/2019 Raja Sekar An

    28/83

    After Port B was set as output in the second line, we switched back to Bank 0 by in

    changing/setting the 5th bit, RP0, in the STATUS register to 0, in the third line.

    C: Carry/borrow bit (ADDWF, ADDLW, SUBLW,SUBWF instructions)

    1 = A carry-out from the Most Significant bit of the result occurred

    0 = No carry-out from the Most Significant bit of the result occurred

    An example of using STATUS register and Carry/borrow bit:

    1. Movlw 2002. Addwf 100, 0

    In this example, we are assigning value of 200 to the W (working)

    register. Then, we are adding the value of 100 and the W register together. The

    result is stored in W register and should be 300 (200+100).

    However, the maximum value is 256, resulting in carry out. The C (bit 0) of the

    STATUS register becomes 1 (C = 1). Register W will contain the reminder: 44.

    DC: Digit carry/borrow bit (ADDWF, ADDLW,SUBLW,SUBWF

    instructions) (for borrow, the polarity is reversed)

    1 = A carry-out from the 4th low order bit of the result occurred

    0 = No carry-out from the 4th low order bit of the result.

    Z: Zero bit

    1 = The result of an arithmetic or logic operation is zero

    0 = The result of an arithmetic or logic operation is not zero

    The bits 3 and 4 are used with WDT - Watchdog Timer.

    24

  • 7/30/2019 Raja Sekar An

    29/83

    PD: Power-down bit

    1 = After power-up or by the CLRWDT instruction

    0 = By execution of the SLEEP instruction

    TO: Time-out bit

    1 = After power-up, CLRWDT instruction or SLEEP instruction

    0 = A WDT time-out occurred

    b)PORT register:The role of the PORT register is to receive the information from an external

    source (e.g. sensor) or to send information to the external elements (e.g. LCD). The

    28-pin devices have 3 I/O ports, while the 40/44-pin devices, like PIC16F877, have

    5 I/O ports located in the BANK 0.

    1.PORTA is a 6-bit wide, bidirectional port. The corresponding datadirection register is TRISA.Setting a TRISA bit (= 1) will make the

    corresponding PORTA pin an input. Clearing a TRISA bit (= 0) will

    make the corresponding PORTA pin an output.

    2.PORTB is an 8-bit wide, bidirectional port. The corresponding datadirection register is TRISB. Setting a TRISB bit (= 1) will make the

    corresponding PORTB pin an input. Clearing a TRISB bit (= 0) will

    make the corresponding PORTB pin an output.

    3.PORTC is an 8-bit wide, bidirectional port. The corresponding datadirection register is TRISC. Setting a TRISC bit (= 1) will make the

    corresponding PORTC pin an input.

    25

  • 7/30/2019 Raja Sekar An

    30/83

    Clearing a TRISC bit (= 0) will make the corresponding PORTC pin an output.

    4. PORTD is an 8-bit port with Schmitt Trigger input buffers. Each pin is

    individually configurable as an input or output.

    5. PORTE has three pins (RE0/RD/AN5, RE1/WR/AN6 and RE2/CS/AN7)

    which are individually configurable as inputs or outputs. These pins have

    Schmitt Trigger input buffers.

    We can control each port by using an assigned address of specific port, but

    there is much easier way to control the port. We are allowed to use the names of

    the ports without considering their addresses.

    For example:

    # define SWITCH PORTA, 0

    We define a variable named SWITCH, which received a value of bit number

    0 of the PORTA. Usually we define the ports at the beginning of the program, and

    then we use only the given names.

    c) TRIS register:The TRIS register is data direction register which defines if the specific bit

    or whole port will be an input or an output. Each PORT has its own TRIS register.

    Here's a map of the locations:

    26

  • 7/30/2019 Raja Sekar An

    31/83

    BANK0 BANK1

    PORTA TRISA

    PORTB TRISB

    PORTC TRISC

    PORTD TRISD

    PORTE TRISE

    The default mode of each TRIS is input. If you want to set a specific

    port as exit you must change the state of the TRIS to 0. Keep in mind: to change a

    specific port to an output, one should first move to the BANK1, make the change,

    and then return to BANK0. The default state of the banks is BANK0.

    The running program is working only with one bank at all time. If not set

    otherwise, then as stated, the default bank is BANK0. Part of the registers located

    inside BANK0, and some are not. When we need to access a register that is not

    located inside BANK0, we are required to switch between the banks.

    3. PIC16F87XA Data EEPROM:

    The data EEPROM and Flash program memory is readable and writable

    during normal operation (over the full VDD range). This memory is not directlymapped in the register file space. Instead, it is indirectly addressed through the

    Special Function Registers.

    27

  • 7/30/2019 Raja Sekar An

    32/83

    There are six SFRs used to read and write to this memory:

    1. EECON12. EECON23. EEDATA4. EEDATH5. EEADR6. EEADRH

    When interfacing to the data memory block, EEDATA holds the 8-bit data for

    read/write and EEADR holds the address of the EEPROM location being accessed.

    These devices have 128 or 256 bytes of data EEPROM (depending on the device),

    with an address range from 00h to FFh. On devices with 128 bytes, addresses from

    80h to FFh are unimplemented.

    A few important points about Data EEPROM memory:

    It lets you save data DURING programming The data is saved during the burning process You can read the data memory during the programming and use it The use is made possible with the help of SFR

    At this point there is no need to learn how to use this memory with special

    registers, because there are functions (writing and reading) that are ready.

    28

  • 7/30/2019 Raja Sekar An

    33/83

    5.1.5 PIC TIMER :

    Many times, we plan and build systems that perform various processes that

    depend on time.Simple example of this process is the digital wrist watch. The role

    of this electronic system is to display time in a very precise manner and change the

    display every second (for seconds), every minute (for minutes) and so on. To

    perform the steps we've listed, the system must use a timer, which needs to be very

    accurate in order to take necessary actions.

    The clock is actually a core of any electronic system. In this PIC timer

    module tutorial we will study the existing PIC timer modules. The microcontrollerPIC16F877 has 3 different timers:

    PIC Timer0 PIC Timer1 PIC Timer2

    We can use these timers for various important purposes. So far we used

    delay procedure to implement some delay in the program, that was counting up

    to a specific value, before the program could be continued.

    "Delay procedure" had two disadvantages:

    we could not say exactly how long the Delay procedure was in progress we could not perform any further steps while the program executes the

    "delay procedure"

    29

    http://www.microcontrollerboard.com/pic-timer1-tutorial.htmlhttp://www.microcontrollerboard.com/pic-timer2-tutorial.htmlhttp://www.microcontrollerboard.com/pic-timer2-tutorial.htmlhttp://www.microcontrollerboard.com/pic-timer1-tutorial.html
  • 7/30/2019 Raja Sekar An

    34/83

    Now, using Timers we can build a very precise time delays which will be

    based on the system clock and allow us to achieve our desired time delay well-

    known in advance. In order for us to know how to work with these timers, we need

    to learn some things about each one of them. We will study each one separately.

    1.PIC Timer0 :

    The Timer0 module timer/counter has the following features:

    8-bit timer/counter Readable and writable 8-bit software programmable prescaler Internal (4 Mhz) or external clock select Edge select (rising or falling) for external clock

    Lets explain the features of PIC Timer0 we have listed above:

    Timer0 has a register called TMR0 Register, which is 8 bits of size.

    We can write the desired value into the register which will be increment as the

    program progresses. Frequency varies depending on the Prescaler. Maximum

    value that can be assigned to this register is 255.

    TMR0IF - TMR0 Overflow Interrupt Flag bit.

    The TMR0 interrupt is generated when the TMR0 register overflows from FFh to

    00h. This overflow sets bit TMR0IF (INTCON). You can initialize the value of

    this register to whatever you want (not necessarily "0").

    We can read the value of the register TMR0 and write into.

    30

  • 7/30/2019 Raja Sekar An

    35/83

    We can reset its value at any given moment (write) or we can check if there is

    a certain numeric value that we need (read).

    Prescaler - Frequency divider:

    1:2 1:4 1:8 1:16 1:32 1:64 1:128 1:256

    The structure of the OPTION_REG register:We perform all the necessary settings with OPTION_REG Register. The size of

    the register is 8 bits.

    31

    http://www.microcontrollerboard.com/support-files/option-register.pdfhttp://www.microcontrollerboard.com/sbi/support-files/option-register.htmlhttp://www.microcontrollerboard.com/sbi/support-files/option-register.htmlhttp://www.microcontrollerboard.com/support-files/option-register.pdf
  • 7/30/2019 Raja Sekar An

    36/83

    Initializing the OPTION_REG register:The following is an example how we can initialize the OPTION_REG:

    1. PSA=0; // Prescaler is assigned to the Timer0 module2. PS0=1; // Prescaler rate bits3. PS1=1; // are set to 1114. PS2=1; // which means divide by 2565. TOSE=0; // rising edge

    clock diagram of the PIC Timer0 / WDT prescaler :

    Fig.5.1.5 a) PIC Timer0 Block Diagram

    32

  • 7/30/2019 Raja Sekar An

    37/83

    Calculating Count, Fout, and TMR0 values:If using INTERNAL crystal as clock, the division is performed as follow:

    PIC TIMER0 formula for internal clock

    Fout Output frequency after the division.

    Tout The Cycle Time after the division.

    4 - The division of the original clock (4 MHz) by 4, when using internal crystal as

    clock (and not external oscillator).

    Count- A numeric value to be placed to obtain the desired output frequency - Fout.

    (256 - TMR0) - The number of times in the timer will count based on the register

    TMR0.

    1. An example of INTERNAL crystal as clock :

    Suppose we want to create a delay of 0.5 second in our program using

    Timer0. What is the value of Count?

    Calculation:

    First, lets assume that the frequency division by the Prescaler will be 1:256.

    Second, lets set TMR0=0.

    33

  • 7/30/2019 Raja Sekar An

    38/83

    Thus:

    Formula to calculate Cout using Timer0

    If using EXTERNAL clock source (oscillator), the division is performed as follow:

    PIC TIMER0 formula for external clock

    In this case there is no division by 4 of the original clock. We use the external

    frequency as it is.

    2. An example of EXTERNAL clock source (oscillator):

    What is the output frequency - Fout, when the external oscillator is 100kHz

    and Count=8?

    Calculation:

    First, lets assume that the frequency division by the Prescaler will be 1:256.

    Second, lets set TMR0=0. Thus:

    34

  • 7/30/2019 Raja Sekar An

    39/83

    Formula to calculate Fout for Timer0

    2. PIC Timer1:

    The Timer1 module, timer/counter, has the following features:

    16-bit timer/counter consisting of two 8-bit registers (TMR1H and TMR1L) readable and writable 8-bit software programmable prescaler Internal (4 Mhz) or external clock select Interrupt on overflow from FFFFh to 0000h

    Lets explain the features of PIC Timer1 we have listed above:

    Timer1 has a register called TMR1 register, which is 16 bits of size.

    Actually, the TMR1 consists of two 8-bits registers:

    TMR1H TMR1L

    It increments from 0000h to the maximum value of 0xFFFFh (or 0 b1111

    1111 1111 1111 or 65,535 decimal). The TMR1 interrupt, if enabled, is generated

    on overflow which is latched in interrupt flag bit, TMR1IF (PIR1).

    35

  • 7/30/2019 Raja Sekar An

    40/83

    This interrupt can be enabled/disabled by setting/clearing TMR1 interrupt

    enable bit, TMR1IE (PIE1). You can initialize the value of this register to

    whatever you want (not necessarily "0").

    TMR1IFTMR1 overflow Interrupt Flag bit.

    This flag marks the end of ONE cycle count. The flag need to be reset in the

    software if you want to do another cycle count. We can read the value of the

    register TMR1 and write into. We can reset its value at any given moment (write)

    or we can check if there is a certain numeric value that we need (read).

    PrescalerFrequency divider:

    We can use Prescaler for further division of the system clock. The size of the

    register is 2-bit only, so you can make four different division. The options are:

    1:1 1:2 1:4 1:8

    You can choose whether to use an internal system clock (crystal) or external

    oscillator that can be connected to a pin RC0.

    The structure of the T1CON register:We perform all the necessary settings with T1CON register. As we can see,

    the size of the register is 8 bits. Lets explore the relevant bits:

    36

  • 7/30/2019 Raja Sekar An

    41/83

    Initializing the T1CON register:The following is an example how we can initialize the T1CON register:

    1. TMR1ON=1; // the timer is enable2. TMR1CS=0; // internal clock source3.

    T1CKPS0=0; // Prescaler value set to 00

    4. T1CKPS1=0; // which means 1:1 (no division)Or you can set all the T1CON register at once as follows:

    T1CON=0b00000001;

    Block diagram of the PIC Timer1

    Fig 5.1.5 b) PIC TIMER1 Block Diagram

    37

  • 7/30/2019 Raja Sekar An

    42/83

    Calculating Count, Fout, and Timer1 values:

    If using INTERNAL crystal as clock, the division is performed as follow:

    PIC TIMER1 formula for internal clock

    FoutThe output frequency after the division.

    Tout The Cycle Time after the division.

    4 - The division of the original clock (4 MHz) by 4, when using internal crystal as

    clock (and not external oscillator).

    Count- A numeric value to be placed to obtain the desired output frequency - Fout.

    (256 - TMR1) - The number of times in the timer will count based on the register

    TMR0.

    If using EXTERNAL clock source (oscillator), the division is performed

    as follow:

    PIC TIMER1 formula for external clock

    38

  • 7/30/2019 Raja Sekar An

    43/83

    Simple example and calculation of how to use TIMER1:

    Suppose we want to create a delay of 2 second in the our program using

    Timer1. What is the value of Count?

    Calculation:

    First, lets assume that the frequency division by the Prescaler will be 1:1. Second,

    lets set TMR1=0, which means the TMR1 will count 65,536 times. Thus:

    Formula to calculate Cout for Timer1

    3. PIC Timer2:

    The Timer2 Module Has The Following Features:

    Two 8-Bit Registers ( TMR2 And PR2 )

    Readable And Writable

    Prescaler And A Postscaler

    Connected Only To An Internal Clock - 4Mhz Crystal

    Interrupt On Overflow

    39

  • 7/30/2019 Raja Sekar An

    44/83

    TIMER 2 Prescaler and Postscaler :

    Fig 5.1.5 c) TIMER 2 Prescaler And Postscaler

    TMR2IF - TMR2 to PR2 Match Interrupt Flag bit.

    Comparator compares the value of the register tmr2 and the maximum value of

    the register pr2.

    Tmr2 the register in which the initial count value is written. Pr2 the register in which the final or the maximum count value is

    written.

    40

  • 7/30/2019 Raja Sekar An

    45/83

    TIMER 2 BLOCK DIAGRAM:

    Fig 5.1.5 d) Timer2 Block Diagram

    How to calculate the required values of the TIMER2:

    Fout The output frequency after the division.

    Tout The Cycle Time after the division.

    4 - The division of the original clock (4 MHz) by 4, when using internal crystal as

    clock (and not external oscillator).

    Count- A numeric value to be placed to obtain the desired output frequency - fout.

    (PR2TMR2) - The number of times the counter will count.

    41

  • 7/30/2019 Raja Sekar An

    46/83

    Simple example and calculation of how to use TIMER2:

    Suppose we want to create a delay of 1 second in the our program using Timer2.

    What is the value of Count?

    Calculation:

    First, lets assume that the frequency division by the Prescaler will be 1:1 and

    Postscaler will be 1:16. Second, lets set TMR1=0 and PR2=255. Thus:

    5.1.6 INTRODUCTION TO SERIAL COMMUNICATION WITH

    PIC16F877 MICROCONTROLLER:

    In this tutorial we will study the communication component USART

    (Universal Synchronous Asynchronous Receiver Transmitter) located within the

    PIC. It is a universal communication component (Synchronous/Asynchronous),

    which can be used as transmitter or as receiver. We will look at:

    serial and parallel communications synchronous and asynchronous communications

    42

  • 7/30/2019 Raja Sekar An

    47/83

    how to enable serial communication - TXSTA and RCSTA registers An example of 8-bit transmission An example of 9-bit transmission how to calculate the value being placed in the SPBRG register USART Transmit and Receive block diagrams Max323 Driver/Receiver the implementation of the PIC serial communication (C program and a

    video)

    We will show how to set USART in order to allow communication between

    PIC to PIC or between PIC to a personal computer. We will start with the

    definition of media concepts. There are two options to differentiate when speaking

    about transmission of information on the transmission lines:

    serial communication parallel communication

    In order to understand what serial communication is, and emphasize the

    difference between serial communication and parallel communication, lets take a

    look at the following example: We have a multi-bit word, and we want to transmit

    it from one computer to the second computer.

    1.Using the serial communication:

    When using the serial communication we transmit the multi-bit word bitafter bit (when at any given moment only one bit will pass).

    43

  • 7/30/2019 Raja Sekar An

    48/83

    Fig.5.1.6a) Transmitting the word 10011101 using serial communication.

    2. Using the parallel communication:When using the parallel communication, however, the number of bits will

    be transmitted at once from one computer to the second computer.

    Fig.5.1.6b)Transmitting the word 10011101 sing parallel communication.

    44

  • 7/30/2019 Raja Sekar An

    49/83

    In addition to the serial and parallel communications, there are 2 types of

    communication we will explore:

    Synchronous communication Asynchronous communication

    5.2 BLOCK 2: 12V, 1.2A BATTERY

    In electricity, a battery is a device consisting of one or

    more electrochemical cells that convert stored chemical energy into electrical

    energy. Since the invention of the first battery (or "voltaic pile") in 1800

    by Alessandro Volta and especially since the technically improved Daniell

    cell in 1836, batteries have become a common power source for many

    household and industrial applications. According to a 2005 estimate, the

    worldwide battery industry generates US$48 billion in sales each year, with 6%

    annual growth.

    There are two types of batteries: primary batteries (disposable

    batteries), which are designed to be used once and discarded, and secondary

    batteries (rechargeable batteries), which are designed to be recharged and used

    multiple times. Batteries come in many sizes from miniature cells used to

    power hearing aids and wristwatches to battery banks the size of rooms that

    provide standby power for telephone exchanges and computer data centers.

    A battery is a device that converts chemical energy directly to

    electrical energy. It consists of a number of voltaic cells; each voltaic cell

    consists of two half-cells connected in series by a conductive electrolyte

    containing anions and cautions.

    45

    http://www.microcontrollerboard.com/pic_serial_communication.html#SynCommhttp://www.microcontrollerboard.com/pic_serial_communication.html#AsynCommhttp://www.microcontrollerboard.com/pic_serial_communication.html#AsynCommhttp://www.microcontrollerboard.com/pic_serial_communication.html#SynComm
  • 7/30/2019 Raja Sekar An

    50/83

    One half-cell includes electrolyte and the electrode to

    which anions (negatively charged ions) migrate, i.e., the anode or negative

    electrode; the other half-cell includes electrolyte and the electrode to

    which cations (positively charged ions) migrate, i.e., the cathode or positive

    electrode. In theredox reaction that powers the battery, cations are reduced

    (electrons are added) at the cathode, while anions are oxidized (electrons are

    removed) at the anode.

    The electrodes do not touch each other but are electrically connected by

    the electrolyte. Some cells use two half-cells with different electrolytes. A

    separator between half-cells allows ions to flow, but prevents mixing of theelectrolytes. Each half-cell has an electromotive force (or emf), determined by

    its ability to drive electric current from the interior to the exterior of the cell.

    The net emf of the cell is the difference between the emfs of its half-cells, as

    first recognized by Volta.

    Therefore, if the electrodes have emfs and , then the net emf

    is ; in other words, the net emf is the difference between the reductionpotentials of the half-reactions. The electrical driving force or across the

    terminals of a cell is known as the terminal voltage (difference) and is measured

    in volts the terminal voltage of a cell that is neither charging nor discharging is

    called the open-circuit voltage and equals the emf of the cell. Because of

    internal resistance, the terminal voltage of a cell that is discharging is smaller in

    magnitude than the open-circuit voltage and the terminal voltage of a cell that is

    charging exceeds the open-circuit voltage. An ideal cell has negligible internal

    resistance, so it would maintain a constant terminal voltage of until

    exhausted, then dropping to zero.

    46

  • 7/30/2019 Raja Sekar An

    51/83

    If such a cell maintained 1.5 volts and stored a charge of

    one coulomb then on complete discharge it would perform 1.5 joule of work. In

    actual cells, the internal resistance increases under discharge,]and the open

    circuit voltage also decreases under discharge. If the voltage and resistance are

    plotted against time, the resulting graphs typically are a curve; the shape of the

    curve varies according to the chemistry and internal arrangement employed.

    As stated above, the voltage developed across a cell's terminals depends

    on the energy release of the chemical reactions of its electrodes and electrolyte.

    Alkaline and zinccarbon cells have different chemistries but approximately the

    same emf of 1.5 volts; likewise NiCd and NiMH cells have differentchemistries, but approximately the same emf of 1.2 volts. On the other hand the

    high electrochemical potential changes in the reactions of lithium compounds

    give lithium cells emfs of 3 volts or more.

    5.3 BLOCK 3: 12V SOLAR PANEL

    5.3.1 Solar Electricity:

    solar in the form of solar electric panels, hot water panels, and passive

    heating; wind generators for electric production and windmills for water

    pumping; and hydro electric generators. When people think about alternative or

    renewable energy, the first image that comes to mind is often large blue or

    black solar panels on rooftops or portable highway signs that have a small panel

    attached. These panels, also known as photovoltaic modules (or PV modules),

    convert sunlight into electricity, and they have been the backbone of renewable

    energy for decades.

    47

    http://en.wikipedia.org/wiki/Battery_(electricity)#cite_note-pse976-25http://en.wikipedia.org/wiki/Battery_(electricity)#cite_note-pse976-25http://en.wikipedia.org/wiki/Battery_(electricity)#cite_note-pse976-25http://en.wikipedia.org/wiki/Battery_(electricity)#cite_note-pse976-25
  • 7/30/2019 Raja Sekar An

    52/83

    The Photovoltaic Effect (how sunlight is converted into electrical energy)

    was discovered over a hundred years ago! Yet widespread implementation of this

    technology has been very gradual. Only in very recent years has photovoltaics

    gained wide popularity as an alternative way to produce electricity. In 1958 the

    first PV modules were launched into space to power satellites. Even today, solar

    power is the primary source of energy at the International Space Station. On Earth

    as well, PV has traditionally been used in areas where there is no practical source

    of electrical power but there is abundant sunshine.

    Solar panels are often used for remote applications: like powering cabins,

    RVs, boats and small electronics when grid service is not available. Recently,

    "grid-tie" solar electric systems have started gaining momentum as a cost-effective

    way to incorporate solar electricity into our everyday lives. Now we can take

    advantage of available solar energy while still enjoying the safety net of the utility

    grid.

    5.3.2 12 Volt Solar Panel:

    When solar panels first came out they were really large and used only in

    solar powerplants. As technology advanced, the sizes of solar panels were reduced

    so that they could be installed on the rooftops of homes to generate and store hot

    water. Now, many years later, they are able to store energy for the home owner,

    traveler or boater. Nowadays we have several small to even tiny sized solar panels

    and these solar panels are being used in such electrical devices as pocket

    calculators and to charge up cell phones. Small solar panels are portable and can be

    taken anywhere you want or need electrical power or battery recharging. You can

    see them in carwindow sometimes as they are charging up the car battery.

    48

    http://poweredbysolarpanels.com/tag/solar-panels/http://poweredbysolarpanels.com/industry/solar-power-system/http://poweredbysolarpanels.com/12v-solar-panels/http://www.cartechautoparts.com/http://www.cartechautoparts.com/http://poweredbysolarpanels.com/12v-solar-panels/http://poweredbysolarpanels.com/industry/solar-power-system/http://poweredbysolarpanels.com/tag/solar-panels/
  • 7/30/2019 Raja Sekar An

    53/83

    12v solar panel cells are really semiconductors that are made using

    photovoltaic materials. Photovoltaic (PV) is the technical terminology that is

    related to the solar energy and the conversion of the suns ultra-violet rays into

    electrical energy. They do not have fluids or chemicals in them and they do not

    have any moving parts. Solar panel cells simply convert the sunlight they receive

    into stored energy with the help of an inverter. You can take a portable solar panel

    with you when you travel to places that will not have electricity and use them to

    operate your electrical devices such as your lap top, cell phone orappliances in a

    camper van or trailer.

    Some people take them out on their boats to supply the electricity they may

    need out on the water. A 12v solar panel can store energy from the battery so that it

    can be used at night when there is no sunlight available. You can use a 12v solar

    panel with various electrical appliances. They are a convenient power supply for

    charging mobile phones, personal stereos, PDAs and toys, etc. Some can be used

    for trickle charging 12 volt batteries by using the power of the sun and no need for

    an electrical outlet.

    There have been several companies that have made the 12v solar panel

    available to the public for personal use. Some of them can be used anywhere in the

    world and are famous for their name brand and performance. Uni-Solar is one such

    company that makes a good 12v solar panel that you can rely on, even in remote

    places. This company has sold many such solar panels to the military for use out in

    the field. The least expensive 12v solar panel that Uni -Solar makes is the UNI-PAC 10.

    49

    http://poweredbysolarpanels.com/solar-panel/http://poweredbysolarpanels.com/12v-solar-panels/http://poweredbysolarpanels.com/solar-energy-advantages-and-limitations/http://www.bestbrandtobuy.com/cell-phone/http://www.bestbrandtobuy.com/http://poweredbysolarpanels.com/12v-solar-panels/http://poweredbysolarpanels.com/12v-solar-panels/http://poweredbysolarpanels.com/12v-solar-panels/http://poweredbysolarpanels.com/12v-solar-panels/http://poweredbysolarpanels.com/12v-solar-panels/http://poweredbysolarpanels.com/12v-solar-panels/http://poweredbysolarpanels.com/12v-solar-panels/http://poweredbysolarpanels.com/12v-solar-panels/http://www.bestbrandtobuy.com/http://www.bestbrandtobuy.com/cell-phone/http://poweredbysolarpanels.com/solar-energy-advantages-and-limitations/http://poweredbysolarpanels.com/12v-solar-panels/http://poweredbysolarpanels.com/solar-panel/
  • 7/30/2019 Raja Sekar An

    54/83

    This 12v solar panel chain be folded down to 254mm in length and 139mm

    in width, with a depth of 51 mm. The UNI-PAC 10 offers dual voltage charging

    for 12v and 24v.Uni-Solar also makes the UNI-PAC 15 and the UNI-PAC 34

    solar panel systems. Both can be folded down like the UNI -PAC 10 for easy

    portability. The only difference in measurement is that the UNI-PAC 15 is 27

    mm slimmer and 18 mm shorter.

    You can simply fold these up and take them with you and place them in the

    sun at your destination so the solar panels can stay charged up and be ready for use

    when you need power in remote places. A UNI-PAC 12v solar panel charger uses

    innovative United Solar Systems Corp. Triple Junction Technology. This solar

    panel charger is rugged and can be dropped or stepped on and still be able to

    provide power. It will charge up a laptop in the middle of the desert for you if you

    need it to. The time it takes to charge up .

    5.3.3 Points To Remember:

    1. Each 80watt panel fitted will require approximately 100 amp hours of battery

    power.

    2. When fitting a solar regulator 3 x 80watt panels will require a 15 amp regulator,

    so you should consider fitting a 20 amp to enable you to fit an extra panel later if

    required.

    3. AGM batteries are fully sealed and entirely maintenance free. They do cost a bitmore but are completely safe when fitted inside caravans. We at Home of 12 Volt

    highly recommend the use of AGM batteries.

    50

    http://poweredbysolarpanels.com/12v-solar-panels/http://poweredbysolarpanels.com/12v-solar-panels/http://poweredbysolarpanels.com/12v-solar-panels/http://poweredbysolarpanels.com/12v-solar-panels/
  • 7/30/2019 Raja Sekar An

    55/83

    4. A 12 volt charge system from your vehicle will charge at a rate of approximately

    30 amps and can be a handy option if you are a frequent traveller.

    5. For best results, recharge at 10% of a batterys capacity. This can be done by

    240 volt & solar charging.

    6. For best results, wire your gas fridge to your caravan batteries and solar system

    (less voltage drop means better performance).

    7. Never run your fridge or charge your batteries from your 7 pin caravan plug as

    this can result in a meltdown of your plug. It is recommended that an Anderson

    system is used.

    8. Finally keep it simple and enjoy your system.

    APPROX SOLAR OUTPUT FOR 6 HOURS A DAY SUNLIGHT:

    1 x 80 watt panel = 30 Amps

    2 x 80 watt panels = 60 Amps

    3 x 80 watt panels = 90 Amps

    A system that requires 90 amps per day would require 3 x 80 watt panels

    and batteries equivalent to 300 amp hours for continuous power supply.

    Note: Your system will perform much better in summer than what it will in winter

    due to the longer days and stronger sun.

    51

  • 7/30/2019 Raja Sekar An

    56/83

    Keep in mind that batteries are rated in amp hours at 25c. This means that

    temperature will affect the level of output that you will receive from your batteries.

    When the temperature is colder than 25c you will receive less output from your

    batteries, and in reverse, when temperature is above 25c you will receive a higher

    output from your batteries. A quick and easy way to conserve power is to fit low

    wattage fluro or L.E.D lighting. It is sometimes cheaper to change lighting than to

    add another solar panel to your system.

    Finally, it is good to remember that it is not a perfect world when fitting

    solar panels to caravans as everybodys needs are different. But if you get it close

    from the start you can and will learn to work with what you have and get the most

    out of your system. By now you should know a bit more about solar and the system

    that you may require. Remember to keep in mind that just because you now have

    solar panels fitted to your caravan, it does not mean that you will not run our of

    power. Even the most expensive systems can struggle to keep up with prolonged

    periods of bad and overcast weather. It is now time to calculate your own needs

    and build a system that will meet your requirements.

    Points To Remember:

    1 Amp at 12 Volts = 12 watts

    1 Amp at 240 Volts = 240 watts

    Amps x Volts = Watts EG 10Amps x 12 Volts = 120 wattsWatts / Volts = Amps EG 120 watts / 12 Volts = 10 Amps

    52

  • 7/30/2019 Raja Sekar An

    57/83

    APPLIANCES WATT AGE X HOURS PER DAY USAGE = DAILY LOAD

    KITCHEN LOUNGE 2 X 12 watt 3 = 72

    AWNING 1 X 12 watt .5 = 6

    BEDROOM 1 X 12 watt 1 = 12

    SHOWER 1 X 18 watt 0.5 = 18

    APPLIANCE = WATER PUMP 36 watt 0.5 = 18

    5.3.4 Advantages Of Solar Panel:

    o Solar energy is a renewable resource.o Solar cells are totally silent. They can extract energy from the sun

    without making a peep.

    o Solar energy is non-polluting. Solar cells require very littlemaintenance

    o Solar powered lights and other solar powered products are also veryeasy to install. You do not even need to worry about wires.

    5.3.5 Disadvantages Of Solar Panel:

    o Solar cells/panels, etc. can be very expensive.o Solar power cannot be created at night.

    5.4 BLOCK 4: LCD

    5.4.1 Introduction

    The most commonly used Character based LCDs are based on Hitachi's

    HD44780 controller or other which are compatible with HD44580.

    53

  • 7/30/2019 Raja Sekar An

    58/83

    In this tutorial, we will discuss about character based LCDs, their interfacing

    with various microcontrollers, various interfaces (8-bit/4-bit), programming,

    special stuff and tricks you can do with these simple looking LCDs which can give

    a new look to your application.

    5.4.2 Pin Description

    The most commonly used LCDs found in the market today are 1 Line, 2

    Line or 4 Line LCDs which have only 1 controller and support at most of 80

    characters, whereas LCDs supporting more than 80 characters make use of 2HD44780 controllers. Most LCDs with 1 controller has 14 Pins and LCDs with 2

    controller has 16 Pins (two pins are extra in both for back-light LED connections).

    Pin description is shown in the table below.

    Fig.5.4.2 Character LCD type HD44780 Pin diagram

    54

  • 7/30/2019 Raja Sekar An

    59/83

    Table 5.4.2 a) Character LCD pins with 2 Controller

    55

    Pin No. Name Description

    Pin no. 1 D7 Data bus line 7 (MSB)

    Pin no. 2 D6 Data bus line 6

    Pin no. 3D5

    Data bus line 5

    Pin no. 4 D4 Data bus line 4

    Pin no. 5 D3 Data bus line 3

    Pin no. 6 D2 Data bus line 2

    Pin no. 7 D1 Data bus line 1

    Pin no. 8 D0 Data bus line 0 (LSB)

    Pin no. 9 EN1 Enable signal for row 0 and 1 (1stcontroller)

    Pin no. 10 R/W0 = Write to LCD module

    1 = Read from LCD module

    Pin no. 11 RS0 = Instruction input

    1 = Data input

    Pin no. 12 VEE Contrast adjust

    Pin no. 13 VSS Power supply (GND)

    Pin no. 14 VCC Power supply (+5V)

    Pin no. 15 EN2 Enable signal for row 2 and 3 (2nd

    controller)

    Pin no. 16 NC Not Connected

  • 7/30/2019 Raja Sekar An

    60/83

    Usually these days you will find single controller LCD modules are used

    more in the market. So in the tutorial we will discuss more about the single

    controller LCD, the operation and everything else is same for the double controller

    too. Lets take a look at the basic information which is there in every LCD.

    Although looking at the table you can make your own commands and test

    them. Below is a brief list of useful commands which are used frequently while

    working on the LCD.

    * DDRAM address given in LCD basics section see Figure 2,3,4

    * CGRAM address from 0x00 to 0x3F, 0x00 to 0x07 for char1 and so on.

    No.Instruction Hex Decimal

    1Function Set: 8-bit, 1 Line, 5x7

    Dots0x30 48

    2Function Set: 8-bit, 2 Line, 5x7

    Dots0x38 56

    3Function Set: 4-bit, 1 Line, 5x7

    Dots0x20 32

    4Function Set: 4-bit, 2 Line, 5x7

    Dots0x28 40

    5 Entry Mode 0x06 6

    6

    Display off Cursor off

    (clearing display without clearing

    DDRAM content)

    0x08 8

  • 7/30/2019 Raja Sekar An

    61/83

    7 Display on Cursor on 0x0E 14

    8 Display on Cursor off 0x0C 12

    9 Display on Cursor blinking 0x0F 15

    10 Shift entire display left 0x18 24

    12 Shift entire display right 0x1C 30

    13 Move cursor left by one character 0x10 16

    14 Move cursor right by one character 0x14 20

    15Clear Display (also clear DDRAM

    content)0x01 1

    16Set DDRAM address or coursor

    position on display0x80+add* 128+add*

    17Set CGRAM address or set pointer

    to CGRAM location0x40+add** 64+add**

    5.4.2b ) Frequently used commands and instructions for LCD

    5.5 BLOCK 5: CURRENT SENSOR

    A current sensor is a device that detects electrical current (AC or DC) in a

    wire, and generates a signal proportional to it. The generated signal could be

    analog voltage or current or even digital output. It can be then utilized to display

    the measured current in an ammeter or can be stored for further analysis in a data

    acquisition system or can be utilized for control purpose.

    57

  • 7/30/2019 Raja Sekar An

    62/83

    The sensed current and the output signal can be:

    AC current input,o Analog output, which duplicates the wave shape of the sensed currento BIPOLAR output, which duplicates the wave shape of the sensed

    current

    o Unipolar output, which is proportional to the average or RMS valueof the sensed current.

    DC current input,o Unipolar, with a unipolar output, which duplicates the wave shape of

    the sensed current.

    o Digital output, which switches when the sensed current exceeds acertain threshold.

    Fig 5.5 Current Sensor

    58

  • 7/30/2019 Raja Sekar An

    63/83

    Specification :Inductive step down Current transformer.

    Input primary coil resistance : 1kilo ohms.

    Output Secondary Series resistance : 20 ohms

    Input Voltage Range : 150-300 Volts

    Output Voltage range : 0.5 -1.5 Volts

    5.6 BLOCK 6: VOLTAGE SENSOR

    The Voltage Sensors are used to measure the potential difference

    between the ends of an electrical component. The Voltage Sensors are equipped

    with a micro controller that greatly improves the sensor accuracy, precision and

    consistency of the readings. They are supplied calibrated and the stored calibration

    (in Volts) is automatically loaded when the Voltage Sensor is connected.

    Specification :Inductive step down voltage transformer.

    Input voltage : 0250 volts

    Primary coil Resistance : 1.5 Kilo ohms

    Secondary Coil Resistance : 6 ohms

    Maximum load Current : 1 Ampere

    Gain division : 100

    Output voltage : 0-2.50 Volts

    59

  • 7/30/2019 Raja Sekar An

    64/83

    CHAPTER 6

    CODING

    6.1. ADC:

    #include

    #include"lcd.c"

    #include"SERIAL.c"

    void adc_init()

    {

    TRISA=0xFF;

    TRISE=0x07;

    ADCON0=0xC1;

    ADCON1=0x80;

    }

    unsigned char adc()

    {

    unsigned char ah,al;

    unsigned char val;

    ADGO=1;

    while(ADGO==1);

    delay(500);

    ah=ADRESH;

    60

  • 7/30/2019 Raja Sekar An

    65/83

    al=ADRESL;

    val=((ah*256)+al);

    return(val);

    }

    void conversion(unsigned char temp)

    {

    unsigned char T,h,t,o;

    T=(temp/1000);

    h=((temp%1000)/100);

    t=(((temp%1000)%100)/10);

    o=(temp%10);

    sertx(T+0x30);

    sertx(h+0x30);

    sertx(t+0x30);sertx(o+0x30);

    sertx(0x0D);

    lcddat(T+0x30);

    lcddat(h+0x30);

    lcddat(t+0x30);

    lcddat(o+0x30);

    }

    62

  • 7/30/2019 Raja Sekar An

    66/83

    6.2. LCD :

    #include

    #define rs RC3

    #define rw RC4

    #define en RC5

    void delay(unsigned int delay)

    {

    while(delay--);

    }

    void lcdcmd(unsigned char cmd)

    {

    PORTB=cmd;

    rs=0;

    rw=0;en=1;

    delay(50);

    en=0;

    }

    void lcddat(unsigned char dat)

    {

    PORTB=dat;

    rs=1;

    63

  • 7/30/2019 Raja Sekar An

    67/83

    rw=0;

    en=1;

    delay(50);

    en=0;

    }

    void lcdstr(unsigned char *str)

    {

    while(*str)

    {

    lcddat(*str++);

    } }

    void lcdclr()

    {

    lcdcmd(0x01);delay(200);

    }

    void lcdinit()

    {

    lcdcmd(0x38);

    lcdcmd(0x0C);

    lcdclr();

    lcdcmd(0x80) }

    64

  • 7/30/2019 Raja Sekar An

    68/83

    6. 3. SERIAL:

    #include

    void serinit()

    {

    TXSTA=0x26;

    SPEN=1;

    //CREN=1;

    SPBRG=25; }

    /*unsigned char serrx()

    {

    unsigned char rx;

    while(RCIF==0);

    rx=RCREG;

    RCIF=0;return(rx);

    }*/

    void sertx(unsigned char tx)

    {

    TXREG=tx;

    while(TXIF==0);

    TXIF=0;

    }

    65

  • 7/30/2019 Raja Sekar An

    69/83

    6. 4. KEYPAD:

    #include

    #include"serial.c"

    void clr_r1(void)

    {

    RB0=0;

    RB1=1;

    RB2=1;

    RB3=1;

    }

    void scan_c1(void)

    {

    if(RB4==0){

    while(RB4==0);

    sertx('0');

    // sertx('7');

    delay(500);

    }

    if(RB5==0)

    {

    66

  • 7/30/2019 Raja Sekar An

    70/83

    while(RB5==0);

    sertx('1');

    // sertx('8');

    delay(500);

    }

    if(RB6==0)

    {

    while(RB6==0);

    sertx('2');

    // sertx('9');

    delay(500);

    }

    if(RB7==0)

    {while(RB7==0);

    sertx('3');

    // sertx('/');

    delay(500);

    }

    }

    void clr_r2(void)

    {

    67

  • 7/30/2019 Raja Sekar An

    71/83

    RB0=1;

    RB1=0;

    RB2=1;

    RB3=1;

    }

    void scan_c2(void)

    {

    if(RB4==0)

    {

    while(RB4==0);

    sertx('4');

    // sertx('4');

    delay(500);

    }if(RB5==0)

    {

    while(RB5==0);

    sertx('5');

    // sertx('5');

    delay(500);

    }

    if(RB6==0)

    68

  • 7/30/2019 Raja Sekar An

    72/83

    {

    while(RB6==0);

    sertx('6');

    // sertx('6');

    delay(500);

    }

    if(RB7==0)

    {

    while(RB7==0);

    sertx('7');

    // sertx('*');

    delay(500);

    }

    }void clr_r3(void)

    {

    RB0=1;

    RB1=1;

    RB2=0;

    RB3=1;

    }

    69

  • 7/30/2019 Raja Sekar An

    73/83

    void scan_c3(void)

    {

    if(RB4==0)

    {

    while(RB4==0);

    sertx('8');

    // sertx('1');

    delay(500);

    }

    if(RB5==0)

    {

    while(RB5==0);

    sertx('9');

    // sertx('2');delay(500);

    } if(RB6==0)

    {

    while(RB6==0);

    sertx('A');

    // sertx('3');

    delay(500);

    }

    70

  • 7/30/2019 Raja Sekar An

    74/83

    if(RB7==0)

    {

    while(RB7==0);

    sertx('B');

    // sertx('-');

    delay(500);

    }

    }

    void clr_r4(void)

    {

    RB0=1;

    RB1=1;

    RB2=1;

    RB3=0;}

    void scan_c4(void)

    {

    if(RB4==0)

    {

    while(RB4==0);

    sertx('C');

    // sertx(0x08);

    71

  • 7/30/2019 Raja Sekar An

    75/83

    delay(500);

    }

    if(RB5==0)

    { while(RB5==0);

    sertx('D');

    // sertx('0');

    delay(500);

    }

    if(RB6==0)

    { while(RB6==0);

    sertx('E');

    // sertx('=');

    delay(500);}

    if(RB7==0)

    { while(RB7==0);

    sertx('F');

    // sertx('+');

    delay(500);

    }

    }

    72

  • 7/30/2019 Raja Sekar An

    76/83

    6.5. SOFTWARE

    6.5.1 CCS PIC-C compiler

    The CCS PCW compiler is specially designed to meet the special needs ofthe pic micro MCU controllers. These tools allow developers to quickly design

    application software for these controllers in a highly readable, high-level

    language. The compilers has some limitations when compared to a more

    traditional C Compiler. The hardware limitations make many traditional C

    compilers Ineffective. As an example of the limitations, the compilers will not

    permit Pointers to constant arrays.

    This is due to the separate code/data segments in The picmicro MCU

    hardware and the inability to treat ROM areas as data. On The other hand, the

    compilers have knowledge about the hardware limitations And do the work of

    deciding how to best implement your algorithms. The Compilers can efficiently

    implement normal C constructs, input/output operations And bit twiddling

    operations.

    The compiler can output 8 bit hex, 16 bit hex, and binary files. Two

    listing formats Are available. Standard format resembles the Microchip tools

    and may be Required by some third-party tools. The simple format is easier to

    read. The Debug file may either be a Microchip .COD file or Advanced Trans

    data .MAP file. All file formats and extensions are selected via the Options File

    Formats men Option in the Windows IDE.

    73

  • 7/30/2019 Raja Sekar An

    77/83

    6.6 OVERALL STRUCTURE

    A program is made up of the following four elements in a file:

    Comment Pre-Processor Directive Data Definition Function Definition

    Every C program must contain a main function which is the starting point

    of the program execution. The program can be split into multiple functions

    according to the their purpose and the functions could be called from main or the

    sub functions. In a large project functions can also be placed in different C files or

    header files that can be included in the main C file to group the related functions

    by their category.

    CCS C also requires to include the appropriate device file using#include directive to include the device specific functionality. There are also some

    preprocessor directives like #fuses to specify the fuses for the chip and #use delay

    to specify the clock speed. The functions contain the data declarations, definitions,

    statements and expressions. The compiler also provides a large number of standard

    C libraries as well as other device drivers that can be included and used in the

    programs. CCS also provides a large number of built-in functions to access the

    various peripherals included in the PIC microcontroller.

    74

  • 7/30/2019 Raja Sekar An

    78/83

    Comments Standard CommentsA comment may appear anywhere within a file except within a quoted string.

    Characters between /* and */ are ignored. Characters after a // up to the end of the

    line are ignored.

    Variable Comments A variable comment is a comment that appears

    immediately after a variable declaration. For example:

    int seconds; // Number of seconds since last entry

    long day, // Current day of the month

    month, /* Current Month */

    year; // Year

    Function CommentsA function comment is a comment that appears just before

    a function declaration. For example:

    // The following function initializes outputs

    void function_foo()

    {

    init_outputs();

    }

    75

  • 7/30/2019 Raja Sekar An

    79/83

    Using Program Memory for DataConstant Data:

    The const qualifier will place the variables into program memory. The

    syntax is const type specifier id [cexpr] ={value}

    If the keyword CONST is used before the identifier, the identifier is

    treated as a constant. Constants should be initialized and may not be changed at

    run-time.

    For eg:

    #ORG 0x1C00, 0x1C0F

    CONST CHAR ID[10]= {"123456789"};

    This ID will be at 1C00.

    Note: some extra code will proceed the 123456789.

    A new method allows the use of pointers to ROM. The new keyword for

    compilation modes CCS4 and ANSI is ROM and for other modes it is

    _ROM. This method does not contain extra code at the start of the structure.

    76

  • 7/30/2019 Raja Sekar An

    80/83

    CHAPTER 7

    REQUIREMENTS

    7.1 HARDWARE REQUIREMENTS:

    PIC16F877A Microcontroller with Power Supply 12V,1.2A Battery 12V Solar Panel LCD Tank Mechanism Current Sensor Voltage Sensor

    7.2 SOFTWARE REQUIREMENTS

    Embedded c MP Lab Compiler or CCS Compiler

    7.3 ADVANTAGES

    Energy efficient Long lasting and free maintenance . No dependency on electricity . Satisfactory performance on water pumping. User & environment friendly.

    77

  • 7/30/2019 Raja Sekar An

    81/83

    CHAPTER 8

    FUTURE ENHANCEMENT

    In future, Upfront cost of the solar pumping system potentially hinder to

    popularize the system in the rural areas but private companies, bank and govt. can

    come forward for a solution that can fit to rural people of Bangladesh.

    78

  • 7/30/2019 Raja Sekar An

    82/83

    CHAPTER 9

    CONCLUSION

    All components in the system can be procured from locally available markets

    from nearby areas which eventually reduce the overall cost. The designed DC

    water pumping system has a great prospect to solve out the energy crisis in the

    irrigation season as well as it can be used to cultivate lands throughout the year.

    79

  • 7/30/2019 Raja Sekar An

    83/83

    CHAPTER 10

    REFERENCES

    [1] Helikson,H.J and Others, Pumping water for irrigation using solar energy,

    University of Florida, USA, 1995.

    [2]Microcontrollerdatasheet.[Online].Available:http://www.datasheetcatalog.co

    m/datasheets_pdf/A/T/M/E/ATMEGA32.shtml.

    [3] Minor Irrigation Survey Report 2008-09, Bangladesh Agricultural

    Development Corporation, Survey and monitoring project for development of

    minor irrigation, June-2009.

    [4] Rashid, Muhammad H. Power Electronics - Circuits, Devices, and Applications

    3rd Edition Pearson Education, 2004

    [5] The Daily Prothom Alo, 4th November, 2009, web page available:

    http://www.prothom-alo.com/detail/date/2009-11-04/news/17114

    [6] WATTSUNTM SOLAR TRACKER RETAIL PRICE AND DATA