+ All Categories
Home > Documents > project report - solar recorder

project report - solar recorder

Date post: 18-Nov-2014
Category:
Upload: krkamaldevnlm4028
View: 109 times
Download: 1 times
Share this document with a friend
Description:
solar intensity & temperature store and its values communicate to computer
Popular Tags:
57
Minor project report SOLAR RECORDER |1 Department of electronics and communication College of engineering kidangoor 1. INTRODUCTION Solar energy is originates in the sun’s core and travels to the Earth. In this activity we design a device, using this you can find how energy is distributed at the surface of the earth, in both space and time. This strategy, of exploring how some parameter of interest varies in space and time, is a common strategy in Earth and environmental science. In this activity, we are also be practicing making solar recorder for accurate measurement and safe recording of both temperature and intensity at a place for a long time. The device used for measuring daily temperature and intensity, using this we can calculate solar energy incident at a place at a time. The device was built with a PIC16F873 and the 512MB flash memory24LC512c. The solar radiation is measured by a calculator solar cell. The PIC chip interfaces the flash memory using i2c mode. The interval between samples is set to one minute. The firmware detects the chip, assigns the memory location and begins recording automatically. The LCD displays the intensity ,temperature & memory location where data is stored. With the flash memory technology and a serial communication technology, the devices will be able to record huge amount of data and quick data uploading to the PC. To estimate the sun energy for a given location, we record the intensity and temperature with time. The total incident can be computed easily by integrating the intensity curve and add with sum of temperature. For accurate total radiation measurement, we use the expensive pyranometer. However for simplicity and cheap instrument we can replace it with a small solar cell as the input sensor. The device use LM35 as input temperature sensor instead of thermistor to improve accuracy of measurement. Solar energy is the main returnable source of energy. To avoid the energy deficiency we have a maximum use of solar energy. So this device has great importance to study about the solar energy for its maximum usage. Solar radiation contain different radiation which have a great dependence in human life ( ultra-violet radiation in large quantity may cause cancer , IR radiation has great important temperature maintenance ). This will accelerate importance in study of solar radiation. The solar recorder that we are developed should help a large extend to solve this problem.
Transcript
Page 1: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 1

Department of electronics and communication College of engineering kidangoor

1. INTRODUCTION

Solar energy is originates in the sun’s core and travels to the Earth. In this activity we design a device, using this you can find how energy is distributed at the surface of the earth, in both space and time. Thisstrategy, of exploring how some parameter of interest varies in space and time, is a common strategy inEarth and environmental science. In this activity, we are also be practicing making solar recorder foraccurate measurement and safe recording of both temperature and intensity at a place for a long time.

The device used for measuring daily temperature and intensity, using this we can calculate solar energyincident at a place at a time. The device was built with a PIC16F873 and the 512MB flashmemory24LC512c. The solar radiation is measured by a calculator solar cell. The PIC chip interfaces theflash memory using i2c mode. The interval between samples is set to one minute. The firmware detects thechip, assigns the memory location and begins recording automatically. The LCD displays the intensity,temperature & memory location where data is stored. With the flash memory technology and a serialcommunication technology, the devices will be able to record huge amount of data and quick data uploadingto the PC.

To estimate the sun energy for a given location, we record the intensity and temperature with time. Thetotal incident can be computed easily by integrating the intensity curve and add with sum of temperature.For accurate total radiation measurement, we use the expensive pyranometer. However for simplicity andcheap instrument we can replace it with a small solar cell as the input sensor. The device use LM35 as inputtemperature sensor instead of thermistor to improve accuracy of measurement.

Solar energy is the main returnable source of energy. To avoid the energy deficiency we have amaximum use of solar energy. So this device has great importance to study about the solar energy for itsmaximum usage. Solar radiation contain different radiation which have a great dependence in human life (ultra-violet radiation in large quantity may cause cancer , IR radiation has great important temperaturemaintenance ). This will accelerate importance in study of solar radiation. The solar recorder that we aredeveloped should help a large extend to solve this problem.

Page 2: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 2

Department of electronics and communication College of engineering kidangoor

2. CIRCUIT EXPANSION

As in every embedded system the solar recorder system can be dividedinto a number of units with each unit have specified task to do in the system. Each block and detailedexplanation of each is given bellow.

2.1FUNCTIONAL BLOCK DIAGRAM

SERIAL

COMMUNICATION

UNIT

MICROCONTROLLER

DISPLAY

UNIT

STORING

UNIT

SENSING

UNIT

Page 3: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 3

Department of electronics and communication College of engineering kidangoor

2.2BLOCK DIAGRAM DESCRIPTION

The different units are

1. Sensing unit2. Microcontroller unit3. Storing unit4. Display unit5. Serial communication unit

2.2.1. SENSING UNIT

The function of sensing unit is to sense (measure or convert to equivalent electricalsignal) different parameters like temperature, pressure, humidity from a system for further processing. Insolar recorder the function of sensing unit is to measure temperature of environment (due to incident solarradiation) and intensity of incident light. For first function we use LM35 & a solar panel for intensitymeasurement. The sensing unit send its electrical signal (voltage) output to microcontroller unit.

A. LM35

The LM35 series are precision integrated-circuit temperature sensors, whose outputvoltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantageover linear temperature sensors calibrated in ° Kelvin, as the user is not required to subtract a large constantvoltage from its output to obtain convenient Centigrade scaling. The LM35 does not require any externalcalibration or trimming to provide typical accuracies of ±1⁄4°C at roomtemperature and ±3⁄4°C over a full −55 to +150°C temperaturerange. Low cost is assured by trimming and calibration at the wafer level. TheLM35’s low output impedance, linearoutput, and precise inherent calibration make interfacing to readout orcontrol circuitry especially easy. It can be used with single power supplies, or with plus and minus supplies.As it draws only 60 μA from its supply, it has very lowself-heating, less than 0.1°C in still air. The LM35 israted to operate over a−55° to +150°C temperature range, while the LM35C is rated for a−40° to +110°C range (−10° with improvedaccuracy).

Page 4: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 4

Department of electronics and communication College of engineering kidangoor

A. SOLAR PANEL

Solar modules are vital in order to convert sunlight directly into electricity. Solar modules are made ofsemiconductors which are very similar to those used in the manufacturing of integrated circuits forelectronic equipment. The most popular type of semiconductor currently in use is silicon crystal. Siliconcrystals are laminated into n-type and p-type. When light is applied, a photoelectric effect is induced whichgenerates power. The electricity produced is called direct current High purity silicon crystals are used insolar cells. The crystals are processed into solar cells using a melt and 'cast' method. The cast 'cube' is thencut into 'ingots', and then sliced into very thin wafers.

When the sunlight hits the semiconductor, an electron springs up and is attracted towardthe n-type semiconductor. This will cause more negatives in the n-type and more positives in the p-typesemiconductors, generating a higher flow of electricity. This is the photovoltaic effect. In this circuit weuse a solar panel of 2v as intensity sensor which produce a voltage between 0V & 2V depending on theintensity of incident beam.

2.2.2 MICROCONTROLLER UNIT

The function of microcontroller unit is to process the electrical signal from sensing unit.Processing means converting the sensed value to slandered value with a standard unit. The conversionshould be capable to reduce the errors in sensing element. The microcontroller unit decide what to do withinput data.

In solar recorder microcontroller unit take sensors data in every time using ADC port.After convert to standard digital value it will display and/or store that value depending on the input that wegiven through the switches The microcontroller should be capable of read or write the external flashmemory and can be communicate with external peripherals like computer. The important factor is all thisoperations should be complete at a particular time interval. Because of all these we are using pic16f877awith 11GHz crystal oscillator is used as micro controller.

A. PIC16F877AB.

I. MEMORY ORGANIZATION PIC16877A

There are three memory blocks in each of these PIC micro MCUs. The Program Memory andData Memory have separate buses so that concurrent access can occur and is detailed in this section.

Page 5: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 5

Department of electronics and communication College of engineering kidangoor

a. PROGRAM MEMORY ORGANIZATION

The PIC16F87X devices have a 13-bit program counter capable of addressing an 8K x 14program memory space. The PIC16F877/876 devices have 8K x 14 words of FLASH program memory.Accessing a location above the physically implemented address will cause a wraparound. The reset vector isat 0000h and the interrupt vector is at 0004h.

