Download - Microcontroller based solar charger
Microcontroller Based Solar Charger
Electronics and Communication Engineering Department SNGIST
Microcontroller Based Solar ChargerA PROJECT REPORT
Submitted
In partial fulfillment of the requirements for the award of the degree of
BACHELOR OF TECHNOLOGY
in
ELECTRONICS AND COMMUNICATION ENGINEERING
of
Mahathma Gandhi University ,Kottayam
By
ATHIRA J - 11021431ASHLIN DAVID - 11021430ANVIN PS - 11021429ATHULDEEP N - 11021432
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
SREE NARAYANA GURU INSTITUTE OF SCIENCE AND TECHNOLOGY
MANJALY, MANNAM P.O, NORTH PARAVUR -683520.
Microcontroller Based Solar Charger
Electronics and Communication Engineering Department SNGIST
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
SREE NARAYANA GURU INSTITUTE OF SCIENCE AND TECHNOLOGY
MANJALY, MANNAM P.O, NORTH PARAVUR -683520.
CERTIFICATE
Certified that the mini project report entitled “Microcontroller
Based SolarCharger” is submitted by ATHIRAJ–Reg No:11021431,
ASHLIN DAVID–Reg No:11021430, ANVIN PS–Reg No:11021429 &
ATHULDEEP.N–Reg No:11021432 is the bonafide report of the mini project
done by her / him under the guidance of us, in partial fulfillment for the award
of Bachelor of Technology in Electronics and Communication Engineering of
M G University during the year 2014.
Submitted for the practical examination conducted on…………………
Guide HOD
Internal Examiner External Examiner
Date: Date:
iiiMicrocontroller Based Solar Charger
Electronics and Communication Engineering Department SNGIST
ACKNOWLEDGEMENT
I am grateful to the Management of SreeNarayana Guru Institute of Science and
Technology for providing me the facilities for the completion of my task. Firstly I extend my
gratitude to Dr K.S. Divakaran Nair, Director of SreeNarayana Guru Institute of Science
and Technology for his continuous support.
It is my privilege to thank Prof. V.Sureshkumar, Dean of Engineering, SreeNarayana
Guru Institute of Science and Technology for his blessings and encouragement.
I would also like to thank Mr. Rajan N, Head of the Department of Electronics and
Communication Engineering for his inspiration and guidance. May I express my heartfelt
thanks to my guide Mr. Sumesh A.S, for his / her valuable guidance and advice related to
this work.
I thank all the faculty members of Department of Electronics and Communication
Engineering for all the help extended to me and for motivating me. I also extend my gratitude
to technical staff in the Lab, for all their support and help.
I, on this occasion, remember the valuable support and prayers offered by my family
members and friends which were indispensable for the successful.
ivMicrocontroller Based Solar Charger
Electronics and Communication Engineering Department SNGIST
ABSTRACT
As the sources of conventional energy deplete day by day, resorting to alternative sources of
energy like solar and wind energy has become need of the hour.
Solar-powered lighting systems are already available in rural as well as urban areas. These
include solar lanterns, solar home lighting systems, solar streetlights, solar garden lights and
solar power packs. All of them consist of four components: solar photovoltaic module,
rechargeable battery, solar charge controller and load.
In the solar-powered lighting system, the solar charge controller plays an important role as
the system’s overall success depends mainly on it. It is considered as an indispensable link
between the solar panel, battery and load.
The microcontroller-based solar charge controller described here has the following features:
1. Automatic dusk-to-dawn operation of the load
2. Built-in digital voltmeter (0V-20V range)
3. Overcharge protection
4. System status display on LCD
5. Low current consumption
6. Highly efficient design based on microcontroller
vMicrocontroller Based Solar Charger
Electronics and Communication Engineering Department SNGIST
CONTENTS
SL NO. TOPIC NAME PAGE NO.
1 INTRODUCTION 9
2 BLOCK DIAGRAM 11
2.1 BLOCK DIAGRAM EXPLANATION 12
3 MICRO CONTROLLER 13
3.1 PIC 16F877A FEATURES 14
3.2 BLOCK DIAGRAM OF PIC MICRO CONTROLLER 16
3.3 PINOUT DIAGRAM OF PIC MICRO CONTROLLER 17
4 LCD DISPLAY 25
4.1 PIN DESCRIPTION 25
5 ELECTRO MECHANICAL RELAYS 27
6 SOLAR PANELS 30
7 RECHARGEABLE BATTERY 34
7.1 CHARGING&DISCHARGING 34
8 CIRCUIT DIAGRAM 36
8.1 CIRCUIT DIAGRAM EXPLANATION 37
9 PROGRAM CODING 38
10 PCB FABRICATION AND SOLDERING 41
11 SOFTWARES USED 47
12 APPENDICES 50
13 ADVANTAGES 72
14 CONCLUSION 73
15 REFERENCE 74
viMicrocontroller Based Solar Charger
Electronics and Communication Engineering Department SNGIST
LIST OF TABLES
TABLENO:
TABLE NAME PAGENO:
1 Pin out table of PIC 16F877A. 18
2 Ports in PIC 16F877A. 19
3 Specifications of the PIC 16F87X Series. 21
4 Register bank select. 22
5 Pin description table of LCD module. 26
viiMicrocontroller Based Solar Charger
Electronics and Communication Engineering Department SNGIST
LIST OF FIGURES
FIGNO:
FIGURE NAME PAGENO:
1 BLOCK DIAGRAM 11
2 BLOCKDIAGRAMOF PICMICROCONTROLLER 16
3 PINOUT DIAGRAM OF PIC 16F877 17
4 16 x 2 LCD PIN DIAGRAM 26
5 RELAY SCHEMATIC DIAGRAM 28
6 WORKING OF RELAY CIRCUIT 29
7 STRUTURE OF SOLAR CELL 33
8 SOLAR PANEL 33
9 DIAGRAM OF THE CHARGING OF A SECON DARYCELL BATTERY 34
10 LEAD ACID BATTERY 35
11 CIRCUIT DIAGRAM 36
12 PCB LAYOUT 46
13 PROTEUS INTERFACE WINDOW 48
viiiMicrocontroller Based Solar Charger
Electronics and Communication Engineering Department SNGIST
LIST OF ABBREVIATIONS
1. ROM - Read Only Memory
2. RAM - Random Access Memory
3. PIC - Peripheral Interface Controller
4. IC - Integrated Circuits
5. LCD - Liquid Crystal Display
6. PC - Program Counter
7. IEEE - Institute of Electronics & Electrical Engineers
8. ADC - Analog to Digital Converter
9. CPU - Central Processing Unit
10.I/O - Input/output
11.CMOS - Complementary MOSFET
12.N/C-Normally-closed
13.N/O-Normally-open
14.CMOS - Complementary MOSFET
15.EPROM- Erasable programmable read only memory
16.USART- Universal asynchronous receiver/transmitter
Microcontroller Based Solar Charger
9
Electronics and Communication Engineering Department SNGIST
CHAPTER: 1
INTRODUCTION
As the sources of conventional energy deplete day by day, resorting to alternative sources of energy like
solar and wind energy has become need of the hour.
Solar-powered lighting systems are already available in rural as well as urban areas. These include solar
lanterns, solar home lighting systems, solar streetlights, solar garden lights and solar power packs. All of
them consist of four components: solar photovoltaic module, rechargeable battery, solar charge controller
and load.
In the solar-powered lighting system, the solar charge controller plays an important role as the system’s
overall success depends mainly on it. It is considered as an indispensable link between the solar panel,
battery and load.
The microcontroller-based solar charge controller described here has the following features:
1. Built-in digital voltmeter (0V-20V range)
2. Overcharge protection
3. System status display on LCD
4. Low current consumption
5. Highly efficient design based on microcontroller
LCD module: The system status and battery voltage are displayed on an LCD based on HD44780 controller.
The backlight feature of the LCD makes it readable even in low light conditions. The LCD is used here in 4-
bit mode to save the microcontroller’s port pins. Usually the 8-bitmode of interfacing with a microcontroller
requires eleven pins, but in 4-bit mode the LCD can be interfaced to the microcontroller using only
seven pins.
Microcontroller Based Solar Charger
10
Electronics and Communication Engineering Department SNGIST
Solar panel: The solar panel used here is meant to charge a 12V battery and the wattage can range from 3 to
40 watts. The peak unloaded voltage output of the solar panel will be around 19 volts. Higher-wattage
panels can be used with some modifications to the controller unit.
Rechargeable battery: The solar energy is converted into electrical energy and stored in a 12V lead-acid
battery. The ampere-hour capacity ranges from 5 Ah to 100 Ah.
Charge control: Relay RL1 connects the solar panel to the battery through diode D1. Under normal
conditions, it allows the charging current from the panel to flow into the battery. When the battery is at full
charge (12.0V), the charging current becomes ‘pulsed.’ To keep the overall current consumption of the solar
controller low, normally-closed (N/C) contacts of the relay are used and the relay is normally in de-
energised state.
Load control: One terminal of the load is connected to the battery through a relay. This relay will control
the load providing. That is if the resistance of load is below 3ohms(high current) then the relay get energised
and cut off the load.
Microcontroller Based Solar Charger
11
Electronics and Communication Engineering Department SNGIST
CHAPTER : 2
BLOCK DIAGRAM
Figure1:block diagram.
Microcontroller Based Solar Charger
12
Electronics and Communication Engineering Department SNGIST
2.1) BLOCK DIAGRAM EXPLANATION
Here we are using PIC16F877A as the major component. Which will control all actions and provide basic
protection based on the program.
We have a 12V rechargeable battery and a 12V solar panel ,on day time the solar panel will provide 12V
,which will charge the battery and provide 12V constant load.The charging is controlled by the Relay 1.If
the battery is full then the relay get energized. So Relay 1 will provide over charge protection.
The relay switch RL2 is used to protect the battery from over load. When an overload is occurred, the relay
switch RL2 is energised and it disconnects load from battery. The relay will be de-energised when the
overload reset switch is pressed.
The voltage at the battery is continuously displayed on the LCD using the built-in ADC module in the PIC
16F877A. The voltage is divided by 3 by using 3 equal value resistors and 1/3 voltage is send to ADC input.
Microcontroller Based Solar Charger
13
Electronics and Communication Engineering Department SNGIST
CHAPTER : 3
MICRO CONTROLLER
A microcontroller is a computer-on-a-chip, or, preferably, a single-chip computer. Micro
suggests that the device is small, and controller tells you that the device might be used to control
objects, processes, or events. Another term to describe a microcontroller is embedded controller,
because the microcontroller and its support circuits are often built into, or embedded in, the devices
they control.
Microcontrollers are found in all kinds of things these days. Any device that measures, stores,
controls, calculates, or displays information is a candidate for putting a microcontroller inside. The
largest single use for microcontrollers is in automobiles—just about every car manufactured today
includes at least one microcontroller for engine control, and often more to control additional systems in
the car. In desktop computers, you can find microcontrollers inside keyboards, modems, printers, and
other peripherals. In test equipment, microcontrollers make it easy to add features such as the ability to
store measurements, to create and store user routines, and to display messages and waveforms.
Consumer products that use microcontrollers include cameras, video recorders, compact-disk players,
and ovens. And these are just a few examples.
A micro controller is similar to the microprocessor inside a personal computer. Examples of
microprocessors include Intel’s 8086, Motorola’s 68000, and Zilog’s Z80, ATMEL 89c51. These
microprocessors and microcontrollers contain a central processing unit, or CPU. The CPU executes
instructions that perform the basic logic, math, and data-moving functions of a computer. To make a
complete computer, a microprocessor requires memory for storing data and programs, and input/output
(I/O) interfaces for connecting external devices like keyboards and displays.
In contrast, a micro controller is a single-chip computer because it contains memory and
I/O interfaces in addition to the CPU. Because the amount of memory and interfaces that can fit on a
single chip is limited, microcontrollers tend to be used in smaller systems that require little more than
the microcontroller and a few support components.
Microcontroller Based Solar Charger
14
Electronics and Communication Engineering Department SNGIST
PIC micro controllers are low-cost computers-in-a-chip; they allow electronics designers
and hobbyists add intelligence and functions that mimic big computers for almost any electronic
product or project.
The programming of the system is done using a PIC micro controller 16F877. This powerful (200
nanosecond instruction execution) yet easy-to-program (only 35 single word instructions) CMOS
FLASH-based 8-bit micro controller packs Microchip's powerful PIC® architecture into a 40-pin
package and is upwards compatible with the PIC16C5X, PIC12CXXX and PIC16C7X devices. It is
has five ports. I.e. port A, port B, port C, port D, port E. The PIC 16F877 has flash memory of 8K and
Data memory of 368 bytes Data EEPROM of 256 bytes.The micro-controller used for our project
isMicrochip’s PIC16F877A.
3.1)PIC 16F877A- FEATURES
High Performance RISC CPU:
• High performance RISC CPU
• Only 35 single word instructions to learn
• All single cycle instructions except for program branches which are two-cycle
• Operating speed: DC - 20 MHz clock input
DC - 200 ns instruction cycle
• Up to 8K x 14 words of FLASH Program Memory,
Up to 368 x 8 bytes of Data Memory (RAM)
• Interrupt capability (up to 12 sources)
• Eight level deep hardware stack
• Direct, Indirect and Relative Addressing modes
• Processor read access to program memory.
Special Microcontroller Features:
• Power-on Reset (POR)
• Power-up Timer (PWRT) and
Microcontroller Based Solar Charger
15
Electronics and Communication Engineering Department SNGIST
Oscillator Start-up Timer (OST)
• Watchdog Timer (WDT) with its own on-chip RC
oscillator for reliable operation
• Programmable code protection
• Power saving SLEEP mode
Selectable oscillator options
Peripheral Features:
• Timer0: 8-bit timer/counter with 8-bit prescaler
• Timer1: 16-bit timer/counter with prescaler,
can be incremented during SLEEP via external
crystal/clock
• Timer2: 8-bit timer/counter with 8-bit period
register, prescaler and postscaler
• Two Capture, Compare, PWM modules
- Capture is 16-bit, max. resolution is 12.5 ns
- Compare is 16-bit, max. resolution is 200 ns
- PWM max. resolution is 10-bit
• 8-bit, up to 8-channel Analog-to-Digital converter
• Synchronous Serial Port (SSP) with SPI (Master
mode) and I2C (Slave)
• Universal Synchronous Asynchronous Receiver
Transmitter (USART/SCI)
• Parallel Slave Port (PSP), 8-bits wide with
external RD, WR and CS controls (40/44-pin only)
• Brown-out detection circuitry for
Brown-out Reset (BOR)
Microcontroller Based Solar Charger
16
Electronics and Communication Engineering Department SNGIST
WHY PIC IS USED?
Speed
High Performance RISC CPU
Instruction Set Simplicity
Integration Of Operation Features
Programmable Timer Options
Interrupt Control
EPROM /OTP/ROM options
Inbuilt Modules
Low Power Consumption
Wide Operation Voltage Range :2.5to 6.0 Volt
Programmable Code Protection Mode
Power Saving Sleep Mode
3.2)BlockDiagramof PICMicroController
Figure2: BLOCKDIAGRAMOF PICMICROCONTROLLER
Microcontroller Based Solar Charger
17
Electronics and Communication Engineering Department SNGIST
3.3)PINOUT DIAGRAM OF PIC 16F877
Figure3:PINOUT DIAGRAM OF PIC 16F877
Microcontroller Based Solar Charger
18
Electronics and Communication Engineering Department SNGIST
Tbl1:Pin out table of PIC 16F877A
PIN NAME DIPPIN #
PLCCPIN #
I/O/O
TYPE
BUFFERTYPE
DESCRIP-TION
QFP
Osc/clkin
Osc/clkout
13
14
14
15
1
0
St/cmos
-
Osc.crystali/p. osc.crystalo/p
30
31
MCLR/Vpp 1 2 i/p St Master cleari/p or programo/p.
18
RA0/AN0
RA1/AN1
RA2/AN2/VREF-
RA3/AN3/VREF+
RA4/TOCK1
RA5/SS/AN4
2
3
4
5
6
7
3
4
5
6
7
8
I/O
I/O
I/O
I/O
I/O
I/O
TTL
TTL
TTL
TTL
SL
TTL
Port A is bidirectional i/p.
19
20
21
22
23
24RB0/INT
RB1
RB2
RB3/PGM
RB4
RB5
RB6/PGC
RB7/PGD
33
34
35
36
37
38
39
40
36
37
38
39
41
42
43
44
I/O
I/O
I/O
I/O
I/O
I/O
I/O
I/O
TTL/ST1
TTL
TTL
TTL
TTL
TTL
TTL/ST2
TTL/ST2
Port B is a bidirectional i/oport. Port bcan be s/wpgmed forpull up on
8
9
10
11
14
15
16
17
Microcontroller Based Solar Charger
19
Electronics and Communication Engineering Department SNGIST
Input/output ports
PIC16F877 has 5 basic input/output ports. They are usually denoted by PORT A (R A), PORT B (RB), PORT C
(RC), PORT D (RD), and PORT E (RE). These ports are used for input/ output interfacing. In this controller,
“PORT A” is only 6 bits wide (RA-0 to RA-7), ”PORT B” , “PORT C”,”PORT D” are only 8 bits wide (RB-0 to
RB-7,RC-0 to RC-7,RD-0 to RD-7), ”PORT E” has only 3 bit wide (RE-0 to RE-7).
PORT-A RA-0 to RA-5 6 bit wide
PORT-B RB-0 to RB-7 8 bit wide
PORT-C RC-0 to RC-7 8 bit wide
PORT-D RD-0 to RD-7 8 bit wide
PORT-E RE-0 to RE-2 3 bit wid
Tbl2 :Ports in PIC 16F877A
All these ports are bi-directional. The direction of the port is controlled by using TRIS(X) registers (TRIS A used
to set the direction of PORT-A, TRIS B used to set the direction for PORT-B, etc.). Setting a TRIS(X) bit ‘1’
will set the corresponding PORT(X) bit as input. Clearing a TRIS(X) bit ‘0’ will set the corresponding PORT(X)
bit as output.
(If we want to set PORT A as an input, just set TRIS(A) bit to logical ‘1’ and want to set PORT B as an output,
just set the PORT B bits to logical ‘0’.)
Other Pins:
o Analog input port (AN0 TO AN7) : these ports are used for interfacing analog inputs.
o TX and RX: These are the USART transmission and reception ports.
o SCK: these pins are used for giving synchronous serial clock input.
o SCL: these pins act as an output for both SPI and I2C modes.
o DT: these are synchronous data terminals.
o CK: synchronous clock input.
o SD0: SPI data output (SPI Mode).
o SD1: SPI Data input (SPI mode).
Microcontroller Based Solar Charger
20
Electronics and Communication Engineering Department SNGIST
o SDA: data input/output in I2C Mode.
o CCP1 and CCP2: these are capture/compare/PWM modules.
o OSC1: oscillator input/external clock.
o OSC2: oscillator output/clock out.
o MCLR: master clear pin (Active low reset).
o Vpp: programming voltage input.
o THV: High voltage test mode controlling.
o Vref (+/-): reference voltage.
o SS: Slave select for the synchronous serial port.
o T0CK1: clock input to TIMER 0.
o T1OSO: Timer 1 oscillator output.
o T1OS1: Timer 1 oscillator input.
o T1CK1: clock input to Timer 1.
o PGD: Serial programming data.
o PGC: serial programming clock.
o PGM: Low Voltage Programming input.
o INT: external interrupt.
o RD: Read control for parallel slave port.
o CS: Select control for parallel slave.
o PSP0 to PSP7: Parallel slave port.
o VDD: positive supply for logic and input pins.
VSS: Ground reference for logic and input/output pins.
Microcontroller Based Solar Charger
21
Electronics and Communication Engineering Department SNGIST
Tbl 4:specifications of the PIC 16F87X Series
Microcontroller Based Solar Charger
22
Electronics and Communication Engineering Department SNGIST
DATA MEMORY &PROGRAM MEMORY
The PIC 16F87x devices have a 13-bit program counter, Capable of addressing
an 8K x 14 program memory space. The PIC 16F877 has 8Kx 14 words of FLASH
program memory. The RESET Vector is at 0000h and the interrupt vector is at 0004h.
Data memory is partition in to multiple banks which contain the general
purpose registers and special function registers. Bits RP1(status <6>) and
RP0(status<5>) are the banks bits.
Tbl3: Register bank select
Each bank extends up to 7Fh (128bits). The lower location of each banks are
Reserved for the special function registers. About the special function registers are
general purpose registers, implemented as the static RAM. All implemented banks
contain special function registers .Some frequently used special function register from 1
bank may be mirrored in another bank for code reduction and quicker access.
RP1:RP0BANK
00 001 110 211 3
Microcontroller Based Solar Charger
23
Electronics and Communication Engineering Department SNGIST
ANALOG TO DIGITAL CONVERTER MODULE (ADC)
The analog to digital converter module has 8 inputs for the 40 pin PIC .The A/D
module has 4 register :
A/D results high register.
A/D results low register
A/D control register 0.
A/D control register 1.
The A/D conversion of the analog input signals in a corresponding 10-bit digital
number.
ADCON0 REGISTER.
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 U-0 R/W-0
ADCS1
ADCS0
CHS2
CHS1
CHS0
GO/DONE ------ ADCON
ADCON1 REGISTER
U-0 U-0 R/W-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0
ADF
M- - -
PCF
G3
PCF
G2
PCF
G1
PCF
G0
Microcontroller Based Solar Charger
24
Electronics and Communication Engineering Department SNGIST
USART
This mode is usually used to communicate in 8-bit ASCII code. It has two pins
for transmittion and reception.Transmittion begins whenever data is written to SBUF.
USART is an acronym for universal synchronous asynchronous receiver and
transmitter.
Control Register Of Transmittion (Txsta)
Control Register Of Reception (Rxsta)
SPEN
Rx9
SREN
CREN
ADDEN
FERR
OERR
Rx9D
CSRC
TX9
TxEN SYNC-
BRGH TRMT Tx9D
Microcontroller Based Solar Charger
25
Electronics and Communication Engineering Department SNGIST
CHAPTER: 4
LCD DISPLAY
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. Liquid crystals
do not emit light directly. LCDs are available to display arbitrary images (as in a
general-purpose computer display) or fixed images which can be displayed or hidden,
such as preset words, digits, and 7-segment displays as in a digital clock. They use the
same basic technology, except that arbitrary images are made up of a large number of
small pixels, while other displays have larger elements.
A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In
this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers,
namely, Command and Data.The command register stores the command instructions
given to the LCD. A command is an instruction given to LCD to do a predefined task
like initializing it, clearing its screen, setting the cursor position, controlling display etc.
The data register stores the data to be displayed on the LCD. The data is the ASCII
value of the character to be displayed on the LCD.
4.1)PINDESCRIPTION
The most commonly used LCDs found in the market today are 1Line,2Line or4 Line LCDs which
have only1 controller and support at most of 80 characters, where as LCD s supporting more than 80
characters make use of 2HD44780 controllers.
Most LCD swith 1 controller has 14 Pins and LCDs with 2 controller has16 Pins (two pinsare
extrainbothforback-lightLEDconnections).Pindescriptionis showninthe tablebelow.
Microcontroller Based Solar Charger
26
Electronics and Communication Engineering Department SNGIST
Figure: 4 :16 x 2 LCD Pin diagram
Tbl 4: Pin description table of LCD module
PinNo:
Function Name
1 Ground (0V) Ground
2 Supply voltage; 5V (4.7V – 5.3V) Vcc
3 Contrast adjustment; through a variable resistor VEE
4 Selects command register when low; and data register when high Register Select
5 Low to write to the register; High to read from the register Read/write
6 Sends data to data pins when a high to low pulse is given Enable
7
8-bit data pins
DB0
8 DB1
9 DB2
10 DB3
11 DB4
12 DB5
13 DB6
14 DB7
15 Backlight VCC (5V) Led+
16 Backlight Ground (0V) Led-
Microcontroller Based Solar Charger
27
Electronics and Communication Engineering Department SNGIST
CHAPTER: 5
ELECTRO MECHANICAL RELAYS
A relay is a switch worked by an electromagnet. It is useful if we want a small current in one
circuit to control another circuit containing a device such as a lamp or electric motor which requires a
large current, or if we wish several different switch contacts to be operated simultaneously.
When the controlling current flows through the coil, the soft iron core is magnetized and
attracts the L-shaped soft iron armature. This rocks on its pivot and opens, closes or changes over, the
electrical contacts in the circuit being controlled it closes the contacts.
The current needed to operate a relay is called the pull-in current and the dropout current in
the coil when the relay just stops working. If the coil resistance R of a relay is 185 and its
operating voltage V is 12V, the pull-in current I is given by:
I = V/R = 12/185 = 65 mA
Relays are electromagnetic switches, which provides contact between two mechanical elements.
Relays have a coil which works on 12V dc power supply and provides DPDT action as an output.
In general relays provide potential free contacts which can be used for universal function like
DC, AC voltage switching and to control bigger electrical switch gears.
The electromechanical relays are based on the comparison between operating torque/force
and restraining torque/force. The VA burden of such relays are high.
The characteristics of these relays have some limitations. Each relay can perform only one
protective function. Such relays are used for simple and less costly protection purposes. For
important and costly equipment installation static relays are
preferred.
Microcontroller Based Solar Charger
28
Electronics and Communication Engineering Department SNGIST
Figure: 5: Relay schematic diagram
Protective relaying is necessary for almost every electrical plant and no part of the power system
is left unprotected.
The choice of protection depends upon several aspects such as
type and rating of the protected equipment.
its importance.
location and cost.
probable abnormal conditions between generators and final
load points.
There are several electrical equipments and machines of various ratings. Each needs
certain adequate protection .The protective relaying senses the abnormal conditions in a part of the
power system and isolates that part from the healthy part of system.The relays used in this project are
compact, self-contained devices which respond to abnormal conditions (relays can distinguish normal
and abnormal conditions).The Relay driver Circuit Works as follows. A Relay is connected as
shown in the figure 5(a).
Microcontroller Based Solar Charger
29
Electronics and Communication Engineering Department SNGIST
Figure 6: Working Of Relay Circuit
The output of the controller decides Relay operation. The Relay works only if the Positive and
the Ground is connected to the appropriate terminals of the relay coil. We control the relay by
controlling the ground signal given to the relay using a transistor. The operation is as follows.
When the output of the controller is High, then the transistor conducts, allowing the low potential to
reach one end of the relay, which results in switching of the relay form NC to NO.
When the output is Low, the transistor will not conduct. So ground is not applied to the relay Coil. So
the relay remain in NC position.
Using this Normally open (NO) and Normally Closed (NC) contacts we can switch any supply AC
or DC. The supply to the operated device should be given to the Common of the relay and the
output from the NO is given to the Device. So that
when the relay is switched on the device gets supply and works.
Microcontroller Based Solar Charger
30
Electronics and Communication Engineering Department SNGIST
CHAPTER: 6
SOLAR PANEL
6.1 )PHOTO VOLTAIC CELLS (PV CELLS)
There are two basic types of solid silicon, amorphous (having no long range order) and crystalline
(where the atoms are arranged in an ordered three dimensional array). There are various other terms
for the crystalline structure of silicon; poly-crystalline, micro-crystalline, nano-crystalline etc, and
these refer to the size of the crystal "grains" which make up the solid. Solar cells can be, and are
made from each of these types of silicon, the most common being poly-crystalline.
Silicon is a semiconductor. This means that in solid silicon, there are certain bands of energies which
the electrons are allowed to have, and other energies between these bands which are forbidden. These
forbidden energies are called the "band gap". The allowed and orbidden bands of energy are
explained by the theory of quantum mechanics.
At room temperature, pure silicon is a poor electrical conductor. In quantum mechanics, this is
explained by the fact that the Fermi level lies in the forbidden band- gap. To make silicon a better
conductor, it is "doped" with very small amounts of atoms from either group 13 (III) or group 15 (V)
of the periodic table. These "dopant" atoms take the place of the silicon atoms in the crystal lattice, and
bond with their neighboring Si atoms in almost the same way as other Si atoms do. However, because
group 13 atoms have only 3 valence electrons, and group 15 atoms have 5 valence electrons, there is
either one too few, or one too many electrons to satisfy the four covalent bonds around each atom.
Since these extra electrons, or lack of electrons (known as "holes") are not involved in the covalent
bonds of the crystal lattice, they are free to move around within the solid. Silicon which is doped with
group 13 atoms (aluminum, gallium) is known as p-type silicon because the majority charge carriers
(holes) carry a positive charge, whilst silicon doped with group 15 atoms (phosphorus, arsenic) is
known as n-type silicon because the majority charge carriers (electrons) are negative. It should be
noted that both n-type and p-type silicon are electrically neutral,
i.e. they have the same numbers of positive and negative charges, it is just that in n-type silicon,
some of the negative charges are free to move around, while the converse is true for p-type silicon.
Microcontroller Based Solar Charger
31
Electronics and Communication Engineering Department SNGIST
A solar cell is a large-area semiconductor p-n junction. To understand the workings of a p-n junction it
is convenient to imagine what happens when a piece of n-type silicon is brought into contact with a
piece of p-type silicon. In practice, however, the p-n junctions of solar cells are not made in this way,
but rather, usually, by diffusing an n- type dopant into one side of a p-type wafer.
If we imagine what happens when a piece of p-type silicon is placed in intimate contact with a
piece of n-type silicon, then what occurs is a diffusion of electrons from the region of high
electron concentration - the n-type side of the junction, into the region of low electron concentration
- p-type side of the junction. When the electrons diffuse across the p-n junction, they recombine
with holes on the p-type side. This diffusion of carriers does not happen indefinitely however,
because of the electric field which is created by the imbalance of charge immediately either side of
the junction which this diffusion creates. Electrons from donor atoms on the n-type side of the junction
are crossing into the p-type side, leaving behind the (extra) positively charged nuclei of the group 15
donor atoms, leaving an excess of positive charge on the n-type side of the junction. At the same
time, these electrons are filling in holes on the p-type side of the junction, becoming involved in
covalent bonds around the group 13 acceptor atoms, making an excess of negative charge on the p-
type side of the junction. This imbalance of charge across the p-n junction sets up an electric field
which opposes further diffusion of charge carriers across the junction.
This region where electrons have diffused across the junction is called the depletion region because it
no longer contains any mobile charge carriers. It is also known as the "space charge region". The
electric field which is set up across the p-n junction creates a diode, allowing current to flow in only
one direction across the junction. Electrons may pass from the n-type side into the p-type side, and
holes may pass from the p-type side to the n-type side. But since the sign of the charge on
electrons and holes is opposite, conventional current may only flow in one direction.
Because solar cells are semiconductor devices, they share many of the same processing and
manufacturing techniques as other semiconductor devices such as computer and memory chips.
However, the stringent requirements for cleanliness and quality control of semiconductor fabrication
are a little more relaxed for solar cells. Most large-scale commercial solar cell factories today make
screen printed poly- crystalline silicon solar cells. Single crystalline wafers which are used in the
semiconductor industry can be made in to excellent high efficiency solar cells, but they are
generally considered to be too expensive for large-scale mass production. Poly-crystalline silicon
Microcontroller Based Solar Charger
32
Electronics and Communication Engineering Department SNGIST
wafers are made by wire-sawing block-cast silicon ingots into very thin (250 to 350 micrometer) slices
or wafers
The wafers are usually lightly p-type doped. To make a solar cell from the wafer, an n-type diffusion
is performed on the front side of the wafer, forming a p-n junction a few hundred nanometres below
the surface. Antireflection coatings, which increase the amount of light coupled into the solar cell,
are typically applied next. Over the past decade, silicon nitride has gradually replaced
titanium dioxide as the antireflection coating of choice because of its excellent surface passivation
qualities (i.e., it prevents carrier recombination at the surface of the solar cell). It is typically applied in
a layer several hundred nanometers thick using plasma-enhanced chemical vapor deposition
(PECVD). The wafer is then metallised, whereby a full area metal contact is made on the back
surface, and a grid-like metal contact made up of fine "fingers" and larger "busbars" is screen-printed
onto the front surface using a silver paste. The rear contact is also formed by screen-printing a metal
paste, typically aluminum. Usually this contact covers the entire rear side of the cell, though in some
cell designs it is printed in a grid pattern. The metal electrodes will then require some kind of heat
treatment or "sintering" to make Ohmic contact with the silicon. After the metal contacts are
made, the solar cells are interconnected in series (and/or parallel) by flat wires or metal ribbons, and
assembled into modules or "solar panels".
Solar panels have a sheet of tempered glass on the front, and a polymer encapsulation on the back.
Some solar cells have textured front surfaces that, like antireflection coatings, serve to increase the
amount of light coupled into the cell. Such surfaces can usually only be formed on single-crystal
silicon, though in recent years methods of forming them on multicrystalline silicon have been
developed
These are also known as solar cells and their assembly is termed as solar panel, let us see the
individual discrete component of solar cell which is shown in below Fig
Microcontroller Based Solar Charger
33
Electronics and Communication Engineering Department SNGIST
Figure 7: STRUTUREOF SOLAR CELL
PV cells were invented in 1953 by Charles Fariett. A PV cell is used for converting photon into
electron and with sun light incident, electrical energy is generated. The solar-based battery may be
used to directly feed electricity to electronic equipment or for domestic heating. Solar batteries can
also be used for satellites, communication equipment and domestic appliances.
A selenium-or silicon-based solar cell exhibits open-circuit voltage of only 0.5V and short-circuit cell
current of the order of 1milliampere for 6.4cm² area of the cell at6458 meter candles. Therefore a
large number of such silicon or selenium solar cells need to be connected in series and parallel to
provide any significant power. A telemetry system required to operate 24 hours a day requires a
solar panel providing 5 watts at 12 volts used for recharging corresponding storage batteries during
daylight hours.
Figure 8: solar panel
Microcontroller Based Solar Charger
34
Electronics and Communication Engineering Department SNGIST
CHAPTER: 7
RECHARGEABLE BATTERY
A rechargeable battery, storage battery, or accumulator is a type of electrical battery. It comprises one or
more electrochemical cells, and is a type of energy accumulator. It is known as a secondary cell because
its electrochemical reactions are electrically reversible. Rechargeable batteries come in many different
shapes and sizes, ranging from button cells to megawatt systems connected to stabilize an electrical
distribution network. Several different combinations of chemicals are commonly used, including: lead–
acid, nickel cadmium (NiCd),nickel metal hydride (NiMH), lithium ion (Li-ion), and lithium ion
polymer (Li-ion polymer).
Rechargeable batteries have lower total cost of use and environmental impact than disposable batteries.
Some rechargeable battery types are available in the same sizes as disposable types. Rechargeable batteries
have higher initial cost but can be recharged very cheaply and used many times
7.1)Charging and discharging
During charging, the positive active material is oxidized, producing electrons, and the negative material
is reduced, consuming electrons. These electrons constitute the current flow in the external circuit.
The electrolyte may serve as a simple buffer for internal ion flow between the electrodes, as in lithium-
ion and nickel-cadmium cells, or it may be an active participant in the electrochemical reaction, as in lead–
acid cells.
Figure 9:Diagram of the charging of a secondary cell battery.
Microcontroller Based Solar Charger
35
Electronics and Communication Engineering Department SNGIST
The energy used to charge rechargeable batteries usually comes from a battery charger using AC mains
electricity, although some are equipped to use a vehicle's 12-volt DC power outlet. Regardless, to store
energy in a secondary cell, it has to be connected to a DC voltage source. The negative terminal of the cell
has to be connected to the negative terminal of the voltage source and the positive terminal of the voltage
source with the positive terminal of the battery. Further, the voltage output of the source must be higher than
that of the battery, but not much higher: the greater the difference between the power source and the battery's
voltage capacity, the faster the charging process, but also the greater the risk of overcharging and damaging
the battery.
Chargers take from a few minutes to several hours to charge a battery. Slow "dumb" chargers without
voltage- or temperature-sensing capabilities will charge at a low rate, typically taking 14 hours or more to
reach a full charge. Rapid chargers can typically charge cells in two to five hours, depending on the model,
with the fastest taking as little as fifteen minutes. Fast chargers must have multiple ways of detecting when a
cell reaches full charge (change in terminal voltage, temperature, etc.) to stop charging before harmful
overcharging or overheating occurs. The fastest chargers often incorporate cooling fans to keep the cells
from overheating.
Battery charging and discharging rates are often discussed by referencing a "C" rate of current. The C rate is
that which would theoretically fully charge or discharge the battery in one hour. For example, trickle
charging might be performed at C/20 (or a "20 hour" rate), while typical charging and discharging may
occur at C/2 (two hours for full capacity). The available capacity of electrochemical cells varies depending
on the discharge rate.
Figure:10 lead acid battery
Microcontroller Based Solar Charger
36
Electronics and Communication Engineering Department SNGIST
CHAPTER : 8
CIRCUIT DIAGRAM
Figure:CIRCUIT DIAGRAM
Microcontroller Based Solar Charger
37
Electronics and Communication Engineering Department SNGIST
8.1)CIRCUIT DIAGRAM EXPLANATION
Here we are using PIC16F877Aas the major component. Which will control all actions and provide basic
protection based on the program.
The current produced by the solar panel is flowing to the battery through a relay switch RL1. When the
battery is fully charged RL1 will be energised and disconnects the solar panel from battery .The relay switch
RL2 is used to protect the battery from over load. When an overload is occurred, the relay switch RL2 is
energised and it disconnects load from battery.
The relay will be de-energised when the overload reset switch is pressed. The voltage at the battery is
continuously displayed on the LCD using the built-in ADC module in the PIC 16F877A. The voltage is
divided by 3 by using 3 equal value resistors and 1/3 voltage is send to ADC input. The analogue voltage is
converted into digital and it is displayed on LCD after multiplying with 3. The reference voltage for the
ADC conversion is taken from the VDD supply.
The rated current of the power supply is chosen as 3A. At full load, the load voltage will be 9.6V
(full load resistance = V/I = 12V/3A = 4Ohm. Therefore Load voltage = 12 x 4/5 = 9.6V using voltage
divider rule) it is divided by 3 using resistive network and given to ADC channel 2(AN2). The voltage is
continuously measured by the pic. If over load occurs, the voltage at load reduces. It is detected by the pic
and energises relay switch 2 and disconnects load from over current.
Microcontroller Based Solar Charger
38
Electronics and Communication Engineering Department SNGIST
CHAPTER: 9
PROGRAM CODING
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
float b;
float a;
char txt[10];
void main()
trisa=0xff;
Microcontroller Based Solar Charger
39
Electronics and Communication Engineering Department SNGIST
trisc=0xff;
trisd=0x00;
Lcd_Init();
Lcd_Cmd(_LCD_CURSOR_OFF);
delay_ms(200);
ADC_Init();
delay_ms(200);
while(1)
a=.00488*ADC_Read(0)*3;
FloatToStr(a, txt);
strcat(txt,"V");
Lcd_Out(1,2,"SOLAR CHARGER");
Lcd_Out(2,4,txt);
//Lcd_Out(2,6,"v");
delay_ms(300);
if(a>12)
portd.f7=0;
else
portd.f7=1;
b=.0048*ADC_Read(1);
/*Lcd_Out(1,1,"load");
FloatToStr(b, txt);
Microcontroller Based Solar Charger
40
Electronics and Communication Engineering Department SNGIST
Lcd_Out(2,1,txt);
delay_ms(1000);*/
if(b<3)
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,4,"OVER LOAD");
portd.f6=1;
while(portc.f0==1);
portd.f6=0;
else
portd.f6=0;
Microcontroller Based Solar Charger
41
Electronics and Communication Engineering Department SNGIST
CHAPTER : 10
PCB FABRICATION AND SOLDERING
Printed Circuit Board (PCB) is piece of art. The performance of an electronic
circuit depends on the design and layout of the PCB. A PCB mechanically supports and
connects components by conductive pathways, etched from copper sheets laminated on to
insulated substrate. PCB are used to rotate electrical currents and signals through copper tracts
which are firmly bonded to an insulating base.
PCB fabrication involves following steps:
1. Drawing the layout of the PCB in the paper. The track layout of the electronic circuit
should be made in such manner that the paths are in easy routes. It is then transferred to a Mylar
sheet. The sheet is then touched with black ink.
2. The solder side of the Mylar sheet is placed on the shiny side of the five-star sheet and
is placed in a frame. Then it is exposed to sunlight with Mylar sheet facing the sunlight.
3. The exposed five-star sheet is put in hydrogen peroxide solution. Then it is put in hot
ater and shook till unexposed region becomes transparent.
4. This is put in cold water and then the rough side is stuck onto the silk screen. This is
then pressed and dried well.
5. The plastic sheet of the five-star sheet is removed leaving the pattern on the screen.
6. A copper clad sheet is cut to the size and cleaned. This is placed under screen.
7. As it resistant ink if spread on the screen so that a pattern of tracks and a pad is
obtained on a copper clad sheet. It is then dried.
8. The dried sheet is then etched using ferric chloride solution
9. (32Baume) till all the unwanted copper is etched away. Swish the board to keep the each
fluid moving. Lift the PCB and check whether all the unwanted copper is removed. Etching is
done by immersing the marked copper clad in ferric chloride solution. After that the etched
Microcontroller Based Solar Charger
42
Electronics and Communication Engineering Department SNGIST
sheet is dried.The unwanted resist ink is removed using sodium hydroxide solution Holes are
then dried.
PCB PARAMETERS
Copper thickness- 72mil (1mm=39.37mils)
Track width- 60 mil
Clearance - 60 mil
Pad width- 86mil
Pad height - 86 mil
Pad shape- oval
Pad hole size- 25mil
On board- Through
Hole size- .9mm(36mil)
Base - paper phenolic, hylam
PCB Quality- FRC
SOLDERING
Soldering is the process of joining metals by using lower melting point to weld or alloy with
joining surface.
SOLDER:
Solder is the joining material that melts below 427 degree connections between
components.The popularly used solders are alloys of tin(Sn) and lead(Pb) that melts below the
melting point if tin.
Types:
1. Rosin core: - 60/40 Sn/Pb solders are the most common types used for electronics
assembly. These solders are available in various diameters and are most appropriate for small
electronics work(0.02”-0.05|| dia is recommended)
Microcontroller Based Solar Charger
43
Electronics and Communication Engineering Department SNGIST
2. Lead free :- Lead free solders are used as more environmental-friendly substitutes for
leaded solder, but they are typically not as easy to use mainly because of their higher melting
point and poorer wetting properties.
3. Silver:- Silver solders are typically used for low resistance connections but they have
a higher melting point and are expensive than Sn/Pb solders.
4. Acid-core:- acid-core solders should not be used for electronics.They are intended for
plumbing of non-electronics assembly work. The acid-core flux will cause corrosion of circuitry
and can damage components.
5.Other special solders:- various melting point eutectics: these
6.special solders are typically used for non-electronic assembly of difficult to construct
mechanical items that must be assembled in a particular sequence .
FLUX
In order to make the surface accept the solder readily ,the components terminals should be free
oxides and other obstructing films .the lead should be cleaned chemically or by abrasion using
blades or knives. Small amount of lead coating can be done on the portion of the leads using
soldering iron .this process is called thinning. Zinc chloride or ammonium chloride separately or
in combination is mostly used as fluxes. These are available in petroleum jelly as paste flux. The
desirable properties of flux are:-
It should provide a liquid cover over the materials and exclude air gap up to the soldering
temperature. It should dissolve any oxide on the metal surface. It should be easily replaced from
the metal by the molten soldering operation.Residue should be removable after completing
soldering operation.The most common flux used in hand soldering of electronic components is
rosin, a combination of mild organic acids extracted from pine tree.
Microcontroller Based Solar Charger
44
Electronics and Communication Engineering Department SNGIST
SOLDERING IRON
It is a tool used to melt the solder and apply it at the joints in the circuit. it
operates in 230V supply. The iron at the tip gets heated while few minutes. 50W and 25W
soldering irons are commonly used for soldering of electronics circuit.
SOLDERING STEPS
1. Make the layout of the component in the circuit. Plug in the chord of the soldering
irons the main to get heated.
2. Straighten and clean the component leads using a blade or knife.
3. Mount the components on the PCB by bending the leads of the components. Use nose
pliers.
4. Apply flux on the joints and solder the joints. Solder must be in minimum time to
avoid dry soldering and heating up of the components.
5.Wash the residue using water and brush.
6.Solder joints should be inspected when completed to determine if they have been properly
made.
CHARACTERISTICS OF A GOOD SOLDER JOINTS:
A. Shiny surface
B. Good, smooth fillet
CHARACTERISTICS OF A POOR SOLDER JOINTS:
1. Dull or crystallized surface: This is an indicator of a cold solder joint. Cold solder joint
result from moving the component after soldering has been removed, but before the solder has
hardened. Cold solder joints may work at first, but will eventually fail.
2. Air Pocket: Air pocket (voids) result from incomplete wetting of surface, allowing air
to be in contact with the connecting metals. This will cause oxidation of the joints & eventual
Microcontroller Based Solar Charger
45
Electronics and Communication Engineering Department SNGIST
failure. Blow holes can occur due to vaporization of moisture on the surface of the board &
existing through the molten solder. Boards should be clean & dry, prior to soldering. Ethanol
(100%) can be used as a moisture chaser if boards are wet prior to soldering.
3. Dimples: Dimples in the surface do not always indicate a serious problem, but they should be
avoided since they are precursors to voids.
4. Floaters: Black spots-Floating in the soldering fillet should be avoided, because they indicate
contamination & potential for failure as in the case of voids. These black spots usually results
from overheated (burnt) Rosin or other contaminants such as burnt wire insulation. Maintaining
a clean tip will help to avoid these problems.
5.Balls:A solder balls instead of a fillet can occur if the trace was heated but the leads were
not(vice versa).This prevents proper wetting of both surfaces & result in solder being attached to
only one surface(component of trace).
6. Excess solder: Excess solder usage can cover up other potential problems & should be
avoided. It can lead to solder bridges. In addition, spherical solder joints can result from the
application of too much solder
Microcontroller Based Solar Charger
46
Electronics and Communication Engineering Department SNGIST
PCB LAYOUT
Figure: PCB LAYOUT
Microcontroller Based Solar Charger
47
Electronics and Communication Engineering Department SNGIST
CHAPTER : 11
SOFTWARES USED
PROTHEUS
Proteus is a software for microprocessor simulation, schematic capture, and printed circuit board (PCB)
design. It is developed by Labcenter Electronics.The XGameStation Micro Edition was designed using
Labcenter's Proteus schematic entry and PCB layout tools
Proteus PCB design combines the ISIS schematic capture and ARES PCB layout programs to provide a
powerful, integrated and easy to use suite of tools for professional PCB Design.All Proteus PCB design
products include an integrated shape based autorouter and a basic SPICE simulation capability as standard.
More advanced routing modes are included in Proteus PCB Design Level 2 and higher whilst simulation
capabilities can be enhanced by purchasing the Advanced Simulation option and/or micro-controller
simulation capabilities.
System components
ISIS Schematic Capture - a tool for entering designs.
PROSPICE Mixed mode SPICE simulation - industry standard SPICE3F5 simulator combined with a
digital simulator.
ARES PCB Layout - PCB design system with automatic component placer, rip-up and retry auto-router
and interactive design rule checking.
VSM - Virtual System Modelling lets cosimulate embedded software for popular micro-controllers
alongside hardware design.
System Benefits Integrated package with common user interface and fully context sensitive help.
Microcontroller Based Solar Charger
48
Electronics and Communication Engineering Department SNGIST
Figure: PROTEUS INTERFACE WINDOW
MIKRO C
MikroC is a full-featured ANSI C compiler that is available for six different microcontroller architectures (in
this case, for PIC 12/16/18). It features an intuitive IDE, a powerful compiler with advanced SSA
optimizations, lots of hardware and software libraries, and additional tools that will help you in your work.
The compiler comes with a comprehensive Help file (700 pages) and lots of ready-to-use examples designed
to get you started in no time.
Each compiler license includes free upgrades and tech support for the lifetime of the product. The software
features a Live Update service so you can get new features and improvements instantly.
The mikroC PRO for PIC compiler supports 504 PIC microcontrollers. Newly released PIC microcontrollers
will be supported by new versions of the compiler software that is updated regularly.
Microcontroller Based Solar Charger
49
Electronics and Communication Engineering Department SNGIST
The compiler is designed to be smart and efficient, so you can rely on it to do the hard work. It features four
levels of optimizations that can reduce your code size up to 20 percent. Standard header files are included
that make it easy to port your code from other C compilers.
MikroC PRO for PIC C Compiler Features
Single-click Debugging
mikroC PRO for PIC has native support for the mikroICD In-Circuit Debugger feature of the fast USB
2.0 mikroProg-PIC programmer (in both on-board and standalone versions). mikroICD is a separate DLL
module which supports Step-over, Step-Into, Step-Out, Run, and Run-to-Cursor debugging operations. Also,
the debugger supports standard and advanced breakpoints.
Faster, better, more productive
mikroC PRO for PIC comes equipped with fully functional software tools that can boost your efficiency and
do the job for you, so you can be more productive in your work: LCD Custom Character Tool, GLCD
Bitmap Editor, Seven-Segment Editor, UART Terminal, UDP Terminal, HID Terminal, ASCII Chart,
Active Comments Editor, Advanced Statistics and more.
28/40/44-Pin Enhanced FlashMicrocontrollers
APPENDICES
PIC16F87XAData Sheet
1)
50
www.nitropdf.com
Microcontroller Based Solar Charger
PIC16F87XA28/40/44-Pin Enhanced Flash Microcontrollers
Devices Included in this Data Sheet: Analog Features:• PIC16F873A• PIC16F874A
• PIC16F876A• PIC16F877A
• 10-bit, up to 8-channel Analog-to-DigitalConverter (A/D)
• Brown-out Reset (BOR)
High-Performance RISC CPU:• Only 35 single-word instructions to learn• All single-cycle instructions except for program
branches, which are two-cycle• Operating speed: DC – 20 MHz clock input
DC – 200 ns instruction cycle• Up to 8K x 14 words of Flash Program Memory,
Up to 368 x 8 bytes of Data Memory (RAM),Up to 256 x 8 bytes of EEPROM Data Memory
• Pinout compatible to other 28-pin or 40/44-pinPIC16CXXX and PIC16FXXX microcontrollers
Peripheral Features:• Timer0: 8-bit timer/counter with 8-bit prescaler• Timer1: 16-bit timer/counter with prescaler,
can be incremented during Sleep via externalcrystal/clock
• Timer2: 8-bit timer/counter with 8-bit periodregister, prescaler and postscaler
• Two Capture, Compare, PWM modules- Capture is 16-bit, max. resolution is 12.5 ns- Compare is 16-bit, max. resolution is 200 ns- PWM max. resolution is 10-bit
• Synchronous Serial Port (SSP) with SPI™(Master mode) and I2C™ (Master/Slave)
• Universal Synchronous Asynchronous ReceiverTransmitter (USART/SCI) with 9-bit addressdetection
• Parallel Slave Port (PSP) – 8 bits wide withexternal RD, WR and CS controls (40/44-pin only)
• Brown-out detection circuitry forBrown-out Reset (BOR)
• Analog Comparator module with:- Two analog comparators- Programmable on-chip voltage reference
(VREF) module- Programmable input multiplexing from device
inputs and internal voltage reference- Comparator outputs are externally accessible
Special Microcontroller Features:• 100,000 erase/write cycle Enhanced Flash
program memory typical• 1,000,000 erase/write cycle Data EEPROM
memory typical• Data EEPROM Retention > 40 years• Self-reprogrammable under software control• In-Circuit Serial Programming™ (ICSP™)
via two pins• Single-supply 5V In-Circuit Serial Programming• Watchdog Timer (WDT) with its own on-chip RC
oscillator for reliable operation• Programmable code protection• Power saving Sleep mode• Selectable oscillator options• In-Circuit Debug (ICD) via two pins
CMOS Technology:• Low-power, high-speed Flash/EEPROM
technology• Fully static design• Wide operating voltage range (2.0V to 5.5V)• Commercial and Industrial temperature ranges• Low-power consumption
DeviceProgram Memory Data
SRAM(Bytes)
EEPROM(Bytes) I/O 10-bit
A/D (ch)CCP
(PWM)
MSSPUSART Timers
8/16-bit ComparatorsBytes # Single Word
Instructions SPI MasterI2C
PIC16F873A 7.2K 4096 192 128 22 5 2 Yes Yes Yes 2/1 2PIC16F874A 7.2K 4096 192 128 33 8 2 Yes Yes Yes 2/1 2PIC16F876A 14.3K 8192 368 256 22 5 2 Yes Yes Yes 2/1 2PIC16F877A 14.3K 8192 368 256 33 8 2 Yes Yes Yes 2/1 2
51
www.nitropdf.com
Microcontroller Based Solar Charger
lUllIllll1 -..... ~.... ~----- -p •- -- ~-- .......- .....11I1111ll~
....... -....... ._
....... ............. -- ~- ....
PIC16F87XA
PIC
16F8
73A
/876
A
1 282 273 264 255 246 237 228 219 20
10 1911 1812 1713 1614 15
RA1
/AN
1R
A0/A
N0
MC
LR/V
PPR
B7/P
GD
RB6
/PG
CR
B5
RB
4
28 27 26 25 24 23 22
RC
0/T1
OSO
/T1C
KIR
C1/
T1O
SI/C
CP2
RC
2/C
CP1
RC
3/SC
K/SC
LR
C4/
SDI/S
DA
RC
5/SD
OR
C6/
TX/C
K
8 9 10 11 12 13 14
RC
6/TX
/CK
RC
5/SD
OR
C4/
SDI/S
DA
RD
3/PS
P3R
D2/
PSP2
RD
1/PS
P1R
D0/
PSP0
RC
3/SC
K/SC
LR
C2/
CC
P1R
C1/
T1O
SI/C
CP2
RC
0/T1
OSO
/T1C
KI
RC7/RX/DT 1 33 OSC2/CLKORD4/PSP4 2 32 OSC1/CLKIRD5/PSP5 3 31 VSSRD6/PSP6RD7/PSP7
45
30 VSSVDD
VSS 6 28 VDDVDD 7 PIC16F877A 27 RE2/CS/AN7VDD 8 26 RE1/WR/AN6
RB0/INT 9 25 RE0/RD/AN5RB1 10 24 RA5/AN4/SS/C2OUTRB2 11 23 RA4/T0CKI/C1OUT
RB3
/PG
M NC
RB4
RB5
RB6
/PG
CR
B7/P
GD
MC
LR/V
PPR
A0/A
N0
RA1
/AN
1R
A2/A
N2/
VREF
-/CVR
EFR
A3/A
N3/
VREF
+
12 13 14 15 16 17 18 19 20 21 22
44 43 42 41 40 39 38 37 36 35 34
Pin Diagrams
28-Pin PDIP, SOIC, SSOP
MCLR/VPPRA0/AN0RA1/AN1
RA2/AN2/VREF-/CVREF
RA3/AN3/VREF+RA4/T0CKI/C1OUT
RA5/AN4/SS/C2OUTVSS
OSC1/CLKIOSC2/CLKO
RC0/T1OSO/T1CKIRC1/T1OSI/CCP2
RC2/CCP1RC3/SCK/SCL
RB7/PGDRB6/PGCRB5RB4RB3/PGMRB2RB1RB0/INTVDD
VSSRC7/RX/DTRC6/TX/CKRC5/SDORC4/SDI/SDA
28-Pin QFN
RA2/AN2/VREF-/CVREF 1 21 RB3/PGMRA3/AN3/VREF+
RA4/T0CKI/C1OUTRA5/AN4/SS/C2OUT
VSSOSC1/CLKI
OSC2/CLKO
2 203 PIC16F873A 194 185 PIC16F876A 176 167 15
RB2RB1RB0/INTVDD
VSS
RC7/RX/DT
44-Pin QFN
PIC16F874A 29
52
www.nitropdf.com
Microcontroller Based Solar Charger
'.,_----
-
PIC16F87XA
PIC
16F8
74A
/877
A
RC
6/TX
/CK
RC
5/SD
OR
C4/
SDI/S
DA
RD
3/P
SP3
RD
2/P
SP2
RD
1/P
SP1
RD
0/P
SP0
RC
3/S
CK
/SC
LR
C2/
CC
P1R
C1/
T1O
SI/C
CP2
NC
RA3
/AN
3/VR
EF+
RA2
/AN
2/VR
EF-/C
VREF
RA1
/AN
1R
A0/A
N0
MC
LR/V
PPN
CR
B7/P
GD
RB6
/PG
CR
B5
RB
4N
C
6 5 4 3 2 1 44 43 42 41 40
13 33R
C1/
T1O
SI/C
CP2
RC
2/C
CP1
RC
3/SC
K/SC
LR
D0/
PSP0
RD
1/PS
P1R
D2/
PSP2
RD
3/PS
P3R
C4/
SDI/S
DA
RC
5/SD
OR
C6/
TX/C
KN
C
18 19 20 21 22 23 24 25 26 27 28
44 43 42 41 40 39 38 37 36 35 34
NC
NC
RB4
RB5
RB6
/PG
CR
B7/P
GD
MC
LR/V
PPR
A0/A
N0
RA1
/AN
1R
A2/A
N2/
VREF
-/CVR
EFR
A3/A
N3/
VREF
+
12 13 14 15 16 17 18 19 20 21 22
Pin Diagrams (Continued)
40-Pin PDIP
MCLR/VPP 1 40 RB7/PGDRA0/AN0 2 39 RB6/PGCRA1/AN1 3 38 RB5
RA2/AN2/VREF-/CVREF 4 37 RB4RA3/AN3/VREF+ 5 36 RB3/PGM
RA4/T0CKI/C1OUT 6 35 RB2RA5/AN4/SS/C2OUT 7 34 RB1
RE0/RD/AN5 8 33 RB0/INTRE1/WR/AN6 9 32 VDD
RE2/CS/AN7 10 31 VSSVDD 11 30 RD7/PSP7VSS 12 29 RD6/PSP6
OSC1/CLKI 13 28 RD5/PSP5OSC2/CLKO 14 27 RD4/PSP4
RC0/T1OSO/T1CKI 15 26 RC7/RX/DTRC1/T1OSI/CCP2 16 25 RC6/TX/CK
RC2/CCP1 17 24 RC5/SDORC3/SCK/SCL 18 23 RC4/SDI/SDA
RD0/PSP0 19 22 RD3/PSP3RD1/PSP1 20 21 RD2/PSP2
44-Pin PLCC
RA4/T0CKI/C1OUTRA5/AN4/SS/C2OUT
RE0/RD/AN5RE1/WR/AN6RE2/CS/AN7
VDDVSS
OSC1/CLKIOSC2/CLKO
RC0/T1OSO/T1CK1NC
7 398 389 3710 3611 PIC16F874A 3512 PIC16F877A 34
14 3215 3116 3017 29
RB3/PGMRB2RB1RB0/INTVDDVSSRD7/PSP7RD6/PSP6RD5/PSP5RD4/PSP4RC7/RX/DT
44-Pin TQFP
RC7/RX/DT 1 33 NCRD4/PSP4 2 32 RC0/T1OSO/T1CKIRD5/PSP5 3 31 OSC2/CLKORD6/PSP6 4 30 OSC1/CLKIRD7/PSP7
VSS56
PIC16F874A 2928
VSSVDD
VDD 7 PIC16F877A 27 RE2/CS/AN7RB0/INT 8 26 RE1/WR/AN6
RB1 9 25 RE0/RD/AN5RB2 10 24 RA5/AN4/SS/C2OUT
RB3/PGM 11 23 RA4/T0CKI/C1OUT
53
www.nitropdf.com
Microcontroller Based Solar Charger
~-x-x-x-x
PIC16F87XA
FlashProgramMemory
14
Power-upTimer
OscillatorStart-up Timer
Power-onReset
WatchdogTimer
Brown-outReset
In-CircuitDebugger
Low-VoltageProgramming
8Indirec
Addr
FSR reg
FIGURE 1-2: PIC16F874A/877A BLOCK DIAGRAM13 Data Bus 8
Program CounterPORTA
RA0/AN0RA1/AN1RA2/AN2/VREF-/CVREF
ProgramBus
Instruction reg
8
8 Level Stack(13-bit)
Direct Addr 7
RAMFile
Registers
RAM Addr(1) 9
Addr MUX
t
Status reg
PORTB
PORTC
RA3/AN3/VREF+RA4/T0CKI/C1OUTRA5/AN4/SS/C2OUT
RB0/INTRB1RB2RB3/PGMRB4RB5RB6/PGCRB7/PGD
RC0/T1OSO/T1CKI
OSC1/CLKIOSC2/CLKO
InstructionDecode &
Control
TimingGeneration
3
ALU
8
W reg
MUX
PORTD
PORTE
RC1/T1OSI/CCP2RC2/CCP1RC3/SCK/SCLRC4/SDI/SDARC5/SDORC6/TX/CKRC7/RX/DT
RD0/PSP0RD1/PSP1RD2/PSP2RD3/PSP3RD4/PSP4RD5/PSP5RD6/PSP6RD7/PSP7
MCLR VDD, VSS RE0/RD/AN5
RE1/WR/AN6
RE2/CS/AN7
Timer0 Timer1 Timer2 10-bit A/D ParallelSlave Port
Data EEPROM SynchronousCCP1,2 Serial Port USART
VoltageComparator Reference
Device Program Flash Data Memory Data EEPROM
PIC16F874A 4K words 192 Bytes 128 BytesPIC16F877A 8K words 368 Bytes 256 Bytes
Note 1: Higher order bits are from the Status register.
54
www.nitropdf.com
Microcontroller Based Solar Charger
PIC16F87XA
Pin Name PDIPPin#
PLCCPin#
TQFPPin#
QFNPin#
I/O/PType
BufferType Description
OSC1/CLKIOSC1
CLKI
13 14 30 32I
I
ST/CMOS(4) Oscillator crystal or external clock input.Oscillator crystal input or external clock sourceinput. ST buffer when configured in RC mode;otherwise CMOS.External clock source input. Always associatedwith pin function OSC1 (see OSC1/CLKI,OSC2/CLKO pins).
OSC2/CLKOOSC2
CLKO
14 15 31 33O
O
— Oscillator crystal or clock output.Oscillator crystal output.Connects to crystal or resonator in CrystalOscillator mode.In RC mode, OSC2 pin outputs CLKO, whichhas 1/4 the frequency of OSC1 and denotes theinstruction cycle rate.
MCLR/VPPMCLR
VPP
1 2 18 18I
P
ST Master Clear (input) or programming voltage (output).Master Clear (Reset) input. This pin is an activelow Reset to the device.Programming voltage input.
RA0/AN0RA0AN0
RA1/AN1RA1AN1
RA2/AN2/VREF-/CVREFRA2AN2VREF-CVREF
RA3/AN3/VREF+RA3AN3VREF+
RA4/T0CKI/C1OUTRA4
T0CKIC1OUT
RA5/AN4/SS/C2OUTRA5AN4SSC2OUT
2
3
4
5
6
7
3
4
5
6
7
8
19
20
21
22
23
24
19
20
21
22
23
24
I/OI
I/OI
I/OIIO
I/OII
I/O
IO
I/OIIO
TTL
TTL
TTL
TTL
ST
TTL
PORTA is a bidirectional I/O port.
Digital I/O.Analog input 0.
Digital I/O.Analog input 1.
Digital I/O.Analog input 2.A/D reference voltage (Low) input.Comparator VREF output.
Digital I/O.Analog input 3.A/D reference voltage (High) input.
Digital I/O – Open-drain when configured asoutput.Timer0 external clock input.Comparator 1 output.
Digital I/O.Analog input 4.SPI slave select input.Comparator 2 output.
TABLE 1-3: PIC16F874A/877A PINOUT DESCRIPTION
Legend: I = input O = output I/O = input/output P = power— = Not used TTL = TTL input ST = Schmitt Trigger input
Note 1: This buffer is a Schmitt Trigger input when configured as the external interrupt.2: This buffer is a Schmitt Trigger input when used in Serial Programming mode.3: This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
55
www.nitropdf.com
Microcontroller Based Solar Charger
PIC16F87XA
Pin Name PDIPPin#
PLCCPin#
TQFPPin#
QFNPin#
I/O/PType
BufferType Description
RB0/INTRB0INT
RB1RB2RB3/PGM
RB3PGM
RB4RB5RB6/PGC
RB6PGC
RB7/PGDRB7PGD
33
343536
373839
40
36
373839
414243
44
8
91011
141516
17
9
101112
141516
17
I/OI
I/OI/O
I/OI
I/OI/O
I/OI
I/OI/O
TTL/ST(1)
TTLTTLTTL
TTL TTLTTL/ST(2)
TTL/ST(2)
PORTB is a bidirectional I/O port. PORTB can besoftware programmed for internal weak pull-up on allinputs.
Digital I/O.External interrupt.Digital I/O.Digital I/O.
Digital I/O.Low-voltage ICSP programming enable pin.Digital I/O.Digital I/O.
Digital I/O.In-circuit debugger and ICSP programming clock.
Digital I/O.In-circuit debugger and ICSP programming data.
TABLE 1-3: PIC16F874A/877A PINOUT DESCRIPTION (CONTINUED)
Legend: I = input O = output I/O = input/output P = power— = Not used TTL = TTL input ST = Schmitt Trigger input
Note 1: This buffer is a Schmitt Trigger input when configured as the external interrupt.2: This buffer is a Schmitt Trigger input when used in Serial Programming mode.3: This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
56
www.nitropdf.com
Microcontroller Based Solar Charger
PIC16F87XA
Pin Name PDIPPin#
PLCCPin#
TQFPPin#
QFNPin#
I/O/PType
BufferType Description
RC0/T1OSO/T1CKIRC0T1OSOT1CKI
RC1/T1OSI/CCP2RC1T1OSICCP2
RC2/CCP1RC2CCP1
RC3/SCK/SCLRC3SCK
SCL
RC4/SDI/SDARC4SDISDA
RC5/SDORC5SDO
RC6/TX/CKRC6TXCK
RC7/RX/DTRC7RXDT
15
16
17
18
23
24
25
26
16
18
19
20
25
26
27
29
32
35
36
37
42
43
44
1
34
35
36
37
42
43
44
1
I/OOI
I/OI
I/O
I/OI/O
I/OI/O
I/O
I/OI
I/O
I/OO
I/OO
I/O
I/OI
I/O
ST
ST
ST
ST
ST
ST
ST
ST
PORTC is a bidirectional I/O port.
Digital I/O.Timer1 oscillator output.Timer1 external clock input.
Digital I/O.Timer1 oscillator input.Capture2 input, Compare2 output, PWM2 output.
Digital I/O.Capture1 input, Compare1 output, PWM1 output.
Digital I/O.Synchronous serial clock input/output for SPImode.Synchronous serial clock input/output for I2Cmode.
Digital I/O.SPI data in.I2C data I/O.
Digital I/O.SPI data out.
Digital I/O.USART asynchronous transmit.USART1 synchronous clock.
Digital I/O.USART asynchronous receive.USART synchronous data.
TABLE 1-3: PIC16F874A/877A PINOUT DESCRIPTION (CONTINUED)
Legend: I = input O = output I/O = input/output P = power— = Not used TTL = TTL input ST = Schmitt Trigger input
Note 1: This buffer is a Schmitt Trigger input when configured as the external interrupt.2: This buffer is a Schmitt Trigger input when used in Serial Programming mode.3: This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
57
www.nitropdf.com
Microcontroller Based Solar Charger
PIC16F87XA
Pin Name PDIPPin#
PLCCPin#
TQFPPin#
QFNPin#
I/O/PType
BufferType Description
RD0/PSP0RD0PSP0
RD1/PSP1RD1PSP1
RD2/PSP2RD2PSP2
RD3/PSP3RD3PSP3
RD4/PSP4RD4PSP4
RD5/PSP5RD5PSP5
RD6/PSP6RD6PSP6
RD7/PSP7RD7PSP7
19
20
21
22
27
28
29
30
21
22
23
24
30
31
32
33
38
39
40
41
2
3
4
5
38
39
40
41
2
3
4
5
I/OI/O
I/OI/O
I/OI/O
I/OI/O
I/OI/O
I/OI/O
I/OI/O
I/OI/O
ST/TTL(3)
ST/TTL(3)
ST/TTL(3)
ST/TTL(3)
ST/TTL(3)
ST/TTL(3)
ST/TTL(3)
ST/TTL(3)
PORTD is a bidirectional I/O port or Parallel SlavePort when interfacing to a microprocessor bus.
Digital I/O.Parallel Slave Port data.
Digital I/O.Parallel Slave Port data.
Digital I/O.Parallel Slave Port data.
Digital I/O.Parallel Slave Port data.
Digital I/O.Parallel Slave Port data.
Digital I/O.Parallel Slave Port data.
Digital I/O.Parallel Slave Port data.
Digital I/O.Parallel Slave Port data.
RE0/RD/AN5RE0RDAN5
RE1/WR/AN6RE1WRAN6
RE2/CS/AN7RE2CSAN7
8
9
10
9
10
11
25
26
27
25
26
27
I/OII
I/OII
I/OII
ST/TTL(3)
ST/TTL(3)
ST/TTL(3)
PORTE is a bidirectional I/O port.
Digital I/O.Read control for Parallel Slave Port.Analog input 5.
Digital I/O.Write control for Parallel Slave Port.Analog input 6.
Digital I/O.Chip select control for Parallel Slave Port.Analog input 7.
VSS 12, 31 13, 34 6, 29 6, 30,31
P — Ground reference for logic and I/O pins.
VDD 11, 32 12, 35 7, 28 7, 8,28, 29
P — Positive supply for logic and I/O pins.
NC — 1, 17,28, 40
12,13,33, 34
13 — — These pins are not internally connected. These pinsshould be left unconnected.
TABLE 1-3: PIC16F874A/877A PINOUT DESCRIPTION (CONTINUED)
Legend: I = input O = output I/O = input/output P = power— = Not used TTL = TTL input ST = Schmitt Trigger input
Note 1: This buffer is a Schmitt Trigger input when configured as the external interrupt.2: This buffer is a Schmitt Trigger input when used in Serial Programming mode.3: This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
58
www.nitropdf.com
Microcontroller Based Solar Charger
•••
PIC16F87XA
Stack Level 1
Stack Level 2
Stack Level 8
Reset Vector
Interrupt Vector
Page 0
Page 1
Reset Vector
Interrupt Vector
Page 0
Page 1
Page 2
Page 3
2.0 MEMORY ORGANIZATIONThere are three memory blocks in each of thePIC16F87XA devices. The program memory and datamemory have separate buses so that concurrentaccess can occur and is detailed in this section. TheEEPROM data memory block is detailed in Section 3.0“Data EEPROM and Flash Program Memory”.Additional information on device memory may be foundin the PICmicro® Mid-Range MCU Family ReferenceManual (DS33023).
FIGURE 2-1: PIC16F876A/877APROGRAM MEMORY MAPAND STACK
2.1 Program Memory OrganizationThe PIC16F87XA devices have a 13-bit programcounter capable of addressing an 8K word x 14 bitprogram memory space. The PIC16F876A/877Adevices have 8K words x 14 bits of Flash programmemory, while PIC16F873A/874A devices have4K words x 14 bits. Accessing a location above thephysically implemented address will cause awraparound.The Reset vector is at 0000h and the interrupt vector isat 0004h.
FIGURE 2-2: PIC16F873A/874APROGRAM MEMORY MAPAND STACK
CALL, RETURNRETFIE, RETLW
PC<12:0>
13 CALL, RETURNRETFIE, RETLW
PC<12:0>
13
Stack Level 1
Stack Level 2
Stack Level 8
0000h 0000h
On-ChipProgramMemory
0004h
0005h
07FFh
0800h
0FFFh
1000h
17FFh1800h
1FFFh
On-ChipProgramMemory
0004h
0005h
07FFh
0800h
0FFFh
1000h
1FFFh
59
www.nitropdf.com
Microcontroller Based Solar Charger
PIC16F87XA
RP1:RP0 Bank
00 001 110 211 3
2.2 Data Memory OrganizationThe data memory is partitioned into multiple bankswhich contain the General Purpose Registers and theSpecial Function Registers. Bits RP1 (Status<6>) andRP0 (Status<5>) are the bank select bits.
Each bank extends up to 7Fh (128 bytes). The lowerlocations of each bank are reserved for the SpecialFunction Registers. Above the Special Function Regis-ters are General Purpose Registers, implemented asstatic RAM. All implemented banks contain SpecialFunction Registers. Some frequently used SpecialFunction Registers from one bank may be mirrored inanother bank for code reduction and quicker access.
Note: The EEPROM data memory description canbe found in Section 3.0 “Data EEPROMand Flash Program Memory” of this datasheet.
2.2.1 GENERAL PURPOSE REGISTERFILE
The register file can be accessed either directly, orindirectly, through the File Select Register (FSR).
60
www.nitropdf.com
Microcontroller Based Solar Charger
PIC16F87XA
Address
00h
Address
80h
Address
100h
Address
180h01h02h03h04h05h06h07h08h09h0Ah0Bh0Ch0Dh0Eh0Fh10h11h12h13h14h15h16h17h18h19h1Ah1Bh1Ch1Dh1Eh1Fh
81h82h83h84h85h86h87h88h89h8Ah8Bh8Ch8Dh8Eh8Fh90h91h92h93h94h95h96h97h98h99h9Ah9Bh9Ch9Dh9Eh9Fh
101h102h103h104h105h106h107h108h109h10Ah10Bh10Ch10Dh10Eh10Fh110h111h112h113h114h115h116h117h118h119h11Ah11Bh11Ch11Dh11Eh11Fh
181h182h183h184h185h186h187h188h189h18Ah18Bh18Ch18Dh18Eh18Fh190h191h192h193h194h195h196h197h198h199h19Ah19Bh19Ch19Dh19Eh19Fh
20h A0h 120h 1A0h
Indirect addr.(*)
OPTION_REGPCL
STATUSFSR
TRISB
PCLATHINTCON
EECON1EECON2
Reserved(2)
Reserved(2)
GeneralPurposeRegister16 Bytes
GeneralPurposeRegister80 Bytes
accesses70h - 7Fh
Indirect addr.(*)
TMR0PCL
STATUSFSR
PORTAPORTBPORTC
PORTD(1)
PORTE(1)
PCLATHINTCON
PIR1PIR2
TMR1LTMR1HT1CONTMR2
T2CONSSPBUFSSPCONCCPR1LCCPR1H
CCP1CONRCSTATXREGRCREGCCPR2LCCPR2H
CCP2CONADRESHADCON0
GeneralPurposeRegister
96 Bytes
Indirect addr.(*)
OPTION_REGPCL
STATUSFSR
TRISATRISBTRISC
TRISD(1)
TRISE(1)
PCLATHINTCON
PIE1PIE2
PCON
SSPCON2PR2
SSPADDSSPSTAT
TXSTASPBRG
CMCONCVRCONADRESLADCON1
GeneralPurposeRegister80 Bytes
accesses70h-7Fh
Indirect addr.(*)
TMR0PCL
STATUSFSR
PORTB
PCLATHINTCONEEDATAEEADREEDATHEEADRH
GeneralPurposeRegister16 Bytes
GeneralPurposeRegister80 Bytes
accesses70h-7Fh
FIGURE 2-3: PIC16F876A/877A REGISTER FILE MAP
File File File File
EFhF0h
16Fh170h
1EFh1F0h
7Fh FFhBank 0 Bank 1
17Fh 1FFhBank 2 Bank 3
Unimplemented data memory locations, read as ‘0’.* Not a physical register.
Note 1: These registers are not implemented on the PIC16F876A.2: These registers are reserved; maintain these registers clear.
61
www.nitropdf.com
Microcontroller Based Solar Charger
2
D
PUTPUT SERIES OUT
1 IPASS
1 ELEMENT .3
CURRENT SOA A :-GENERATOR PROTECTION ..I
1STARTING REFERENCE ERRORCIRCUIT t--- VOLTAGE t-P- AMPLIFIER
THERMAL f---- :PROTECTION
1 GN-...
IN
©2001 Fairchild Semiconductor Corporation
www.fairchildsemi.com
Rev. 1.0.1
Features• Output Current up to 1A • Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V • Thermal Overload Protection • Short Circuit Protection• Output Transistor Safe Operating Area Protection
DescriptionThe MC78XX/LM78XX/MC78XXA series of three terminal positive regulators are available in the TO-220/D-PAK package and with several fixed output voltages, making them useful in a wide range of applications. Each type employs internal current limiting,thermal shut down and safe operating area protection, making it essentially indestructible. If adequate heat sinkingis provided, they can deliver over 1A output current.Although designed primarily as fixed voltage regulators,these devices can be used with external components toobtain adjustable voltages and currents.
TO-220
D-PAK
1. Input 2. GND 3. Output
1
1
Internal Block Digram
MC78XX/LM78XX/MC78XXA3-Terminal 1A Positive Voltage Regulator
2)62
www.nitropdf.com
Microcontroller Based Solar Charger
MC78XX/LM78XX/MC78XXA
2
Absolute Maximum Ratings
Electrical Characteristics (MC7805/LM7805)(Refer to test circuit ,0°C < TJ < 125°C, IO = 500mA, VI = 10V, CI= 0.33µF, CO= 0.1µF, unless otherwise specified)
Note:1. Load and line regulation are specified at constant junction temperature. Changes in Vo due to heating effects must be taken
into account separately. Pulse testing with low duty is used.
Parameter Symbol Value UnitInput Voltage (for VO = 5V to 18V)(for VO = 24V)
VIVI
3540
VV
Thermal Resistance Junction-Cases (TO-220) RθJC 5 oC/WThermal Resistance Junction-Air (TO-220) RθJA 65 oC/WOperating Temperature Range TOPR 0 ~ +125 oCStorage Temperature Range TSTG -65 ~ +150 oC
Parameter Symbol ConditionsMC7805/LM7805
UnitMin. Typ. Max.
Output Voltage VOTJ =+25 oC 4.8 5.0 5.25.0mA ≤ Io ≤ 1.0A, PO ≤ 15WVI = 7V to 20V 4.75 5.0 5.25 V
Line Regulation (Note1) Regline TJ=+25 oCVO = 7V to 25V - 4.0 100
mVVI = 8V to 12V - 1.6 50
Load Regulation (Note1) Regload TJ=+25 oCIO = 5.0mA to1.5A - 9 100
mVIO =250mA to 750mA - 4 50
Quiescent Current IQ TJ =+25 oC - 5.0 8.0 mA
Quiescent Current Change ∆IQIO = 5mA to 1.0A - 0.03 0.5
mAVI= 7V to 25V - 0.3 1.3
Output Voltage Drift ∆VO/∆T IO= 5mA - -0.8 - mV/ oCOutput Noise Voltage VN f = 10Hz to 100KHz, TA=+25 oC - 42 - µV/Vo
Ripple Rejection RR f = 120HzVO = 8V to 18V 62 73 - dB
Dropout Voltage VDrop IO = 1A, TJ =+25 oC - 2 - VOutput Resistance rO f = 1KHz - 15 - mΩShort Circuit Current ISC VI = 35V, TA =+25 oC - 230 - mAPeak Current IPK TJ =+25 oC - 2.2 - A
63
www.nitropdf.com
Microcontroller Based Solar Charger
Co
KA78XX
Vo
C,
V,O-----r----1
V,5.10 1 3,... ...... KA78XX1 i~ RL
-r-O.33~F 2
"-470~F m+.
120Hz
~~~----------~Vo
v«
V, o---~---t KA78XX
V,1 3- KA78XX -
2
::=CI Co :~O.33~F O.l~F
(,7
MC78XX/LM78XX/MC78XXA
21
Typical Applications
Figure 5. DC Parameters
Figure 6. Load Regulation
Figure 7. Ripple Rejection
Figure 8. Fixed Output Regulator
Input OutputMC78XX/LM78XX
Input OutputMC78XX/LM78XX
Input OutputMC78XX/LM78XX
Input OutputMC78XX/LM78XX
64
www.nitropdf.com
Microcontroller Based Solar Charger
V,
V, KA78XXVO
2R1
1!Q
R2
10 = VXX +R1 10
KA78XXV, v;
1012Al Vxx
ll'o
MC78XX/LM78XX/MC78XXA
22
Figure 9. Constant Current Regulator
Notes:(1) To specify an output voltage. substitute voltage value for "XX." A common ground is required between the input and the
Output voltage. The input voltage must remain typically 2.0V above the output voltage even during the low point on the inputripple voltage.
(2) CI is required if regulator is located an appreciable distance from power Supply filter.(3) CO improves stability and transient response.
VO = VXX(1+R2/R1)+IQR2Figure 10. Circuit for Increasing Output Voltage
IRI ≥5 IQVO = VXX(1+R2/R1)+IQR2
Figure 11. Adjustable Output Regulator (7 to 30V)
Input OutputMC78XX/LM78XX
CI
Co
Input OutputMC78XX/LM78XX
CICo
IRI 5IQ≥
Input OutputMC7805LM7805
LM741Co
CI
65
www.nitropdf.com
Microcontroller Based Solar Charger
MC78XX/LM78XX/MC78XXA
25
Mechanical DimensionsPackage
4.50 ±0.209.90 ±0.20
1.52 ±0.10
0.80 ±0.102.40 ±0.20
10.00 ±0.20
1.27 ±0.10
ø3.60 ±0.10
(8.70)
2.80
±0.
1015
.90
±0.2
0
10.0
8 ±0
.30
18.9
5MA
X.
(1.7
0)
(3.7
0)(3
.00)
(1.4
6)
(1.0
0)
(45°)
9.20
±0.
2013
.08
±0.2
0
1.30
±0.
10
1.30+0.10–0.05
0.50+0.10–0.05
2.54TYP[2.54 ±0.20]
2.54TYP[2.54 ±0.20]
TO-220
66
www.nitropdf.com
Microcontroller Based Solar Charger
MC78XX/LM78XX/MC78XXA
Mechancal Dimensions (Continued)
Package
6.60 ±0.20
2.30 ±0.10
0.50 ±0.10
5.34 ±0.30
0.70
±0.
20
0.60
±0.
200.
80 ±
0.20
9.50
±0.
30
6.10
±0.
20
2.70
±0.
209.
50 ±
0.30
6.10
±0.
20
2.70
±0.
20
MIN
0.55
0.76 ±0.10 0.50 ±0.10
1.02 ±0.20
2.30 ±0.20
6.60 ±0.20
0.76 ±0.10
(5.34)
(1.50)
(2XR0.25)
(5.04)
0.89
±0.
10
(0.1
0)(3
.05)
(1.0
0)
(0.9
0)
(0.7
0)
0.91
±0.
10
2.30TYP[2.30±0.20]
2.30TYP[2.30±0.20]
MAX0.96
(4.34)(0.50) (0.50)
D-PAK
67
www.nitropdf.com
Microcontroller Based Solar Charger
BC107BC108BC109
Semelab plc. Telephone +44(0)1455 556565. Fax +44(0)1455 552612. e-mail [email protected] http://www.semelab.co.uk
3/99
GENERAL PURPOSESMALL SIGNAL
NPN BIPOLAR TRANSISTOR
FEATURES
• SILICON NPN
• HERMETICALLY SEALED TO18
• SCREENING OPTIONS AVAILABLE
VCBO Collector – Base Continuous Voltage BC017
BC108, BC109
VCEO Collector – Emitter Continuous Voltage With Zero Base Current BC107
BC108, BC109
VCES Collector – Emitter Continuous Voltage With Base Shortcircuited to Emitter
BC107
BC108, BC109
VEBO Emitter – Base Continuous Voltage Reverse Voltage BC107
BC108, BC109
IC Continuous Collector Current
ICM Peak Collector Current
Ptot Power Dissipation @ Tamb = 25°C
Tamb Ambient Operating Temperature Range
Tstg Storage Temperature Range
50V
30V
45V
20V
50V
30V
6V
5V
100mA
200mA
300mW
-65 to +175°C
-65 to +175°C
MECHANICAL DATADimensions in mm (inches)
TO–18 METAL PACKAGE
ABSOLUTE MAXIMUM RATINGS (TA = 25°C unless otherwise stated)
PIN 1 – Emitter
Underside View
PIN 2 – Base PIN 3 – Collector
132
2.54 (0.100)Nom.
0.48 (0.019)0.41 (0.016)
dia.
5.84 (0.230)5.31 (0.209)
4.95 (0.195)4.52 (0.178)
5.33
(0.
210)
4.32
(0.
170)
12.7
(0.
500)
min
.
3)68
www.nitropdf.com
Microcontroller Based Solar Charger
Parameter Test Conditions Min. Typ. Max. Unit
BC107BC108BC109
Semelab plc. Telephone +44(0)1455 556565. Fax +44(0)1455 552612. e-mail [email protected] http://www.semelab.co.uk
3/99
VCB = 45V BC107
VCB = 25V BC108, BC109
VCB = 45V BC107
VCB = 25V BC108, BC109
VEB = 4V IC = 0
VCE = 5V IC = 2mA
Group A BC107, BC108
Group B All Types
Group C BC108, BC109
BC107
BC108
BC109
VCE = 5V IC = 2mA
IB = 0.5mA IC = 10mA
IB = 0.5mA IC = 10mA
VCE = 5V IC = 10mA
f = 100MHz
VCE = 5V IC = 0.2mA
R = 2kΩ f =1kHz ∆F=200Hz
BC109
BC107, BC108
VCE = 5V IC = 2mA f =100kHz
Group A BC107, BC108
Group B All Types
Group C BC108, BC109
BC107
BC108
BC109
VCE = 5V IC = 2mA f = 1kHz
Group A BC107, BC108
Group B All Types
Group C BC108, BC109
VCE = 5V IC = 2mA f = 1kHz
Group A BC107, BC108
Group B All Types
Group C BC108, BC109
VCB = 10V f = 1MHz
ELECTRICAL CHARACTERISTICS (TA = 25°C unless otherwise stated)
ICBO(1) Collector-Base Leakage Current
ICBO(1) Collector-Emitter Leakage Current
@Tamb =125°C
IEBO Emitter Cut-off Current
h21E Static Forward Current Transfer Ratio
VBE Base – Emitter Breakdown
VBE(sat)(1) Base – Emitter Saturation Voltage
VCE(sat)(1) Collector – Emitter Saturation Voltage
fT Transition Frequency
F Noise Factor
h21e Small Signal Forward Current Transfer
Ratio
h11e Common Emitter Input Impedance
h22e Common Emitter Output Admittance
C22b Common Base Output Capacitance
Rth(j-amb) Thermal Resistance: Junction to
Ambient
15
15
4
4
1
110 220
180 460
380 800
110 460
110 800
180 800
0.7
0.83
0.25
150
4
10
125 260
240 500
450 900
125 500
125 900
240 900
1.6 4.5
3.2 8.5
6.0 15
30
60
110
6
500
nA
µA
µA
V
V
V
MHz
dB
kΩ
µS
pF
°C/W
69
www.nitropdf.com
Microcontroller Based Solar Charger
I ~ C 0 ft P 0 RAT ~ D
DS28002 Rev. 8 - 2
1 of 3 www.diodes.com
1N4001-1N4007© Diodes Incorporated
1N4001 - 1N4007 1.0A RECTIFIER
Features • Diffused Junction • High Current Capability and Low Forward Voltage Drop • Surge Overload Rating to 30A Peak • Low Reverse Leakage Current • Lead Free Finish, RoHS Compliant (Note 3)
Mechanical Data • Case: DO-41 • Case Material: Molded Plastic. UL Flammability Classification
Rating 94V-0 • Moisture Sensitivity: Level 1 per J-STD-020D • Terminals: Finish - Bright Tin. Plated Leads Solderable per
MIL-STD-202, Method 208 • Polarity: Cathode Band • Mounting Position: Any • Ordering Information: See Page 2 • Marking: Type Number • Weight: 0.30 grams (approximate)
Dim DO-41 Plastic Min Max
A 25.40 ⎯ B 4.06 5.21 C 0.71 0.864 D 2.00 2.72 All Dimensions in mm
Maximum Ratings and Electrical Characteristics @TA = 25°C unless otherwise specified
Single phase, half wave, 60Hz, resistive or inductive load. For capacitive load, derate current by 20%.
Characteristic Symbol 1N4001 1N4002 1N4003 1N4004 1N4005 1N4006 1N4007 Unit Peak Repetitive Reverse Voltage Working Peak Reverse Voltage DC Blocking Voltage
VRRM VRWM
VR 50 100 200 400 600 800 1000 V
RMS Reverse Voltage VR(RMS) 35 70 140 280 420 560 700 V Average Rectified Output Current (Note 1) @ TA = 75°C IO 1.0 A Non-Repetitive Peak Forward Surge Current 8.3ms single half sine-wave superimposed on rated load IFSM 30 A
Forward Voltage @ IF = 1.0A VFM 1.0 V Peak Reverse Current @TA = 25°C at Rated DC Blocking Voltage @ TA = 100°C IRM 5.0
50 μA
Typical Junction Capacitance (Note 2) Cj 15 8 pF Typical Thermal Resistance Junction to Ambient RθJA 100 K/W Maximum DC Blocking Voltage Temperature TA +150 °C Operating and Storage Temperature Range TJ, TSTG -65 to +150 °C
Notes: 1. Leads maintained at ambient temperature at a distance of 9.5mm from the case. 2. Measured at 1.0 MHz and applied reverse voltage of 4.0V DC. 3. EU Directive 2002/95/EC (RoHS). All applicable RoHS exemptions applied, see EU Directive 2002/95/EC Annex Notes.
4)70
www.nitropdf.com
Microcontroller Based Solar Charger
I ~ C 0 ft P 0 RAT ~ D
DS28002 Rev. 8 - 2
2 of 3 www.diodes.com
1N4001-1N4007© Diodes Incorporated
40 60 80 100 120 140 160 1800
0.2
0.4
0.6
0.8
1.0I
, AV
ERA
GE
FO
RW
AR
D R
EC
TIFI
ED
CU
RR
EN
T (A
)(A
V)
T , AMBIENT TEMPERATURE (ºC)Fig. 1 Forward Current Derating Curve
A
0.6 0.8 1.0 1.2 1.4 1.60.01
0.1
1.0
I, I
NS
TAN
TAN
EO
US
FO
RW
AR
D C
UR
RE
NT
(A)
F
V , INSTANTANEOUS FORWARD VOLTAGE (V)Fig. 2 Typical Forward Characteristics
F
10
T , = 25 CPulse Width = 300 s
2% Duty Cycle
jo
μ
1.0 10 100
I, P
EA
K F
OR
WA
RD
SU
RG
E C
UR
RE
NT
(A)
FSM
NUMBER OF CYCLES AT 60 HzFig. 3 Max Non-Repetitive Peak Fwd Surge Current
40
30
20
0
10
50
C, C
APA
CIT
AN
CE
(pF)
j
V , REVERSE VOLTAGE (V)Fig. 4 Typical Junction Capacitance
R
1.0 10 1001.0
10
100T = 25ºCj f = 1MHz
1N4001 - 1N4004
1N4005 - 1N4007
Ordering Information (Note 4)
Device Packaging Shipping 1N4001-B DO-41 Plastic 1K/Bulk 1N4001-T DO-41 Plastic 5K/Tape & Reel, 13-inch 1N4002-B DO-41 Plastic 1K/Bulk 1N4002-T DO-41 Plastic 5K/Tape & Reel, 13-inch 1N4003-B DO-41 Plastic 1K/Bulk 1N4003-T DO-41 Plastic 5K/Tape & Reel, 13-inch 1N4004-B DO-41 Plastic 1K/Bulk 1N4004-T DO-41 Plastic 5K/Tape & Reel, 13-inch 1N4005-B DO-41 Plastic 1K/Bulk 1N4005-T DO-41 Plastic 5K/Tape & Reel, 13-inch 1N4006-B DO-41 Plastic 1K/Bulk 1N4006-T DO-41 Plastic 5K/Tape & Reel, 13-inch 1N4007-B DO-41 Plastic 1K/Bulk 1N4007-T DO-41 Plastic 5K/Tape & Reel, 13-inch
Notes: 4. For packaging details, visit our website at http://www.diodes.com/datasheets/ap02008.pdf.
71
www.nitropdf.com
Microcontroller Based Solar Charger
72Microcontroller Based Solar Charger
Electronics and Communication Engineering Department SNGIST
ADVANTAGES
• No noise
• Easy to install
• Simple to operate
• Pollution free working
• Low maintenance cost
• Generating panel has a long life
73Microcontroller Based Solar Charger
Electronics and Communication Engineering Department SNGIST
CONCLUSION
In future, India will have to depend on renewable energy. The only source available around
us is sunlight, and we can easily convert sunlight energy into electrical energy by using PV
cells to meet our requirement.
However to extend use of solar power energy to industrial and commercial areas, the price
of PV cells need to be brought down through low-cost manufacturing techniques.
By using the solar energy power generation technology the usage of non-conventional
resources can be minimized which not only reduces the resource extinction but helps widely
in reducing the environmental pollution.
By Generating Power Through Solar Energy The Cost Of Electricity Can Be
Minimized And Occasionally Can Be Provided With Free Of Cost.
Electricity Can Be Supplied Even To Remote Areas With Out The usage Of
Transmission Lines.
74Microcontroller Based Solar Charger
Electronics and Communication Engineering Department SNGIST
REFERENCE
PIC Microcontroller Text by Muhammad Ali Mazidi.
www.electronicscomponents.com
http://www.electronicsforu.com/
http://www.alldatasheet.com/