b. DATA MEMORY ORGANIZATION

The data memory is partitioned into multiple banks which contain the General PurposeRegisters and the Special Function Registers. Bits RP1(STATUS<6>) and RP0 (STATUS<5>) are the bankselect bits. Each bank extends up to 7Fh (128 bytes). The lower locations of each bank are reserved for theSpecial Function Registers. Above the Special Function Registers are General Purpose Registers,implemented as static RAM. All implemented banks contain SpecialFunction Registers. Some “high use” Special Function Registers from one bank may be mirrored in another bank for code reduction and quickeraccess.

II. TIMER2 MODULE

In solar recorder timer2 module is to produce 1 sec time calculation for writing data to flash memorychip. Timer2 is an 8-bit timer with a prescaler and a postscaler. It can be used as the PWM time-basefor the PWM mode of the CCP module(s). The TMR2 register is readable and writable, and is clearedon any device reset The input clock (FOSC/4) has a prescale option of 1:1, 1:4 or 1:16, selected bycontrol bits T2CKPS1:T2CKPS0 (T2CON<1:0>). The Timer2 module has an 8-bit period registerPR2. Timer2 increments from 00h until it matches PR2 and then resets to 00h on the next incrementcycle. PR2 is a readable and writable register. The PR2 register is initialized to FFh upon reset. Thematch output of TMR2 goes through a 4-bit postscaler (which gives a 1:1 to 1:16 scaling inclusive) togenerate a TMR2 interrupt (latched in flag bit TMR2IF, (PIR1<1>)). Timer2 can be shut off byclearing control bit TMR2ON (T2CON<2>) to minimize power consumption.

I. MASTER SYNCHRONOUS SERIAL PORT (MSSP) MODULE

The Master Synchronous Serial Port (MSSP) module is a serial interface useful forcommunicating with other peripheral or microcontroller devices. These peripheral devices may be serialEEPROMs, shift registers, display drivers, A/D converters, etc. The MSSP module can operate in one oftwo modes:

• Serial Peripheral Interface (SPI)

• Inter-Integrated Circuit (I2C)

Page 6: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 6

Department of electronics and communication College of engineering kidangoor

a. INTER-INTEGRATED CIRCUIT (I2C)

In solar recorder it is used for serial communication with external memory chip.The MSSP module in I2C mode fully implements all master and slave functions (includinggeneral call support) and provides interrupts-on-start and stop bits in hardware to determine afree bus (multi-master function). The MSSP module implements the standard modespecifications, as well as 7-bit and 10-bit addressing. A "glitch" filter is on the SCL and SDApins when the pin is an input. This filter operates in both the 100 kHz and 400 kHz modes. Inthe 100 kHz mode, when these pins are an output, there is a slew rate control of the pin that isindependant of device frequency. Two pins are used for data transfer. These are the SCL pin,which is the clock, and the SDA pin, which is the data. The SDA and SCL pins areautomatically configured when the I2C mode is enabled. The SSP module functions areenabled by setting SSP Enable bit SSPEN (SSPCON<5>). The MSSP module has six registersfor I2C operation. They are the:

a. SSP Control Register (SSPCON)b. SSP Control Register2 (SSPCON2)c. SSP Status Register (SSPSTAT)d. Serial Receive/Transmit Buffer (SSPBUF)e. SSP Shift Register (SSPSR) - Not directly accessiblef. SSP Address Register (SSPADD)

Before selecting any I2C mode, the SCL and SDA pins must be programmed to inputs by setting theappropriate TRIS bits. Selecting an I2C mode, by setting the SSPEN bit, enables the SCL and SDA pins tobe usedas the clock and data lines in I2C mode. The CKE bit (SSPSTAT<6:7>) sets the levels of the SDAand SCL pins in either master or slave mode. When CKE = 1, the levels will conform to the SMBUSspecification. When CKE = 0, the levels will conform to the I2C specification.

The SSPSTAT register gives the status of the data transfer. This information includesdetection of a START (S) or STOP (P) bit, specifies if the received byte was data or address, if the next byteis the completion of 10-bit address, and if this will be a read or write data transfer. SSPBUF is the register towhich the transfer data is written to or read from. The SSPSR register shifts the data in or out of the device.In receive operations, the SSPBUF and SSPSR create a doubled buffered receiver. This allows reception ofthe next byte to begin before reading the last byte of received data. When the complete byte is received, it istransferred to the SSPBUF register and flag bit SSPIF is set. If another complete byte is received before theSSPBUF register is read, a receiver overflow has occurred and bit SSPOV (SSPCON<6>) is set and the bytein the SSPSR is lost. The SSPADD register holds the slave address. In 10-bit mode, the user needs to writethe high byte of the address (1111 0 A9 A8 0). Following the high byte address match, the low byte of theaddress needs to be loaded . The MSSP module will override the input state with the output data when

Page 7: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 7

Department of electronics and communication College of engineering kidangoor

required (slave transmitter). When an address is matched or the data transfer after an address match isreceived, the hardware automatically will generate the acknowledge (ACK) pulse, and then load theSSPBUF register with the received value currently in the SSPSR register. There are certain conditions thatwill cause the MSSP module not to give this ACK pulse. These are if either (or both):

II. ANALOG-TO-DIGITAL CONVERTER (A/D) MODULE

The Analog-to-Digital (A/D) Converter module has five inputs for the 28-pin devices and eightfor the other devices. The analog input charges a sample and hold capacitor. The output of the sample andhold capacitor is the input into the converter. The converter then generates a digital result of this analoglevel via successive approximation. The A/D conversion of the analog input signal results in acorresponding 10-bit digital number. The A/D module has high and low voltage reference input that issoftware selectable to some combination of VDD, VSS, RA2 or RA3. The A/D converter has a uniquefeature of being able to operate while the device is in SLEEP mode. To operate in sleep, the A/D clock mustbe derived from the A/D’sinternal RC oscillator. The A/D module has four registers. These registers are:

a. A/D Result High Register (ADRESH)b. A/D Result Low Register (ADRESL)c. A/D Control Register0 (ADCON0)d. A/D Control Register1 (ADCON1)

. The port pins can be configured as analog inputs (RA3 can also be the voltage reference) or as digital I/O.

The ADRESH:ADRESL registers contain the 10-bit result of the A/D conversion. Whenthe A/D conversion is complete, the result is loaded into this A/D result register pair, the GO/DONE bit(ADCON0<2>) is cleared and the A/D interrupt flag bit ADIF is set. After the A/D module has beenconfigured as desired, the selected channel must be acquired before the conversion is started. The analoginput channels must have their corresponding TRIS bits selected as inputs. Determine sample time. Afterthis acquisition time has elapsed, the A/D conversion can be started. The following steps should be followedfor doing an A/D conversion:

1. Configure the A/D module:

a. Configure analog pins / voltage reference / and digital I/O (ADCON1)b. Select A/D input channel (ADCON0)c. Select A/D conversion clock (ADCON0)d. Turn on A/D module (ADCON0)

2. Configure A/D interrupt (if desired):

a. Clear ADIF bitb. Set ADIE bitc. Set GIE bit

Page 8: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 8

Department of electronics and communication College of engineering kidangoor

3. Wait the required acquisition time.

4. Start conversion:

a. Set GO/DONE bit (ADCON0)

5. Wait for A/D conversion to complete, by either:

a. for the GO/DONE bit to be clearedb. Waiting for the A/D interrupt

6. Read A/D Result register pair (ADRESH:ADRESL), clear bit ADIF if required.

7. For next conversion, go to step 1 or step 2 as required. The A/D conversion time per bit is defined asTAD. A minimum wait of 2TAD is required before next acquisition starts.

I. ADDRESSABLE UNIVERSAL SYNCHRONOUS ASYNCHRONOUSRECEIVER TRANSMITTER (USART)

The Universal Synchronous Asynchronous Receiver Transmitter (USART) module is one of the two serialI/O modules. (USART is also known as a Serial Communications Interface or SCI). The USART can beconfigured as a full duplex asynchronous system that can communicate with peripheral devices such as CRTterminals and personal computers, or it can be configured

as a half duplex synchronous system that can communicate with peripheral devices such as A/D or D/Aintegrated circuits, serial EEPROMs etc.

The USART can be configured in the following modes:

• Asynchronous (full duplex)

• Synchronous - Master (half duplex)

• Synchronous - Slave (half duplex)

Bit SPEN (RCSTA<7>) and bits TRISC<7:6> have to be set in order to configure pins RC6/TX/CK andRC7/RX/DT as the Universal Synchronous Asynchronous Receiver Transmitter. The USART module alsohas a multi-processor communication capability using 9-bit address detection.

a. USART Asynchronous Mode

In this mode, the USART uses standard non-return-to zero (NRZ) format (one start bit, eight or nine databits,and one stop bit). The most common data format is 8 bits. An on-chip, dedicated, 8-bit baud rate

Page 9: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 9

Department of electronics and communication College of engineering kidangoor

generator can be used to derive standard baud rate frequencies from the oscillator. The USART transmitsand receivesthe LSb first. The USART’s transmitter and receiver are

functionally independent, but use the same data format and baud rate. The baud rate generator produces aclock either x16 or x64 of the bit shift rate, depending on bit BRGH (TXSTA<2>). Parity is not supportedby the hardware, but can be implemented in software (and

stored as the ninth data bit). Asynchronous mode is stopped during SLEEP. Asynchronous mode is selectedby clearing bit SYNC (TXSTA<4>). The USART Asynchronous module consists of the following

important elements:

• Baud Rate Generator

• Sampling Circuit

• Asynchronous Transmitter

• Asynchronous Receiver

b. USART Synchronous Master Mode

In Synchronous Master mode, the data is transmitted in a half-duplex manner (i.e., transmission andreception do not occur at the same time). When transmitting data, the reception is inhibited and vice versa.Synchronous mode is entered by setting bit SYNC (TXSTA<4>). In addition, enable bit SPEN(RCSTA<7>) is set in order to configure the RC6/TX/CK and RC7/RX/DT I/O pins to CK (clock) and DT(data) lines respectively. The Master mode indicates that the processor transmits the master clock on the CKline. The Master mode is entered by setting bit CSRC (TXSTA<7>).

c. USART Synchronous Slave ModeSynchronous slave mode differs from the Master mode in the fact that the shift clock is supplied externallyat the RC6/TX/CK pin (instead of being supplied internally in master mode). This allows the device totransfer or receive data while in SLEEP mode. Slave mode is entered by clearing bit CSRC (TXSTA<7>).

C. CRYSTAL OSCILLATOR

Cristal oscillator is to provide the necessary clock for the operation of microcontroller .Quartzcrystal is a tuned circuit with a very high Q. This and many other desirable attributes make the crystal anexcellent component choice for oscillators.

Page 10: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 10

Department of electronics and communication College of engineering kidangoor

Upon start-up, the amplitude of oscillation builds up to the point where nonlinearities in the amplifierdecrease the loop gain to unity. During steady-state operation, the crystal, which has a large reactance-frequency Slope as we saw in Figure 10, is located in the feedback network at a point where it has themaximum influence On the frequency of oscillation. A crystal oscillator is unique in that the impedance ofthe crystal changes so rapidly with frequency that all other circuit components can be considered to be ofconstant reactance, this reactance being calculated at the nominal frequency of the crystal. The frequency ofoscillation will adjust itself so that the crystal presents a reactance to the circuit which will satisfy theBarkhausen phase requirement

2.2.3 STORING UNIT

The function of storing unit is to permanently store data. Solar recorder use 24lc512 for thisapplication. The pic microcontroller can communicate(read / write )continuously with this chip using i2cports. Data in this chip can also read or delete using serial communication with computer. Pic write a datain every minute and read when corresponding key press is occur. Each data write need four bytes (temp-H,temp-L,volt-L,volt-H). Detail of 24lc512 is given bellow

A. FEATURES of 24LC512

The 24LC512B provides 524,288 bits of serial electrically erasable and programmable readonly memory (EEPROM) organized as 65,536 words of 8 bits each. The device’s cascadable feature allows up to eight devices to share a common two-wire bus. The device is optimized for use in many industrial andcommercial applications where low-power and low-voltage operation are essential. The devices areavailable in space-saving 8-pin PDIP, 8-lead JEDEC SOIC, 8-lead EIAJ SOIC, 8-lead TSSOP, 8-balldBGA2 and 8-lead Ultra Thin SAP packages. In addition, the entire family is available in 1.8V (1.8V to3.6V) and 2.5V (2.5V to 5.5V) versions. Pin name and function is shown in bellow.

Pin Name Function

A0–A2 Address Inputs

SDA Serial Data

SCL Serial Clock Input

WP Write Protect

a. PIN DESCRIPTION1. SERIAL CLOCK (SCL): The SCL input is used to positive edge clock data into each

EEPROM device and negative edge clock data out of each device.

Page 11: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 11

Department of electronics and communication College of engineering kidangoor

2. SERIAL DATA (SDA): The SDA pin is bidirectional for serial data transfer. This pin is opendrain driven and may be wire-OR ed with any number of other open-drain or open collectordevices.

3. DEVICE/PAGE ADDRESSES (A2, A1, A0): The A2, A1, and A0 pins are device addressinputs that are hardwired (directly to GND or to Vcc) for compatibility with other AT24Cxxdevices. When the pins are hardwired, as many as eight 512K devices may be addressed on asingle bussystem. (Device addressing is discussed in detail under “Device Addressing,” page 8.) A device is selected when a corresponding hardware and software match is true. If thesepins are left floating, the A2, A1, and A0 pins will be internally pulled down to GND.However, due to capacitive coupling that may appear during customer applications, Atmel®recommends always connecting the address pins to a known state. When using a pull-upresistor, Atmel recommendsusing 10kΩ or less.

4. WRITE PROTECT (WP): The write protect input, when connected to GND, allows normalwrite operations. When WP is connected directly to Vcc, all write operations to the memoryare inhibited. If the pin is left floating, the WP pin will be internally pulled down to GND.However, due to capacitive coupling that may appear during customer applications, Atmelrecommends always connecting the WP pins to a known state. When using a pull-up resistor,Atmel recommendsusing 10kΩ or less.

b. MEMORY ORGANIZATION

24LC512B, 512K SERIAL EEPROM: The 512K is internally organized as 512 pages of 128-bytes each. Random word addressing requires a 16-bit data word address.

c. DEVICE OPERATION1. CLOCK and DATA TRANSITIONS: The SDA pin is normally pulled high with an external

device. Data on the SDA pin may change only during SCL low time periods Data changesduring SCL high periods will indicate a start or stop condition as defined below.

2. START CONDITION: A high-to-low transition of SDA with SCL high is a start conditionwhich must precede any other command.

3. STOP CONDITION: A low-to-high transition of SDA with SCL high is a stop condition. Aftera read sequence, the stop command will place the EEPROM in a standby power modeACKNOWLEDGE: All addresses and data words are serially transmitted to and from theEEPROM in 8-bit words. The EEPROM sends a zero during the ninth clock cycle toacknowledge that it has received each word.

4. STANDBY MODE: The AT24C512B features a low power standby mode which is enabled: a)upon power-up and b) after the receipt of the STOP bit and the completion of any internaloperations.

Page 12: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 12

Department of electronics and communication College of engineering kidangoor

5. Software Reset: After an interruption in protocol, power loss or system reset, any 2-wirepartcan be protocol reset by following these steps: (a) Create a start bit condition, (b)clock 9cycles, (c) create another start bit followed by stop bit condition The device is ready for nextcommunication after above steps have been completed.

2.2.4 DISPLAY UNIT

The function of display unit is to display the output of a embedded system. In solar recorder displayunit has to display both previous (2nd line) and current(1st line) intensity, temperature &memory locationthat store the data. For this purposes we use a 16*2 LCD unit as output unit .Details of LCD is given bellow.

This LCD contain 16pin. LCD contain two internal registers. Data register and control register.The input data is write to data register and commands are write to control register. The name and functionof pins are given bellow. Data should be in ASCI format .

NUMBER NAME FUNCTION

1 VSS provide ground for LCD

2 VDD Provide ide Vcc for LCD ,connect to +5V supply

3 VEE For the control of contrast of LCD display

4 RS (register select) 0: command register will be selected for read /write operations.1: 1: Data register will be selected for read/write operations

5 R/W(read / write ) 0: to write to control/data register

1: To read from data/control register

6 E (enable) high to low pulse : Enable the LCD read/write operation

low to high pulse : Disable the LCD read/write operation

7 14 D0 D7 bus line to/from control/data registers in ASCI number format

16 V+& V- supply to the led inside the LED black light.

Page 13: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 13

Department of electronics and communication College of engineering kidangoor

2.2.5 SERIAL COMMUNICATION UNIT

In solar recorder serial communication unit is connect to pic microcontrollers PORTC(C6&C7). Through this we can modify the software of the microcontroller. A computer connect to this unitcan direct access data write in the external flash memory by simply send a character except ‘c’ . If you send ‘c’ to this unit this will clear the external flash memory. The serial communication unit contain RS232 for serial communication & MAX232 to convert RS232 output & input to usable values. Detailed explanationof each is given bellow.

A. RS232

In RS-232, user data is sent as a time series of bits. Both synchronous and asynchronous transmissionsare supported by the standard. In addition to the data circuits, the standard defines a number of controlcircuits used to manage the connection between the DTE and DCE. Each data or control circuit onlyoperates in one direction, that is, signaling from a DTE to the attached DCE or the reverse. Since transmitdata and receive data are separate circuits, the interface can operate in a full duplex manner, supportingconcurrent data flow in both directions. The standard does not define character framing within the datastream, or character encoding.

a. VOLTAGE LEVELS

The RS-232 standard defines the voltage levels that correspond to logical one and logical zero levels. Validsignals are plus or minus 3 to 15 volts. The range near zero volts is not a valid RS-232 level; logic one isdefined as a negative voltage, the signal condition is called marking, and has the functional significance ofOFF. Logic zero is positive, the signal condition is spacing, and has the function ON. The standard specifiesa maximum open-circuit voltage of 25 volts; signal levels of ±5 V,±10 V,±12 V, and ±15 V are allcommonly seen depending on the power supply available within a device. RS-232 drivers and receiversmust be able to withstand indefinite short circuit to ground or to any voltage level up to ±25 volts. The slewrate or how fast the signal changes between levels, is also controlled.

Because the voltage levels are higher than logic levels typically used by integrated circuits, specialintervening driver circuits are required to translate logic levels. These also protect the device's internalcircuitry from short circuits or transients that may appear on the RS-232 interface, and provide sufficientcurrent to comply with the slew rate requirements for data transmission. Because both ends of the RS-232circuit depend on the ground pin being zero volts, problems will occur when connecting machinery andcomputers where the voltage between the ground pin on one end, and the ground pin on the other is not zero.This may also cause a hazardous ground loop

Page 14: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 14

Department of electronics and communication College of engineering kidangoor

b. MAX232

The MAX232 is a dual driver/receiver that includes a capacitive voltage generator to supply TIA/EIA-232-Fvoltage levels from a single 5-V supply. Each receiver converts TIA/EIA-232-F inputs to 5-V TTL/CMOSlevels. These receivers have a typical threshold of 1.3 V, a typical hysteresis of 0.5 V, and can accept 30-Vinputs. Each driver converts TTL/CMOS input levels into TIA/EIA-232-F levels. The driver, receiver, andvoltage-generator functions are available as cells in the Texas Instruments Lin ASIClibrary.

Page 15: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 15

Department of electronics and communication College of engineering kidangoor

2.2 CIRCUIT DIAGRAM

Page 16: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 16

Department of electronics and communication College of engineering kidangoor

3. PROGRAM SECTION

2.3 FLOWCHART

2.4

START

Initialize port A as

input port

Initialize portB ,port C ,

port D as output

Initialize ADCTIMER2,USART

Write_e=0

Read ADC.1 voltage & store intemp-H & temp-L

Read ADC.0 voltage & store involt-H & volt-L

Volt=volt * multi factortemp=temp/2

d

a

b

Page 17: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 17

Department of electronics and communication College of engineering kidangoor

NO

YES

NO

YES

NO

YES

NO

Location=Location+4

Is any keypress

Is write-e=

=0

Is portD.0=0

Is portD.1=

0

Display volt, temp, location in 1st line &previous volt,temp, location in 2nd line

Write volt-H,volt-L ,temp-L,temp-H in flashmemory location

c

a

b

m

Page 18: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 18

Department of electronics and communication College of engineering kidangoor

YES

YES

NO

Location--

Prev.location++

Read volt-H ,volt-L,

from chip

Read temp-L ,temp-H

from chip

Call delay

Is location

<= 0

c

d

m

Page 19: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 19

Department of electronics and communication College of engineering kidangoor

3.2 PROGRAM

list p=16f877a#include<p16f877.inc>cblock 0x20del1,del2VoltH,VoltLTempH,TempLadh,adl,eep_dattenMs,secNumH,NumL,TenK,Thou,Hund,Tens,OnesACCH,ACCL,ACC2TEMP0,TEMP1PreVH,PreVL,PreTH,PreTL,Pre_adh,pre_adladh_t,adl_tad_cH,ad_cLcount,temp,d1,d2,d3endccblock 0x70Flag,W_TEMP,S_TEMPendc

#define ADDHH Flag,0#defineWrite_e Flag,1#define Plus portd,0#defineMinus portd,1#defineDebon Flag,2

org 0x00goto mainorg 0x04MOVWF W_TEMPSWAPF STATUS,WMOVWF S_TEMPBANKSEL PIR1BTFSC PIR1,TMR2IF

Page 20: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 20

Department of electronics and communication College of engineering kidangoor

CALL TMR2_INTRSWAPF S_TEMP,WMOVWF STATUSMOVFW_TEMP,WRETFIE

main;{ banksel trisc

bsf Plusbsf Minusbanksel tenMsclrf tenMsclrf secclrf adhclrf adlbanksel adcon1movlw 0x02movwf adcon1banksel trisbclrf trisbclrf trisemovlw 0xffmovwf trisamovlw 0xf0movwf trisd;};lcd initialisation;{ movlw 0x30call lcd_cmdmovlw 0x30call lcd_cmdmovlw 0x30call lcd_cmdmovlw 0x38call lcd_cmd

movlw 0x38call lcd_cmd

movlw 0x38call lcd_cmdmovlw 0x08call lcd_cmd

Page 21: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 21

Department of electronics and communication College of engineering kidangoor

movlw 0x01call lcd_cmdmovlw 0x06call lcd_cmdmovlw 0x0Ccall lcd_cmdmovlw 0x80call lcd_cmdbcf ADDHHbsf Write_ecall i2c_initcall TMR2_INITclrf PreVHclrf PreVLclrf PreTHclrf PreTLclrf Pre_adhclrf pre_adlclrf ad_Chclrf ad_cl

loopcall adc_readVbanksel ACCHmovfw VoltHmovwf NumHmovfw VoltLmovwf NumLcall B_to_ASCmovlw 0x80call lcd_cmd

; movlw 'V'; call lcd_dat; movlw '='; call lcd_dat

movf Hund,wcall lcd_datmovlw '.'call lcd_datmovf Tens,wcall lcd_dat

Page 22: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 22

Department of electronics and communication College of engineering kidangoor

movf Ones,wcall lcd_datcall adc_readTbanksel ACCHmovfw TempHmovwf NumHmovfw TempLmovwf NumLcall B_to_ASCmovlw ' 'call lcd_datmovlw ' 'call lcd_datmovf Hund,wcall lcd_datmovf Tens,wcall lcd_datmovf Ones,wcall lcd_datbanksel ACCHmovfw ad_cHmovwf NumHmovfw ad_Clmovwf NumLcall B_to_ASCmovlw ' 'call lcd_datmovlw ' 'call lcd_datmovf Thou,wcall lcd_datmovf Hund,wcall lcd_datmovf Tens,wcall lcd_datmovf Ones,wcall lcd_datmovlw 0xC0call lcd_cmdbanksel ACCH

Page 23: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 23

Department of electronics and communication College of engineering kidangoor

movfw PreVHmovwf NumHmovfw PreVLmovwf NumLcall B_to_ASCmovf Hund,wcall lcd_datmovlw '.'call lcd_datmovf Tens,wcall lcd_datmovf Ones,wcall lcd_datbanksel ACCHmovfw PreTHmovwf NumHmovfw PreTLmovwf NumLcall B_to_ASCmovlw ' 'call lcd_datmovlw ' 'call lcd_datmovf Hund,wcall lcd_datmovf Tens,wcall lcd_datmovf Ones,wcall lcd_datbanksel ACCHmovf pre_adh,wmovwf NumHmovf pre_adl,wmovwf NumLcall B_to_ASCmovlw ' 'call lcd_datmovlw ' 'call lcd_datmovf Thou,w

Page 24: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 24

Department of electronics and communication College of engineering kidangoor

call lcd_datmovf Hund,wcall lcd_datmovf Tens,wcall lcd_datmovf Ones,wcall lcd_dat;}btfss Pluscall plus_pressbtfss Minuscall minus_pressbtfsc write_ecall write_datagoto loop

minus_pressbanksel pre_adhmovf pre_adh,fbtfss status,zgoto non_zer_minusmovf pre_adl,fbtfss status,zgoto non_zer_minusbanksel VoltHmovfw VoltHmovwf PreVHmovfw VoltLmovwf PreVLmovfw TempHMovwfPreTHmovfw TempLmovwf PreTLmovfw ad_chmovwf pre_adhmovfw ad_clmovwf pre_adlreturn

non_zer_minusmovlw 0xffaddwf pre_adl,fbtfss status,c

Page 25: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 25

Department of electronics and communication College of engineering kidangoor

addwf pre_adh,fbanksel pre_adhmovf pre_adh,fbtfss status,zgoto non_zer_minus_jmp1movf pre_adl,fbtfss status,zgoto non_zer_minus_jmp1banksel VoltHmovfw VoltHmovwf PreVHmovfw VoltLmovwf PreVLmovfw TempHMovwfPreTHmovfw TempLmovwf PreTLmovfw ad_chmovwf pre_adhmovfw ad_clmovwf pre_adlreturn

non_zer_minus_jmp1clrcrlf pre_adl,wmovwf adlrlf pre_adh,wmovwf adhclrcbcf ADDHHrlf adlrlf adhbtfsc status,zbsf ADDHHcall i2c_eep_readbanksel eep_datmovf eep_dat,wmovwf preVHbanksel adlincf adl

Page 26: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 26

Department of electronics and communication College of engineering kidangoor

btfsc status,zincf adhcall i2c_eep_readbanksel eep_datmovf eep_dat,wmovwf preVLbanksel adlincf adlbtfsc status,zincf adhcall i2c_eep_readbanksel eep_datmovf eep_dat,wmovwf PreTHbanksel adlincf adlbtfsc status,zincf adhcall i2c_eep_readbanksel eep_datmovf eep_dat,wmovwf preTLbanksel adlincf adlbtfsc status,zincf adhreturn

plus_pressbanksel pre_adhmovf pre_adh,fbtfss status,zgoto non_zer_plusmovf pre_adl,fbtfss status,zgoto non_zer_plusbanksel VoltHmovfw VoltHmovwf PreVHmovfw VoltLmovwf PreVL

Page 27: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 27

Department of electronics and communication College of engineering kidangoor

movfw TempHMovwfPreTHmovfw TempLmovwf PreTLmovfw ad_chmovwf pre_adhmovfw ad_clmovwf pre_adlreturn

non_zer_plusmovf pre_adh,wsubwf ad_ch,wbtfss status,zgoto $+3movf ad_cl,wsubwf pre_adl,w

btfsc status,zreturnincf pre_adl,fbtfsc status,zincf pre_adh,fclrcrlf pre_adl,wmovwf adlrlf pre_adh,wmovwf adh clrcbcf ADDHHrlf adlrlf adhbtfsc status,zbsf ADDHHcall i2c_eep_readbanksel eep_datmovf eep_dat,wmovwf preVHbanksel adlincf adlbtfsc status,zincf adh

call i2c_eep_read

Page 28: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 28

Department of electronics and communication College of engineering kidangoor

banksel eep_datmovf eep_dat,wmovwf preVLbanksel adlincf adlbtfsc status,zincf adhcall i2c_eep_readbanksel eep_datmovf eep_dat,wmovwf PreTHbanksel adlincf adlbtfsc status,zincf adhcall i2c_eep_readbanksel eep_datmovf eep_dat,wmovwf preTLbanksel adlincf adlbtfsc status,zincf adhreturn

write_data;{ banksel VoltH; movfw VoltH; movwf PreVH; movfw VoltL; movwf PreVL; movfw TempH; MovwfPreTH; movfw TempL; movwf PreTL; movfw adh; movwf pre_adh; movfw adl; movwf pre_adl

banksel VoltHmovfw VoltH

Page 29: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 29

Department of electronics and communication College of engineering kidangoor

movwf eep_datclrcrlf ad_cL,wmovwf adlrlf ad_cH,wmovwf adhclrcbcf ADDHHrlf adlrlf adhbtfsc status,zbsf ADDHHcall i2c_eep_writebanksel adlincf adlbtfsc status,zincf adhbanksel VoltLmovfw VoltLmovwf eep_datcall i2c_eep_writebanksel adlincf adlbtfsc status,zincf adhbanksel TempHmovfw TempHmovwf eep_datcall i2c_eep_writebanksel adlincf adlbtfsc status,zincf adhbanksel TempLmovfw TempLmovwf eep_datcall i2c_eep_writebanksel adlincf adlbtfsc status,z

Page 30: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 30

Department of electronics and communication College of engineering kidangoor

incf adhincf ad_cL,fbtfsc status,zincf ad_cH,fbcf write_ereturn;}#include <Timer2.inc>#include <lcd.inc>#include <adc.inc>#include <i2c.inc>end

adc_readVbanksel adcon0clrf adcon0movlw 0x80banksel adcon0movwf adcon0banksel adcon1movlw 0x82movwf adcon1banksel adcon0bsf adcon0,adoncall delayusbanksel adcon0bsf adcon0,go

adc_jmpVbtfsc adcon0,gogoto adc_jmpVbanksel adcon0bcf adcon0,adoncall delayusbanksel adreshmovf adresh,wbanksel VoltHmovwf ACCHbanksel adreslmovf adresl,wbanksel VoltLmovwf ACCLcall Volt_multply

Page 31: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 31

Department of electronics and communication College of engineering kidangoor

banksel ACCHmovfw ACCHmovwf VoltHmovfw ACCLmovwf VoltLreturn

adc_readTbanksel adcon0clrf adcon0movlw 0x88banksel adcon0movwf adcon0banksel adcon1movlw 0x82movwf adcon1banksel adcon0bsf adcon0,adoncall delayusbanksel adcon0bsf adcon0,go

adc_jmpTbtfsc adcon0,gogoto adc_jmpTbanksel adcon0bcf adcon0,adoncall delayusbanksel adreshbcf status,crrf adresh,wbanksel TempHmovwf TempHbanksel adreslrrf adresl,wbanksel TempLmovwf TempLreturn

delayusbanksel del1movlw 0x30movwf del1

Page 32: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 32

Department of electronics and communication College of engineering kidangoor

pageseldelayus_jmpdelayus_jmp

decfsz del1,fgoto delayus_jmpreturn

i2c_eep_writecall i2c_wait_till_idle ;wait for idle conditioncall i2cstart ;calling start conditionmovlw 0xA0btfsc ADDHHiorlw 0x02call i2c_transbanksel sspcon2btfsc sspcon2,ackstat ;waiting for acknowledgementgoto trend

banksel adh ;address location of eeprom higher bytemovf adh,0call i2c_transbanksel sspcon2btfsc sspcon2,ackstatgoto trendbanksel adl ;address location of eeprom lower bytemovf adl,0call i2c_transbanksel sspcon2btfsc sspcon2,ackstatgoto trendbanksel eep_dat ;data to be transmittedmovf eep_dat,0call i2c_transbanksel sspcon2btfsc sspcon2,ackstatgoto trendcall i2cstopreturn

trendcall i2cstopgoto i2c_eep_write

i2c_eep_read ;read condition

Page 33: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 33

Department of electronics and communication College of engineering kidangoor

call i2c_wait_till_idlecall i2cstartmovlw 0xA0btfsc ADDHHiorlw 0x02 ;sending device addresscall i2c_trans ;transmitting address/data via I2C Data

;pinbanksel sspcon2btfsc sspcon2,ackstat; wait to get aknowledgement (low) from

; slavegoto rend ;goto read endbanksel adhmovf adh,0call i2c_transbanksel sspcon2btfsc sspcon2,ackstatgoto rendbanksel adhmovf adl,0call i2c_transbanksel sspcon2btfsc sspcon2,ackstatgoto rendcall i2c_restart ;calling restart conditionmovlw 0xA1btfsc ADDHHiorlw 0x02call i2c_transbanksel sspcon2pagesel rendbtfsc sspcon2,ackstatgoto rendcall i2creadcall i2c_sendnack ;send no acknowledgmentcall i2cstopreturn

rendcall i2cstopgoto i2c_eep_read

Page 34: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 34

Department of electronics and communication College of engineering kidangoor

i2c_initbanksel sspstatbsf trisc,3 ;clock sclbsf trisc,4 ;data sda

clrf sspstat ;enable slew rate control for 400khz mode

movlw 0x06movwf sspadd ;sspadd=(fosc/(bit rate*4))-1

;here bit rate is 400khzclrf sspcon2banksel sspconmovlw 0x28movwf sspconreturn

i2c_transbanksel sspbuf ;put the data to be transmitted into

; sspbufmovwf sspbufpageseli2c_trans_jmpbanksel sspstat

i2c_trans_jmpbtfsc sspstat,r_w ;wait for transmission to completegoto i2c_trans_jmpreturn

i2creadbanksel sspcon2bsf sspcon2,rcen ;receive enable bitpagesel i2c_read_jmp

i2c_read_jmpbtfsc sspcon2,rcengoto i2c_read_jmpbanksel sspbuf ;received data taken from SSPBUF to

;working registermovf sspbuf,0banksel eep_datmovwf eep_datreturn

i2cstartbanksel sspcon2

Page 35: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 35

Department of electronics and communication College of engineering kidangoor

bsf sspcon2,senpageseli2cstart_jmp

i2cstart_jmpbtfsc sspcon2,sen ;flag for start condition overgoto i2cstart_jmpreturn

i2c_restartbanksel sspcon2bsf sspcon2,rsen ; flag for restart condition overpageseli2c_restart_jmp

i2c_restart_jmpbtfsc sspcon2,rsengoto i2c_restart_jmpreturn

i2cstopbanksel sspcon2bsf sspcon2,pen ;flag for stop condition overpageseli2cstop_jmp

i2cstop_jmpbtfsc sspcon2,pengoto i2cstop_jmpreturn

i2c_sendackbanksel sspcon2bcf sspcon2,ackdt ;to send acknowledgementbsf sspcon2,acken ;enable acknowledgementpagesel i2c_sendack_jmp

i2c_sendack_jmpbtfsc sspcon2,ackengoto i2c_sendack_jmpreturn

i2c_sendnackbanksel sspcon2bsf sspcon2,ackdt ;if ackdt is set there is no ackbsf sspcon2,ackenpagesel i2c_sendnack_jmp

i2c_sendnack_jmpbtfsc sspcon2,acken ;wait for getting acknowledgedgoto i2c_sendnack_jmpreturn

Page 36: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 36

Department of electronics and communication College of engineering kidangoor

i2c_wait_till_idlebanksel sspstatpagesel i2c_wait_till_idlebtfsc sspstat,r_w ;Wait for any rd/wr to completegoto i2c_wait_till_idlepageseli2c_wait_jmp1

i2c_wait_jmp1movf sspcon2,0andlw 0x1f ;clearing all flags in sspcon2

;so that we can ensure idle condition;is reached

btfss status,zgoto i2c_wait_jmp1return

lcd_cmdbanksel trisbclrf trisbbanksel portbmovwf portbbanksel triseclrf trisebanksel portebcf porte,0bcf porte,1bsf porte,2nopnopnopnopnopbcf porte,2call lcd_delayreturn

lcd_datbanksel portbmovwf portbbanksel portebsf porte,0bcf porte,1bsf porte,2

Page 37: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 37

Department of electronics and communication College of engineering kidangoor

nopnopnopnopnopbcf porte,2call lcd_delayreturn

lcd_initbanksel adcon1movlw 0x02movwf adcon1banksel trisbclrf trisbbcf trise,0bcf trise,1bcf trise,2movlw 0xffmovwf trisamovlw 0xf0movwf trisd;};lcd initialisation;{movlw 0x38call lcd_cmdmovlw 0x38call lcd_cmdmovlw 0x38call lcd_cmdmovlw 0x0ccall lcd_cmd

movlw 0x06call lcd_cmdmovlw 0x01call lcd_cmdmovlw 0x80

Page 38: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 38

Department of electronics and communication College of engineering kidangoor

call lcd_cmdreturn

lcd_delaybanksel d1

;1382393 cyclesmovlw 0x6Cmovwf d1movlw 0x04movwf d2movlw 0x04movwf d3

lcd_Delay_0decfsz d1, fgoto $+2decfsz d2, fgoto $+2decfsz d3, fgoto lcd_Delay_0

;3 cyclesgoto $+1nop

;4 cycles (including call)return

B_to_ASCswapf NumH,w

andlw 0x0Faddlw 0xF0movwf Thouaddwf Thou,faddlw .226movwf Hundaddlw .50movwf Onesmovf NumH,wandlw 0x0Faddwf Hund,faddwf Hund,faddwf Ones,faddlw .233movwf Tens

Page 39: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 39

Department of electronics and communication College of engineering kidangoor

addwf Tens,faddwf Tens,fswapf NumL,wandlw 0x0Faddwf Tens,faddwf Ones,frlf Tens,frlf Ones,fcomf Ones,frlf Ones,fmovf NumL,wandlw 0x0Faddwf Ones,frlf Thou,fmovlw 0x07movwf TenKmovlw .10

Lb1:addwf Ones,fdecf Tens,fbtfss 3,0goto Lb1

Lb2:addwf Tens,fdecf Hund,fbtfss 3,0goto Lb2

Lb3:addwf Hund,fdecf Thou,fbtfss 3,0goto Lb3

Lb4:addwf Thou,fdecf TenK,fbtfss 3,0goto Lb4BANKSEL TENK

movlw '0'addwf TenK,f

Page 40: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 40

Department of electronics and communication College of engineering kidangoor

addwf Thou,faddwf Hund,faddwf Tens,faddwf Ones,f

retlw 0Volt_multply

movf ACCH, wmovwf TEMP0movf ACCL, wmovwf TEMP1movf ACCL, wmovwf ACC2movf ACCH, wmovwf ACCLclrf ACCHrlf ACC2, frlf ACCL, frlf ACCH, frlf ACC2, frlf ACCL, frlf ACCH, fcomf ACCH, fcomf ACCL, fincf ACCL, fskpnzincf ACCH, fmovf TEMP1, waddwf ACCL, fmovf TEMP0, wskpncincfsz TEMP0, waddwf ACCH, fclrcrrf ACCH, frrf ACCL, fclrcrrf ACCH, frrf ACCL, fclrcrrf ACCH, f

Page 41: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 41

Department of electronics and communication College of engineering kidangoor

rrf ACCL, fmovf TEMP1, wsubwf ACCL, fmovf TEMP0, wskpcincfsz TEMP0, wsubwf ACCH, fswapf ACCL, wandlw 0x0Fmovwf ACCLswapf ACCH, wmovwf ACCHandlw 0xF0iorwf ACCL, fxorwf ACCH, fmovlw 0xF0skpciorwf ACCH, frlf ACCH, wrrf ACCH, frrf ACCL, fmovf TEMP1, waddwf ACCL, fmovf TEMP0, wskpncincfsz TEMP0, waddwf ACCH, fswapf ACCL, wandlw 0x0Fmovwf ACCLswapf ACCH, wmovwf ACCHandlw 0xF0iorwf ACCL, fxorwf ACCH, fmovf TEMP1, wsubwf ACCL, fmovf TEMP0, wskpcincfsz TEMP0, w

Page 42: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 42

Department of electronics and communication College of engineering kidangoor

subwf ACCH, fswapf ACCL, wandlw 0x0Fmovwf ACCLswapf ACCH, wmovwf ACCHandlw 0xF0iorwf ACCL, fxorwf ACCH, fmovlw 0xF0skpciorwf ACCH, frlf ACCH, wrrf ACCH, frrf ACCL, fmovf TEMP1, waddwf ACCL, fmovf TEMP0, wskpncincfsz TEMP0, waddwf ACCH, fclrcrrf ACCH, frrf ACCL, fclrcrrf ACCH, frrf ACCL, fclrcrrf ACCH, frrf ACCL, fmovf TEMP1, waddwf ACCL, fmovf TEMP0, wskpncincfsz TEMP0, waddwf ACCH, frrf ACCH, frrf ACCL, fclrcrrf ACCH, f

Page 43: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 43

Department of electronics and communication College of engineering kidangoor

rrf ACCL, fmovf TEMP1, wsubwf ACCL, fmovf TEMP0, wskpcincfsz TEMP0, wsubwf ACCH, fswapf ACCL, wandlw 0x0Fmovwf ACCLswapf ACCH, wmovwf ACCHandlw 0xF0iorwf ACCL, fxorwf ACCH, fmovlw 0xF0skpciorwf ACCH, frlf ACCH, wrrf ACCH, frrf ACCL, fmovf TEMP1, waddwf ACCL, fmovf TEMP0, wskpncincfsz TEMP0, waddwf ACCH, fclrcrrf ACCH, frrf ACCL, fclrcrrf ACCH, frrf ACCL, fclrcrrf ACCH, frrf ACCL, fmovf TEMP1, waddwf ACCL, fmovf TEMP0, wskpnc

Page 44: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 44

Department of electronics and communication College of engineering kidangoor

incfsz TEMP0, waddwf ACCH, frrf ACCH, frrf ACCL, fclrcrrf ACCH, frrf ACCL, fmovf TEMP1, wsubwf ACCL, fmovf TEMP0, wskpcincfsz TEMP0, wsubwf ACCH, fswapf ACCL, wandlw 0x0Fmovwf ACCLswapf ACCH, wmovwf ACCHandlw 0xF0iorwf ACCL, fxorwf ACCH, fmovlw 0xF0skpciorwf ACCH, frlf ACCH, wrrf ACCH, frrf ACCL, fmovf TEMP1, waddwf ACCL, fmovf TEMP0, wskpncincfsz TEMP0, waddwf ACCH, fclrcrrf ACCH, frrf ACCL, freturn

TMR2_INTRBCF PIR1,TMR2IFbanksel tenms

Page 45: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 45

Department of electronics and communication College of engineering kidangoor

incf tenms,fmovf tenms,wxorlw 0x0Bbtfss status,zgoto TMR_INT_EXITclrf tenmsbcf debonincf sec,fmovf sec,wxorlw .30btfss status,zgoto TMR_INT_EXITclrf secbsf write_e

TMR_INT_EXITRETURN

;setting for 10 ms delay at 11.0592 crysalTMR2_INIT

BANKSEL TMR2CLRF TMR2MOVLW 0X7bMOVWF T2CONBANKSEL PR2MOVLW .107MOVWF PR2BANKSEL PIR1BCF PIR1,TMR2IFBANKSEL PIE1BSF PIE1,TMR2IEBSF INTCON,PEIEBSF INTCON,GIEBANKSEL T2CONBSF T2CON,TMR2ONRETURN

Page 46: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 46

Department of electronics and communication College of engineering kidangoor

3.3 PROGRAM EXPLANATION

In program we are define what to do when an interrupt is called. When an interrupt iscalled program execution will shift to location 0x04. At that time we save the address of location where datais read or write from memory chip is stored to a temporary register ‘TEMP’. All information about the status of last operation is also stored. After the execution of current interrupt all information’s are restored into corresponding registers.

As a second operation of program we define main section. In it the device reading twoADC port (PORTA.0 & PORTA.1) one after another in all time. For reading from PORTA ,it should be setas input port. For that TRISA register should be set to high. Depending on the speed and format of ADCconversion set the registers ADCON0 &ADCON1. Each ADC value can be read from two registers namedADRESH (higher bits).ADRESL (lower bits). In pic16f877a we have a ten bit ADC that represent eachanalog input using ten bits. By adjusting ADCON ,ADCON1 we storing lower 8bits of ADC output inADRESL and higher 2bits in ADRESH. The ADC output is read from this registers. After reading ADCvalues are multiplied by a multiplication factor. While reading PORTA.0,we read the value and multipliedby one and in reading PORTA.1 we divide that value by 2 and store to corresponding temporary registers.

After multiplication corresponding values are displayed on LCD. For it LCD shouldhave to initialized. For it corresponding codes in ASCII is send to control register of LCD. To send a data tocontrol register move corresponding data to PORTB (data bus of LCD).Set PORTB as output set TRISB tozero. The control pins are connected to PORTE. Set PORTE as output by clearing TRISE register. SetPORTE.0(to select control register),PORTE.1 (to enable write operation) as low and send a high to lowpulse to PORTE.2 (for enable the LCD) with a suitable delay. After LCD initialization modified ADCoutput in temporary register is send for display. This display should be in the first line of LCD. The order ofdisplay is PORTA.0,PORTA.1,memory location where the last data is stored. For display this valuescorresponding commands should send as explained earlier. Then send data to be display to PORTB. Thenset PORTE.0 (TO select data register) to high.,PORTE.1(to enable write) to low, and send a high to lowpulse to PORTE.2( to enable the LCD).this set of operation should be repeated for each read value fromADC.

Parallel to this operation the timer2 is operating. The operation of timer2 is controlledby PR2 register and T2CON register. T2CON is adjusted to turn on timer2 and to get prescalar of 16.and1:16 postscale. A value of 104 is loaded to PR2 to set the timer to1 secant. A second register of name sec is

Page 47: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 47

Department of electronics and communication College of engineering kidangoor

used to make 1 minute time interval. When 1min time interval occurred the software clear the write-eregister. This enable the write to external flash memory

The microcontroller is communicate to external device using i2c protocol. When write-eis cleared, ADC data from PORTA.0,PORTA.1 (digitalized data from ADRESL,ADRESH ) are moved toSSPBUF register one after another with a time interval. Firstly ADRESL of PORTA.0 is loaded, then itshigher byte from ADRESH is loaded. This is same for PORTA.1. Before data send to SSPBUF registers ofi2c should be initialized.sspsat,sspcon,sspcon2 are the registers of i2c communication protocol . aftercorresponding values are loaded to that registers the first byte is loaded to SSPBUF. Then i2ccommunication is initialized. The clock to external device can be through SCL & data through SDA.initially higher bytes are transmitted. In i2c communication initially a START bit is transmitted (initiallySDA become high to low, then SCL become high to low) then address of receiving device (flash memorychip) is send alone with information about what operation should perform(read/write , here write) as 8th bit,if acknowledgement is receive from memory chip higher order address in device where data is to be savedis send , after receiving ACK lower order address will send, after receiving ACK each data byte will sendone by one only after receiving ACK between each byte transfer. Finally send a STOP (initially SCLbecome low to high then SDA ) bit to indicate completion of one data transfer. this cycle is repeat for eachclearing of write-e register.

During the entire operation microcontroller continuously checking PORTD for findingany key press. The PORTD should be set as input port by setting TRISD to one. There are three switches forsolar recorder one is connect to reset pin of pic so software not has to bother about it if this key is pressdevice is automatically reset and execution is start from beginning. There are two other key they are pluskey and minus key. If plus key is press i2c communication is initialize as explained earlier and set PORTCas input by setting TRISC. The only difference is instead of writing reading will occur from the nextlocation where the data is currently displayed. Four bytes( volt-H,volt-L,temp-H,temp-L ) are transferredfrom flash memory chip to microcontroller. Then this is displayed on the second line of the LCD. The orderof display is voltage, temperature, memory location from read occur. If the pressed key is minus key theoperation is same but the only difference is instead of reading from next location, the data is read from theprevious location. If minus key is press the software will check that the current location is 00. If it is true itwill display the data on the current location. In case of plus key press if address pointed is the locationwhere last data is stored, then data on that location will display. On External memory read operation Theclock to external device can be through SCL & data from SDA. Initially higher bytes are transmitted. In i2ccommunication initially a START bit is transmitted (initially SDA become high to low, then SCL becomehigh to low) then address of receiving device (flash memory chip) is send alone with information about whatoperation should perform(read/write, here read) as 8th bit, if acknowledgement is receive from memory chiphigher order address in device where data is to be taken is send , after receiving ACK lower order addresswill send, after receiving ACK each data byte will send one by one by memory chip to pic only afterreceiving ACK between each byte transfer to memory chip from pic.. Finally send a STOP (initially SCLbecome low to high then SDA ) bit to indicate completion of one data transfer.

Page 48: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 48

Department of electronics and communication College of engineering kidangoor

The next main section is the interface with external devices especially the computer. The serialcommunication unit is connect to PORTC (PORTC.6,PORTC.7). So for receiving data from external deviceset PORTC as input by setting TRISC and for sending data to external devices clearing TRISC. By sendingany character except ‘c’ device should send all data from external flash memory to computer and it is continuously upto device become off. If character ‘c’ is send software should clear theflash memory. Infirst case when a character except ‘c’ is receive. The software have to initialize i2c reading as explained earlier. Read data from location 00 to the last location where data write occur This process shouldcontinuous upto the device made off or external device ends the communication process. When a character‘c’ is receive software should clear the flash memory by sending 00 or by hardware clearing.

These are the main operations done by the software of solar recorder. There are someadditional tasks are to be handled by the software. They are introduced for the protection of device and forsafety of program execution.

Page 49: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 49

Department of electronics and communication College of engineering kidangoor

3 PCB LAYOUT

Page 50: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 50

Department of electronics and communication College of engineering kidangoor

4 APPLICATIONS

1. The solar recorder can be used as a intensity meter for light intensity measurements with high accuracy

2. It can be used as a digital thermometer for high accuracy temperature measurements

3.It can be used as an intensity recorder for long range measurements upto 6 months. The data can besecured for ten years

4.It can be used as a temperature recording instrument and the data can be stored upto ten years.

5. By measuring and recording the temperature and intensity of light for long periods we can analyze that,that particular place can be used for solar electric power generating station.

.6.The solar recorders can be interfaced with computers and can be controlled by them. So we can extendthe storage memory and can be interfaced with a network.

7. By measuring the temperature and intensity we can maintain the necessary atmospheric conditions for theagricultural field ,medical field ,film industry etc.

8.The peripherals of the circuit have a wide range of operating temperature. So we can sense the intensityand temperature in places where human cannot reach

9.By including a few multiplication step we can convert this device into solar power recorder for powermeasurement.

10.By measuring the continuous temperature values for a long period we can easily get an idea about theglobal warming rate by plotting a graph.

11.It can be used for the study of any radiation which can produce photoelectric effect and/or temperaturevariation.

12. It is a real time embedded system so it can be used for real time controlling.

Page 51: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 51

Department of electronics and communication College of engineering kidangoor

5 ADVANTAGES

1. Solar recorders are very cheap as compare with other solar recorders which using pyranometer asintensity sensors.

2. LM35 is used in this circuit which is more linear than thermistor which increase accuracy of this circuit.

3. This circuit use pic16f877a as microcontroller which has internal ADC, port for serial communication andmore protection circuits as compared to other microcontrollers (8051) which reduces the number of externalperipherals and hence reduces the size of the circuit

4.Microcontroller, the other peripherals required only +5v power supply this reduces the power usage sothis circuit require battery (9-30v) for driving the circuit this again reduces the cost.

5. Microcontroller has 8kb of internal program memory so there is no need for external memory.

6. Solar recorder has external flash memory of 512kb which can be extended up to 1MB of permanentstorage of data this help to increase the continuous working up to 1 year.

7. By interfacing with computer, we can extend storage space into a large extend

8. Small size of the embedded system made it more reliable , it is very easy to handle

9.Display unit (LCD display) need only low power and it have an internal light source which make it to usein low light area.

10. Using a computer interface through USART software of solar recorder can be modified to addadditional functions.

11. The solar recorder only using bellow 50% of output port so hardware modification of solar recorder ispossible

12. The wide range of operating range of sensors (LM35 (-55 to+155c) make it possible to operate in widerange of environment parameters.

Page 52: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 52

Department of electronics and communication College of engineering kidangoor

6 PRECAUTIONS

1. Temperature to be measured should be lies between -55 & 155 for accurate measurement andfor the safety of temperature sensor (LM35)

2. Use of reset switch should be minimize to minimize the power usage.3. Power supply applied should be between 9V and 100v for safety operation of solar recorder

(flash memory chip & microcontroller). So battery checking and replacing should be done atregular intervals. if input voltage is more than 100V it should destroy the capacitors of circuit.If the input voltage is bellow 9V the voltage regulator unable to produce +5V.That create errorsin operation of device.

4. The memory chip have a maximum capacity to store upto 6 months, so it should be replaced ordata should saved to computer and clear the memory to avoid the erroneous recording of data.

5. There is no protection is provided for the safety of sensor unit for maximum accuratemeasurement. So special care should be taken for the safety of sensors (solar panel & LM35).

6. In modification of software some precautions are to be taken, that is the modification not affectthe booting program and the main part of the program.

7. There is no switch provided to control the power supply. So external switch is connected forsafety turn of and turn on.

8. There is a time delay is provided between power supply on and turn on of individualcomponents of solar recorder for safety and accurate operation of device. So key press andcontrolling through serial port should be given only after the display unit display the currentvalue that the sensor measured.

Page 53: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 53

Department of electronics and communication College of engineering kidangoor

7 CONCLUSION

Solar energy is the main renewable source of energy . But it have many disadvantages whichare harmful for human beings. So the detecting and recording of solar energy have a great importance incoming years to control use and handle the solar radiation (solar energy). This system is easy to implementand have a wide range of applications.

This system provide accurate output values for a wide range of environmental conditions..this makesolar recorder to use in areas where human can’t directly reach. This make this embedded system as one of the best human friend.

Page 54: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 54

Department of electronics and communication College of engineering kidangoor

8 Reference

a. Microchip reference manual DS30292B from www.Microchip.comb. Fairchild reference manual KA78XX/KA78XXA from www.fairchildsemi.comc. Atmel reference manual 5297A from www.atmel.comd. National semiconductor reference manual DS005516 from www.national.come. Microchip reference manual DS00826A from www.microchip.comf. www.atmel.comg. Microchip reference manual DS30292C from www.microchip.comh. Microchip reference manual DS41159Cfrom www.microchip.comi. Reference manual AXE033 from www.rev-ed.co.uk

.

Page 55: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 55

Department of electronics and communication College of engineering kidangoor

9 APPENDIX

a. COST ESTIMATION

ITEM

SL No.

QUANTITY PART No. COST

ELECTRONIC COMPONENTS

1

2

3

4

5

6

7

8

9

10

11

12

1

1

1

1

20

15

6

2

1

2

1

4

Microcontroller pi16f877a

LM 7805

24lc512

RS232

Resistors

Capacitors

Diode

LED

LM35

Solar panel

LCD Module

Crystal Oscillator

Rs. 170

Rs. 10

Rs. 300

Rs 20

Rs.5

Rs. 40

Rs. 3

Rs. 1

Rs18

Rs.300

Rs. 140

Rs. 32IC SOCKETS

Page 56: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 56

Department of electronics and communication College of engineering kidangoor

1

2

3

4

2

2

2

2

40 Pin

18 Pin

8 Pin

6 Pin

Rs. 10

Rs. 10

Rs. 10

Rs. 10

ELECTRICAL COMPONENTS

1

2

3

4

1

2

1

10 m.

Transformer 12-0-12 V

Bread Board

Power Cord

Single Strand Wire

Rs. 95

Rs. 160

Rs. 80

Rs. 30REPORT

1

2

3

4

5

Text Book For Microcontroller

Print outs

Photostat

CD

Scanning Emblem

Rs. 320

Rs. 500

Rs. 50

Rs. 20

Rs. 20

Page 57: project report - solar recorder

M i n o r p r o j e c t r e p o r t S O L A R R E C O R D E R | 57

Department of electronics and communication College of engineering kidangoor


Recommended