0% found this document useful (0 votes)
20 views58 pages

Report On Solar Panels

Uploaded by

singhakaustav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views58 pages

Report On Solar Panels

Uploaded by

singhakaustav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 58

CHAPTER

1
INTRODUCTION

IoT is one of the most buzzing words in industrial automation, remote monitoring,
sensing etc. The industrial revolution 4.0 is emphasising on IoT. It is emerging into
healthcare, automobile industries, retail as well as industrial automation.

1.1 Solar Panel System

The solar panel is the primary element for solar energy system which converts
the solar energy into electrical energy to drive electrical or electronic equipment as
well as charge the battery for further use. The efficiency of solar plate is depending on
many issues like the environmental conditions like rainy, cloudy, day as well as the
dust in the environment. The efficiency of solar panel thus reduce due to the over
temperature of the solar plate. The thickness of dust on the solar plate also affects the
efficiency. For large solar plate system it is necessary to monitor and maintain the
different parameters of the environment as well as solar panel to get the optimised
output. There are manual as well as local monitoring systems available in the market
but an efficient system is highly necessary to monitor remotely. Apart from remote
monitoring we can store relevant data on a centralised location.

In general remote monitoring systems have to fetch, analyze, transmit, manage


and feedback the remote information by utilizing the most advanced science and
technology field of communication and other areas.

Using the IoT technology for supervising solar photovoltaic power generation
can greatly enhance the performance, monitoring and maintenance of the plant. With
advancement of technologies the cost of renewable energy equipments are going
down globally encouraging large scale photovoltaic installations. This massive scale
photovoltaic deployment requires sophisticated systems for automation of the plant
monitoring remotely using web based interfaces as majority of them are installed in
inaccessible locations and thus unable to be monitored from a distant location. The
discussion of this paper is based on implementation of new cost effective
1
methodology based on IoT to remotely monitor a solar photovoltaic plant
performance evaluation.

1.2 Basic Block Diagram

Figure 1.1 The basic block diagram of the project work.

2
1.3 Objectives

The main aim of this project is based on implementation of new cost effective
methodology based on IoT to remotely monitor and control a solar photovoltaic
system parameters like voltage, current and temperature displayed on LCD by using
IoT technology for performance evaluation and to store these data for future data
analysis . Also this will help to get an optimum power output from solar panels during
dust accumulation on it for future study. The other objective of this project is to study
the solar geometry of a particular location (Assam Engineering College, Jalukbari in
this project) and compare the theoretical and analytical data and examine the
variations that occur on solar panel using IoT based monitoring of solar photovoltaic
system.

3
CHAPTER

LITERATURE REVIEW

1. Paper1: Solar energy monitoring system using IoT

SUPRITA PATILAL, M. VIJAYALASHMI AND RAKESH TAPASKAR, School of


Computer Science & Engineering, KLE Technological University, Hubballi,
Karnataka,

Figure 2.1 System Design

The author in this particular paper is implementing the current and the reference
voltage of the solar panel. At the same time, the author is using the Arduino to
implement the concept. But Arduino is not a suitable product for industrial use due to
cost and efficiency. At the same time, it doesn’t support serial interrupt, this system
will not an optimised beginning. In our proposed system, we have decided to add the
features to monitor the temperature of the solar panel surface along with voltage and
current of the solar panel using IoT.

Arduino has an inbuilt 10-bit ADC. But for much more accuracy and reliability of
analog-digital data conversion 12-bit ADC is 4 times efficient than 10-bit Arduino.
Hence we have decided to use raw microcontroller along with external 12-bit ADC
instead of Arduino.The author of this paper is implementing a Raspberry Pi (RPi) as a

4
web server. But when we use RPi as web server, the primary limitation is the storage
capacity. If we have to implement or use a system for industrial or commercial use,
the size of RPi data is to be stored in SD card only which is also having the issue of
data reliability.

The RPi implementation also increases the cost of devices per unit. The
system described in this paper will cost minimum of Rs. 5500 only for the RPi and
Arduino.

So instead of using RPi, we are planning to use ESP8266 which just costs
Rs.300-400 compared to Rs 5500 RPi.

After studying the paper, we have come to the point that the solution provided
by author is not cost effective.

2. Paper 2: Implementation of solar photovoltaic data monitoring system;

Wai Mar Myint Aung, Yadanar Win, Nay Win Zaw

Figure 2.2 The monitoring system structure of photovoltaic data

The author in this paper is monitoring the current, voltage sensors along with
temperature and light sensors. But the primary drawback of the system is the storage.
This system is not focusing on storing the data for future use. It can only display the
current data. The problem with this system is that it is not having any remote
monitoring system. Hence the person has to be physically present for monitoring.

5
3. PAPER 3: Monitoring System for Solar Panel Using Smartphone Based on
Microcontroller

R. F. Gusa, Department of Electrical Engineering, Universitas Bangka Belitung,


Bangka, Indonesia. E-mail:[email protected]

Figure 2.3 Diagram block of monitoring system

The main goal of this paper is to develop an equipment to measure the characteristics
of solar panels in real time and send the measured result parameters to android based
smart phone.

In this paper author is transmitting the data through Wi-Fi to a local smart phone.
Hence it cannot be achieved from remote distance. At the same time it is not using
any feature to store data efficiently.

6
CHAPTER

SOLAR GEOMETRY

Solar Geometry Calculations

Considering the latitude and longitude (26.1426º N, 91.6435º E) of Assam


Engineering College, the various parameters like day length, declination angle, solar
time and hour angle have been calculated.

3.1 Day Length: It is a division of time equal to 24 hours and represents the average
length of the period during which the earth makes one rotation on its axis. It is being
calculated by the formula given below:

Now, a graph is plotted between the day length and the number of days from the table
given below.

Table 3.1 Day Length

7
Number of days (n) Day length (td) (in hours)

15 10.53

46 11.11

74 11.82

105 12.62

135 13.28

166 13.63

196 13.49

227 12.92

258 12.15

288 11.37

319 10.69

349 11.18

From the above data the following graph is obtained:

8
Figure3.1 Plot between day length and the number of days

3.2 Declination Angle: It is defined as the angular displacement of the sun form the
place of the earth’s equator. The declination angle is determined from the following
formula:

Now, based on the following table a graph is plotted between the declination angle
and the number of days.

Table 3.2 Declination Angle

Number of days (n) Declination angle

15 -21.2695

46 -13.2892

9
74 -2.8189

105 9.4149

135 18.7919

166 23.3144

196 21.5173

227 13.7836

258 2.2169

288 -9.5994

319 -19.1478

349 -23.3352

Fig3.2 Plot between the declination angle and the number of days.

10
3.3 Solar time: Solar time is a calculation of the passage of time based on the portion
of the sun in the sky. It is being determined from the following formula:

Now based on the data given the following table a graph is plotted between the solar
time and the number of days.

Table 3.3 Solar Time

Number of days(n) Solar time (in hours)

15 12:28

46 12:22

74 12:27

105 12:36

135 12:40

166 12:36

196 12:31

227 12:26

258 12:42

11
288 12:51

319 12:51

349 12:40:41

Figure 3.3 Plot between solar time and the number of days.

3.4 Hour Angle: The hour angle at any moment is the angle which the earth must
turn to bring the meridian of a point directly in the line with the sun’s rays. The hour
is calculated based on the following formula:

Similarly a graph between the hour angle and the number of days is plotted from the
following data:

Table 3.4 Hour Angle

Number of days (n) Hour angle (in degrees)

15 -7.1

46 -5.5

74 -6.73

104 -9.02

12
135 -10.08

166 -9.13

196 -7.73

227 -6.64

258 -10.55

288 -12.88

319 -12.82

349 -10.1

Figure 3.4 Plot of hour angle and the number of days.

13
CHAPTER

CIRCUIT DIAGRAM AND COMPONENTS

Fig-4.1: Schematic block diagram of the proposed project.

4.1 LM 7805

Voltage sources in a circuit may have fluctuations resulting in not providing


fixed voltage outputs. A voltage regulator IC maintains the output voltage at a
constant value. 7805 IC, a member of 78xx series of fixed linear voltage regulators
used to maintain such fluctuations, is a popular voltage regulator integrated circuit
(IC). The xx in 78xx indicates the output voltage it provides. 7805 IC provides +5
volts regulated power supply with provisions to add a heat sink.

14
7805 IC Rating:

 Input voltage range 7V- 35V


 Current rating Ic = 1A
 Output voltage range
VMax=5.2V ,VMin=4.8V

Fig-4.2: Pin diagram of LM7805

Table 4.1 Pin Details of 7805 IC:

Pin
Pin Function Description
No.

In this pin of the IC


positive unregulated
1 INPUT Input voltage (7V-35V)
voltage is given in
regulation.

2 GROUND Ground (0V) In this pin where the

15
ground is given. This pin
is neutral for equally the
input and output.

The output of the


Regulated output; 5V regulated 5V volt is taken
3 OUTPUT
(4.8V-5.2V) out at this pin of the IC
regulator.

As you may have noticed, there is a significant difference between the input voltage
& the output voltage of the voltage regulator. This difference between the input and
output voltage is released as heat. The greater the difference between the input and
output voltage, more the heat generated. If the regulator does not have a heat sink to
dissipate this heat, it can get destroyed and malfunction. Hence, it is advisable to limit
the voltage to a maximum of 2-3 volts above the output voltage. So, we now have 2
options. Either design your circuit so that the input voltage going into the regulator is
limited to 2-3 volts above the output regulated voltage or place an appropriate
heatsink, that can efficiently dissipate heat.

Application areas for 7805 IC :

7805 IC is used in a wide range of circuits. The major ones being:

 Fixed-Output Regulator
 Positive Regulator in Negative Configuration
 Adjustable Output Regulator
 Current Regulator
 Adjustable DC Voltage Regulator
 Regulated Dual-Supply
 Output Polarity-Reversal-Protection Circuit
 Reverse bias projection Circuit

7805 IC also finds usage in building circuits for inductance meter, phone charger,
portable CD player, infrared remote control extension and UPS power supply circuits.

16
4.2: AT89S52

4.2.1: Introduction:

The AT89S52 is a low-power, high-performance CMOS 8-bit microcomputer with


4K bytes of Flash programmable and erasable read only memory (PEROM). The
device is manufactured using Atmel’s high-density non-volatile memory technology
and is compatible with the industry-standard MCS-51 instruction set and pin out. By
combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89S52
is a powerful microcomputer which provides a highly-flexible and cost-effective
solution to many embedded control applications.

This is a Low Cost Development Board that can be used to quickly evaluate and
demonstrate the capabilities of microcontrollers. The microcontroller is held on a 40
pin IC base provided on the board. In general case a quartz crystal is used to make the
clock circuit. Clock frequency limits (maximum and minimum) may change from
device to device. Standard practice is to use 12 MHz frequency. If serial
communications are involved then it is best use 11.0592 MHz frequency.

The AT89S52 is designed with static logic for operation down to zero
frequency and supports two software selectable power saving modes. The Idle Mode
stops the CPU while allowing the RAM, timer/counters, serial port and interrupt
system to continue functioning. The Power-down Mode saves the RAM contents but
freezes the oscillator disabling all other chip functions until the next hardware reset.

The AT89S52 provides the following standard specifications: 8Kbytes of Flash


Memory, 256 bytes of RAM, 32 programmable I/O lines, three 16-bit timer/counters,
Low-power Idle and Power-down Modes Eight Interrupt Sources, 4.0V to 5.5V
Operating Range, Full Duplex UART Serial Channel, Watchdog Timer, Fast
Programming Time and on-chip oscillator and clock circuitry.

17
Figure 4.3 Pin diagram of AT89S52

4.2.2 Features:

 Compact and ready to use design


 Two layer High Quality PTH PCB.
 Power supply reverse polarity protection.
 5V (1A) and 3.3V (800mA) regulated power output on board.
 Provision to attach mini breadboard on the board.
 I2C interfaced external EEPROM (24C04).

4.3: LCD (Liquid Crystal Display)

4.3.1: Introduction:

A liquid crystal display (LCD) is a flat panel display, electronic visual display,
or video display that uses the light modulating properties of liquid crystals (LCs).
LCDs do not emit light directly.

The display is a standard 2x16 LCD which displays 2 lines of 16 characters.


Each character is 40 pixels, making it 1280 pixels overall. The display receives ASCII
codes for each character at the data inputs (D0–D7). The LCD module can be used in
4-bit or 8-bit mode. This LCD has two registers, namely, Command and Data. The
command register stores the command instructions given to the LCD. A command is

18
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.LCDs are used in a wide range of applications,
including computer monitors, television, instrument panels, aircraft cockpit
displays, signage, etc.

LCDs are more energy efficient and offer safer disposal than CRTs.They are
available in a wider range of screen sizes than CRT and plasma displays, and since
they do not use phosphors, they cannot suffer image burn-in. Its low electrical power
consumption enables it to be used in battery-powered electronic equipment. It is
an electronically modulated optical device made up of any number of segments filled
with liquid crystals and arrayed in front of a light source (backlight) or reflector to
produce images in color or monochrome. The most flexible ones use an array of
small pixels. Each pixel of an LCD typically consists of a layer of molecules aligned
between two transparent electrodes, and two polarizing filters, the axes of
transmission of which are (in most of the cases) perpendicular to each other. With no
actual liquid crystal between the polarizing filters, light passing through the first filter
would be blocked by the second (crossed) polarizer.The surface of the electrodes that
are in contact with the liquid crystal material are treated so as to align the liquid
crystal molecules in a particular direction.The managing and control of the data to be
displayed is performed by one or more circuits commonly denoted as LCD drivers.

Figure 4.4 LCD


4.3.2: Working Principle:

19
The principle behind the LCD’s is that when an electrical current is applied to the
liquid crystal molecule, the molecule tends to untwist. This causes the angle of light
which is passing through the molecule of the polarized glass and also cause a change
in the angle of the top polarizing filter. As a result a little light is allowed to pass the
polarized glass through a particular area of the LCD. Thus that particular area will
become dark compared to other. The LCD works on the principle of blocking light.
While constructing the LCD’s, a reflected mirror is arranged at the back. An electrode
plane is made of indium-tin oxide which is kept on top and a polarized glass with a
polarizing film is also added on the bottom of the device. The complete region of the
LCD has to be enclosed by a common electrode and above it should be the liquid
crystal matter. Next comes to the second piece of glass with an electrode in the form
of the rectangle on the bottom and, on top, another polarizing film. It must be
considered that both the pieces are kept at right angles. When there is no current, the
light passes through the front of the LCD it will be reflected by the mirror and
bounced back. As the electrode is connected to a battery the current from it will cause
the liquid crystals between the common-plane electrode and the electrode shaped like
a rectangle to untwist. Thus the light is blocked from passing through. That particular
rectangular area appears blank.

4.3.3: Pin diagram of LCD:

Figure 4.5 Pin diagram of LCD


20
Table 4.2 Pin description of LCD:

PIN NO FUNCTION NAME

1 Ground ( 0 V) VSS

2 Supply voltage;5V (4.7-5.3 VDD


V)

3 Contrast adjustment; VEE


through a variable resistor

4 Selects command register RS(Register select)


when low; and data register
when high

5 Low to write to the RW (Read/write)


register; High to read from
the register

6 Sends data to data pins E (Enable)


when a high to low pulse is
given

8-bit data pins


7 D0

8 8-bit data pins D1

9 8-bit data pins D2

10 8-bit data pins D3

11 8-bit data pins D4

12 8-bit data pins D5

13 8-bit data pins D6

14 8-bit data pins D7

21
CHAPTER

SENSORS

5.1 DIGITAL THERMOMETER: DS18B20

5.1.1 Description
The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius
temperature measurements and has an alarm function with nonvolatile user-
programmable upper and lower trigger points. The DS18B20 communicates over a 1-
Wire bus that by definition requires only one data line (and ground) for
communication with a central microprocessor. It has an operating temperature range
of -55°C to +125°C and is accurate to ±0.5°C over the range of -10°C to +85°C. In
addition, the DS18B20 can derive power directly from the data line (“parasite
power”), eliminating the need for an external power supply.
Each DS18B20 has a unique 64-bit serial code, which allows multiple
DS18B20s to function on the same 1-Wire bus. Thus, it is simple to use one
microprocessor to control many DS18B20s distributed over a large area. Applications
that can benefit from this feature include HVAC environmental controls, temperature

22
monitoring systems inside buildings, equipment, or machinery, and process
monitoring and control systems.

5.1.2 Features
 Unique 1-Wire® Interface requires only one port pin for communication.
 Each Device has a unique 64-bit serial code stored in an on-board ROM.
 Multidrop capability simplifies distributed temperature-sensing-applications.
 Requires no external components.
 Can be powered from data line; power supply range is 3.0V to 5.5V.
 Measures temperatures from -55°C to +125°C (-67°F to +257°F).
 ±0.5°C accuracy from -10°C to +85°C.
 Thermometer resolution is user selectable from 9 to 12 bits.
 Converts temperature to 12-Bit digital word in 750ms (Max).

5.1.2: 1-wire bus system:


The 1-Wire bus system uses a single bus master to control one or more slave devices.
The DS18B20 is always a slave. When there is only one slave on the bus, the system
is referred to as a “single-drop” system; the system is “multidrop” if there are multiple
slaves on the bus.
All data and commands are transmitted least significant bit first over the 1-Wire bus.
The following discussion of the 1-Wire bus system is broken down into three topics:
hardware configuration, transaction sequence, and 1-Wire signalling (signal types and
timing).

5.1.3: Transaction Sequence:


The transaction sequence for accessing the DS18B20 is as follows:
Step 1. Initialization
Step 2. ROM Command (followed by any required data exchange)
Step 3. DS18B20 Function Command (followed by any required data exchange)
It is very important to follow this sequence every time the DS18B20 is accessed, as
the DS18B20 will not respond if any steps in the sequence are missing or out of order.
Exceptions to this rule are the Search ROM [F0h] and Alarm Search [ECh]
commands. After issuing either of these ROM commands, the master must return to
Step 1 in the sequence.

23
5.1.4-Rom Commands:

5.1.4.1: SKIP ROM [CCh]


The master can use this command to address all devices on the bus simultaneously
without sending out any ROM code information. For example, the master can make
all DS18B20s on the bus perform simultaneous temperature conversions by issuing a
Skip ROM command followed by a Convert T [44h] command.
Note that the Read Scratchpad [BEh] command can follow the Skip ROM command
only if there is a single slave device on the bus. In this case, time is saved by allowing
the master to read from the slave without sending the device’s 64-bit ROM code. A
Skip ROM command followed by a Read Scratchpad command will cause a data
collision on the bus if there is more than one slave since multiple devices will attempt
to transmit data simultaneously.

5.1.4.2: FUNCTION COMMANDS:

CONVERT T [44h]
This command initiates a single temperature conversion. Following the conversion,
the resulting thermal data is stored in the 2-byte temperature register in the scratchpad
memory and the DS18B20 returns to its low-power idle state. If the device is being
used in parasite power mode, within 10μs (max) after this command is issued the
master must enable a strong pull-up on the 1-Wire bus for the duration of the
conversion (tCONV) as described in the Powering the DS18B20 section. If the
DS18B20 is powered by an external supply, the master can issue read time slots after
the Convert T command and the DS18B20 will respond by transmitting a 0 while the
temperature conversion is in progress and a 1 when the conversion is done. In parasite
power mode this notification technique cannot be used since the bus is pulled high by
the strong pull-up during the conversion.

READ SCRATCHPAD [BEh]


This command allows the master to read the contents of the scratchpad. The data
transfer starts with the least significant bit of byte 0 and continues through the
scratchpad until the 9th byte (byte 8 – CRC) is read. The master may issue a reset to
terminate reading at any time if only part of the scratchpad data is needed.

24
5.2 CURRENT SENSOR ACS712:

5.2.1: Features and Benefits:


▪ Low-noise analog signal path
▪ Device bandwidth is set via the new FILTER pin
▪ 5 μs output rise time in response to step input current
▪ 80 kHz bandwidth
▪ Total output error 1.5% at TA = 25°C
▪ Small footprint, low-profile SOIC8 package
▪ 1.2 mΩ internal conductor resistance
▪ 2.1 kV RMS minimum isolation voltage from pins 1-4 to pins 5-8
▪ 5.0 V, single supply operation
▪ 66 to 185 mV/A output sensitivity
▪ Output voltage proportional to AC or DC currents
▪ Factory-trimmed for accuracy
▪ Extremely stable output offset voltage
▪ Nearly zero magnetic hysteresis
▪ Ratiometric output from supply voltage

5.2.2: Description:
The Allegro ACS712 provides economical and precise solutions for AC or DC
current sensing in industrial, commercial, and communications systems. The device
package allows for easy implementation by the customer. Typical applications include
motor control, load detection and management, switch mode power supplies, and over
current fault protection. The device is not intended for automotive applications. The
device consists of a precise, low-offset, linear Hall circuit with a copper conduction
path located near the surface of the die. Applied current flowing through this copper
conduction path generates a magnetic field which the Hall IC converts into a
proportional voltage. Device accuracy is optimized through the close proximity of the
magnetic signal to the Hall transducer. A precise, proportional voltage is provided by
the low-offset, chopper-stabilized BiCMOS Hall IC, which is programmed for
accuracy after packaging. The output of the device has a positive slope when an
increasing current flows through the primary copper conduction path (from pins 1 and
2, to pins 3 and 4), which is the path used for current sampling. The internal resistance
of this conductive path is 1.2 mΩ typical, providing low power loss. The thickness of

25
the copper conductor allows survival of the device at up to 5× over current conditions.
The terminals of the conductive path are electrically isolated from the signal leads
(pins 5 through 8). This allows the ACS712 to be used in applications requiring
electrical isolation without the use of opto-isolators or other costly isolation
techniques.

CHAPTER

CIRCUIT DESCRIPTION

The system that we are designing for monitoring various parameters of


photovoltaic system, we are using easily available and popular component. The heart
of the circuit is an 8-bit microcontroller AT89S52 from ATMEL, to display the
parameter we are using a 16x2 LCD, to measure the temperature of the photovoltaic
system we are using DS18B20 digital temperature sensor and for converting current
and voltage into digital form 12-bit ADC and MCP3204 and a current sensor ACS712
are used.

The system will get the power from the battery which will be charged by the
solar plate. If we use a charger, the battery or the photovoltaic system will give us
maximum of 12V and 13.7V but most of the component used in the circuit i.e.
microcontroller, LCD, ADC, current sensor and the temperature sensor required
regulated +5V. Hence, we are using a voltage regulator 7805. 7805 is having 3
terminals, pin-1 is input, where we can give +5V to +18V (regulated or unregulated),
pin no-2 is ground and pin no-3 is regulated output. Irrespective of input voltage at

26
pin no-1(+5V to+10V) the output voltage at pin no-3 is always +5V. Though we will
not have ripple in our circuit if we power the system with battery still we have used
two ceramic capacitor of value of 100 nF (c4 and c5) from pin no-1 and 3 to ground.

The microcontroller that we are using in our circuit is having 40 pin including
32 input/output pin. Pin 40 of AT89S52 is Vcc and pin 20 is grounded. According to
data sheet AT89S52 can operate i.e. at minimum 4V to 5.5V. Typically 5V is used,
hence pin no. 40 and 20 of the microcontroller are not displayed in the circuit diagram
as Proteus does not display certain pin where pin no. 40 and 20 are hidden in Proteus
model.

Any microcontroller or microprocessor need clock sources to fetch


instructions and execute it. Few of the microcontrollers has internal oscillator like
ATMEGA 8, ATMEGA 16, ATMEGA 32, and some of PIC family. But, AT89S52
does not have any internal oscillator. Hence we must have to use external oscillator or
clock source. According to the data sheet AT89S52 can operate upto 33MHz, but we
use 11.0592 MHz crystal in our circuit. This odd number of crystal value is very
much in important to generate error free baud rate for error free communication. As
we have to establish the serial connectivity between the microcontroller and the Wi-Fi
modem we have to use 11.0592MHz. Parallel to the crystal oscillator i.e. at pin no. 18
and 19 two ceramic capacitors of 33 pF is added. According to data sheet these c1 and
c2 could be anything in between 20-40 pF. (30+10pF).

Pin no. 9 of AT89S52 is reset pin. According to data sheet if we provide high
(2.6V to 5.5V) at pin no. 9 for two machine cycles (12x2= 24 clock pulse) the device
will restart and for normal operation pin no. 9 must be pulled down. Hence a 10k
resistor (R1) is connected from pin no. 9 to ground. To create the reset circuit a push
to ON momentarily tactile switch across pin 9 and Vcc.

Pin no. 31 is EA. According to data sheet AT89S52 has internal 8kb of flash
memory and 256 byte of RAM. But if we need more than that either we have to
replace the microcontroller with another one which has more resources or we can use
external memory. The pin no. 31 represents whether we are using internal or external
memory. If we have to use internal memory pin no. 31 must be pulled up or connected
to Vcc, and if we have to use external memory pin no. 31 must be connected to

27
ground. As we are using internal memory of the microcontroller pin no. 31 is
connected to Vcc in our circuit.

To display the various parameter and information related to the project work
we are using 16x2 LCD module. The module is having 16 pin. Pin no. 1, 2, 3 are
ground, Vcc and contrast control.

Pin no-1 is connected to ground, pin no-2 is connected to +5 v. we are using a


potentiometer of value 10k (RVI) to adjust the contrast. The centre terminal of the
potentiometer is connected to pin no-3, one terminal is connected to +5V and other
terminal is connected to ground. By rotating the potentiometer clockwise and
anticlockwise we are adjust the contrast of the LCD.

Pin no-4, 5, 6 are RS, RW and EN respectively. The RS pin is used to specify
register selector. At the time of writing or sending command from microcontroller to
LCD, RS pin must be pulled down(RS =0) on the other hand, at the time of sending
data from microcontroller to LCD RS pin must be pulled up(RS =1).

The RW pin is to specify read/write mode. At the time of writing


data/command from microcontroller to LCD, RW pin must be pulled down(RW=0),
on the other hand at the time of reading acknowledgement or busy bit(D7) from the
LCD, RW pin must be pulled up(RW=1).

The EN pin is used to provide a high low pulse during or after providing data
or command from microcontroller to LCD.

The RS, RW and EN pin of the LCD are connected to P0.0, P0.1 and P0.2 i.e.
pin no. 39, 38 and 37 of AT89S52respectively.

AT89S52 is having 4 input/output port P0, P1, P2 and P3. The internal pull-
up of P1, P2 and P3 are activated, but the internal pull-up of P0 is not activated.
Hence we must have to use external pull up, if any input pin of port 0 is used. As we
are using P0.0, P0.1, P0.2 to provide RS, RW and EN signal to the LCD, we are using
three 10k resistors R2, R3 and R4 connected from Vcc to these pins as external pull-
up.

Pin no. 7 to pin no. 14 of LCD are data/command bus. The command/data has
to be sent through these pins. We are using P1 of AT89S52 for data/command

28
transfer, hence pin no. 1 to pin no. 8 of the microcontroller is connected to pin no. 7 to
pin no. 14 of the LCD module. An LCD can be used either in 4- bit mode or in 8-bit
mode. In the project work we are using 8-bit mode hence all 8 lines are connected.

Pin no. 15 and 16 of the LCD module are used for providing power supply to
the backline of the LCD. Pin no. 15 is marked as A and 16 is marked as K. In some
module instead of using K an A, it is marked with BL+ and BL- or LED+ and LED-.
At pin no. 15 we are providing regulated +5V and pin no. 16 is connected to the
ground.

6.1: DS18B20:

To detect the temperature of the solar plate we are using digital temperature sensor
DS18B20. Instead of DS18B20 we could have used LM35 which is less expensive
but requires ADC as it is analog sensor. DS18B20 is a digital temperature sensor from
integrated ( DALAS semi-conductor) DS18B20 can measure from -55 ºC to +125º C.
It can be configured to work from 9 bit to 12 bit mode. The communication between
DS18B20 to the microcontroller required 1 wire communication protocol. Unlike
LM35, DS18B20 has a set of commands primarily classified into ROM command and
data conversion and read command. Using the semi wire, the micro-controller need to
provide/send specific command to perform the operation and through the same wire it
returns the data. At the time of transferring command we need to transfer 8-bit data
but we use the DS18B20 with 9-bit data, 9 consecutive bit has to be read from the
sensor stored in microcontroller memory and convert into human understandable
decimal value.

When we use DS18B20, it has unique 64-bit address i.ie. every sensor has a unique
ROM address. As we have separate address for every sensor it implement a technique
called multi-drop communication where multiple sensors can be connected with a
single wire to a single input/output pin. To read the data properly we must have to
specify the ROM address. But if we use only one temperature sensor we can skip
ROM address. DS18B20 is having a command 0XCC which will skip the ROM
address.

29
When we use ADC every conversion require a specific amount of time DS18B20
require maximum 750 ms to convert a data for 12-bit temperature conversion. Though
it is having many commands related to ROM operation we just need very few
command for single sensor interfacing.

To get the temperature value the microcontroller need to send a conversion request
which will convert the temperature into digital form and store in internal scratch pad.
To start the conversion the microcontroller need to send 0X44, similarly to read the
converted data from scratch pad the microcontroller need to send 0XBE. Once
DS18B20 responds to these command it will start transferring a sequence of bit to the
microcontroller which has to combined together as a byte and transfer into decimal
data. In our circuit we are using P2.7 (pin 28) of the microcontroller to interface
DS18B20. According to data sheet, the DS18B20 input/output pin is open drain type,
hence it is needed to use an external pull up. A 4.7 K RS is connected from +5V to
pin no. 2(DQ) of the temperature sensor.

Our project work is also associated with finding the voltage and the current of the
solar plate at the real time. The voltage and current both are analog. Hence we must
have to use ADC to determine the voltage and current of the sensor. Few micro-
processors have inbuilt ADC but AT89S52 is not having internal ADC, hence we
must use external one. There are number of ADC available to interface with the
micro-controller. The accuracy and the performance of an ADC depends on the output
present by how many bits. We are using MCP3204 in our circuit. It is a 12-bit ADC
with 4 independent input channel. As it is 12-bit ADC will have 1.22 per step with
reference to 5V which is much more accurate than 10-bit ADC of Arduino.

The MCP3204 is SPi type ADC, i.e. instead of parallel multiple lines only, 4 wire
need to be connected with the micro-controller. In case of SPi communication
primarily it has MOIS,MIOS,CLK and RST pin. But the manufacturer of MCP3204
(µchip) they used DIN and DOUT instead of MOSI and MISO respectively. In the
circuit, the CS /SHPN, DIN,DOUT and CLK are connected to pin 24,23,22 and 21 of
the micro-controller.

The MCP3204 require +5V, hence Vcc pin (pin 14) is connected to +5V, pin (GND)
is connected to ground, pin number 12 and 13 represent GND and Vref. The Vref pin
is used to provide referral voltage for conversion. At Vref maximum 5V can be given,

30
but if we have to work with low input voltage at the input channel Vref can be
changed accordingly. As we are using 5V output sensor Vref is connected to +5V.

To measure the voltage and the current we need voltage and current sensors. For
voltage we use a voltage divider circuit. When we use solar plate every solar plate
have its maximum output voltage. Solar plate that are using in this project providing
us 17.85 maximum voltage. But ADC can handle maximum 5 volts as its input. So its
not possible to connect the ADC to the solar plate directly. Thats why voltage divider
is used so that ADC will get 5 volts as its input.When we use voltage divider circuit it
is primarily based on simple calculation [R2/R1+R2(Vin-Vout)]. Here we are using a
10k potentiometer where 1st half is used as R1 and 2 nd half is used as R2. By rotating
the potentiometer in clockwise and anticlockwise we can change the value of R1 and
R2 which in turn give a desired output. So we set the potentiometer in such a way that
at 17.85 voltage the output of potential voltage divider circuit wii be 5 volts. In the
voltage divider circuit we are also using a zener diode of 5.1 voltS. It is used to save
the ADC from overvoltage . When Vin is more than 5.1 volts, breakdown occurs in
zener diode and in this way it save the ADC.

For current sensor we are having popular current sensor ACS712 from Allegro but
we do not have any voltage sensor module, hence we are using a voltage divider
circuit in such a way that at any condition ADC input pin will not get more than 5V.
Otherwise the ADC pin will be permanently damaged. We are planning to use a 20W,
17.08V (max) output solar plate for experimental purpose hence we have to use a
voltage divider circuit to reduce the 17.08 V to almost 5V. The output of the voltage
sensor is connected to CHO of MCP3204. The program executing in the micrto-
contoller is responsible for reading the voltage output of the voltage divider circuit
through the ADC and nap the voltage level 0.5 into 0-17.08 V.

To measure the current of the solar plate we have to add resistive load parallel to the
solar panel output, Otherwise it is not possible to measure the current. For
experimental purpose either we can connect a resistance or a small load or the output
can be connected to a solar charger. To measure the current, current sensor need to
placed in series of a closed circuit. ACS712 is based on Hall Effect sensor. When
current flows through the sensor it experiences electromagnetic field, in return it gives
us different voltage level from the sensor output. ACS712 is designed to give both AC

31
and DC current. Hence, we may have to deduct the offset value from the calculated
voltage and divided by the sensitivity factor. ACS712 comes with 3-variant (5A,20A
and 30A). In case of 5A sensor we must have to divide the result 185, for 20A model
it has to divided by 100 and for 30A model we have to divide by 66. As we are using
5A variant, the resultant voltage is divided by 185 to get the current. The calculated
temperature, current and voltage are displayed in 16X2 LCD.

32
CHAPTER

IOT (INTERNET OF THINGS)

7.1: Introduction:

The Internet of Things (IoT) is a system of interrelated computing devices,


mechanical and digital machines, objects, animals or people that are provided with
unique identifiers and the ability to transfer data over a network without requiring
human-to-human or human-to-computer interaction. The IoT allows objects to be
sensed or controlled remotely across existing network infrastructure, creating
opportunities for more direct integration of the physical world into computer-based
systems, and resulting in improved efficiency, accuracy and economic benefit in
addition to reduced human intervention. When IoT is augmented with sensors and
actuators, the technology becomes an instance of the more general class of cyber-
physical systems, which also encompasses technologies such as smart grids, virtual
power plants, smart homes, intelligent transportation and smart cities.

Figure 7.1 IoT (Internet of things)

7.2: Background of IoT:

As of 2016, the vision of the Internet of things has evolved due to a convergence of
multiple technologies, including ubiquitous wireless communication, real-
time analytics, machine learning, commodity sensors, and embedded systems .This

33
means that the traditional fields of embedded systems, wireless sensor networks,
control systems automation (including home and building automation), and others all
contribute to enabling the Internet of things.

The concept of a network of smart devices was discussed as early as 1982, with a
modified Coke machine at Carnegie Mellon University becoming the first Internet-
connected appliance, able to report its inventory and whether newly loaded drinks
were cold. Mark Weiser's seminal 1991 paper on ubiquitous computing, "The
Computer of the 21st Century", as well as academic venues such as UbiComp and
PerCom produced the contemporary vision of IoT. In 1994 Reza Raji described the
concept in IEEE Spectrum as "[moving] small packets of data to a large set of nodes,
so as to integrate and automate everything from home appliances to entire
factories". Between 1993 and 1996 several companies proposed solutions
like Microsoft's at Work or Novell's NEST. However, only in 1999 did the field start
gathering momentum. Bill Joy envisioned Device to Device (D2D)communication as
part of his "Six Webs" framework, presented at the World Economic Forum at Davos
in 1999.

The concept of the Internet of things became popular in 1999, through the Auto-ID
Center at MIT and related market-analysis publications. Radio-frequency
identification (RFID) was seen by Kevin Ashton (one of the founders of the
original Auto-ID Center) as a prerequisite for the Internet of things at that
point. Ashton prefers the phrase "Internet for things." If all objects and people in daily
life were equipped with identifiers, computers could manage and store them. Besides
using RFID, the tagging of things may be achieved through such technologies as near
field communication, barcodes, QR codes and digital watermarking.

In its original interpretation, one of the first consequences of implementing the


Internet of things by equipping all objects in the world with minuscule identifying
devices or machine-readable identifiers would be to transform daily life. For instance,
instant and ceaseless inventory control would become ubiquitous. A person's ability to
interact with objects could be altered remotely based on immediate or present needs,
in accordance with existing end-user agreements. For example, such technology could
grant motion-picture publishers much more control over end-user private devices by
remotely enforcing copyright restrictions and digital rights management, so the ability

34
of a customer who bought a Blu-ray disc to watch the movie could become dependent
on the copyright holder's decision, similar to Circuit City's failed DIVX.

A significant transformation is to extend "things" from the data generated from


devices to objects in the physical space. The thought-model for future interconnection
environment was proposed in 2004. The model includes the notion of the ternary
universe consists of the physical world, virtual world and mental world and a multi-
level reference architecture with the nature and devices at the bottom level followed
by the level of the Internet, sensor network, and mobile network, and intelligent
human-machine communities at the top level, which supports geographically
dispersed users to cooperatively accomplish tasks and solve problems by using the
network to actively promote the flow of material, energy, techniques, information,
knowledge, and services in this environment .This thought model envisioned the
development trend of the Internet of things.

7.3: How IoT works

The Internet of Things (IoT), also sometimes referred to as the Internet of Everything
(IoE), consists of all the web-enabled devices that collect, send and act on data they
acquire from their surrounding environments using embedded sensors, processors and
communication hardware. These devices, often called "connected" or "smart" devices,
can sometimes talk to other related devices, a process called machine-to-
machine(M2M) communication, and act on the information they get from one
another. Humans can interact with the gadgets to set them up, give them instructions
or access the data, but the devices do most of the work on their own without human
intervention. Their existence has been made possible by all the tiny mobile
components that are available these days, as well as the always-online nature of our
home and business networks.

Connected devices also generate massive amounts of Internet traffic, including loads
of data that can be used to make the devices useful, but can also be mined for other
purposes. All this new data, and the Internet-accessible nature of the devices, raises
both privacy and security concerns.

But this technology allows for a level of real-time information that we've never had
before. We can monitor our homes and families remotely to keep them safe.

35
Businesses can improve processes to increase productivity and reduce material waste
and unforeseen downtime. Sensors in city infrastructure can help reduce road
congestion and warn us when infrastructure is in danger of crumbling. Gadgets out in
the open can monitor for changing environmental conditions and warn us of
impending disasters.

These devices are popping up everywhere, and these abilities can be used to enhance
nearly any physical object.

36
CHAPTER

WEB TECHNOLOGY

WEB technology refers to the means by which computers communicate with each
other using markup languages and multimedia packages. It gives us a way to interact
with hosted information, like websites. Web technology involves the use of hypertext
markup language (HTML) and cascading style sheets (CSS).

In past few decades, web technology has undergone a dramatic transition , from a few
marked up web pages to the ability to do very specific work on a network without
interruption .

37
CHAPTER

WI-FI COMMUNICATION

9.1: Introduction:

Wi-Fi or Wi-Fi is a technology for wireless local area networking with devices based
on the IEEE 802.11 standards. Wi-Fi is a trademark of the Wi-Fi Alliance, which
restricts the use of the term Wi-Fi Certified to products that successfully
complete interoperability certification testing .Wi-Fi most commonly uses the 2.4
gigahertz UHF and 5.8 gigahertz SHF ISM radio bands. Anyone within range with
a wireless modem can attempt to access the network; because of this, Wi-Fi is more
vulnerable to attack (called eavesdropping) than wired networks. Wi-Fi Protected
Access is a family of technologies created to protect information moving across Wi-Fi
networks and includes solutions for personal and enterprise networks. Security
features of Wi-Fi Protected Access constantly evolve to include stronger protections
and new security practices as the security landscape changes. Increasingly in the last
few years (particularly as of 2007), embedded Wi-Fi modules have become available
that incorporate a real-time operating system and provide a simple means of
wirelessly enabling any device which has and communicates via a serial port. This
allows the design of simple monitoring devices. An example is a portable ECG device
monitoring a patient at home. This Wi-Fi-enabled device can communicate via the
Internet.

9.2: Advantages of Wi-Fi communication:

 Convenient.
 Useful for smart phones, tablet devices and other portable devices to
connect at any convenient location within premises.
 Simplicity
 To connect a new device with a network, simply turn on the Wi-Fi and do
the simple configuration settings.

38
 Mobility.
 Internet can be accessed from anywhere, i.e. Bus, train, coffee-shop,
super market, etc.
 Expandability.
 It is convenient to add more wireless devices with current hardware
settings without any cost and time.
 Efficiency.
 Wi-Fi enabled devices are used at offices for convenient to access their
files at any location and it gives more productivity for the company.
 Cost Control.
 In Wi-Fi network devices can be added without any cost unlike cables
needs to get man power to do the job.
 Standardization of Technology.
 Wi-Fi technology has standardized for all countries, it helps for the
mobile devices to connect the Wi-Fi regardless of the location.

9.3: Limitations of Wi-Fi communication:


 Performance/Speed
 Although Gigabit Wi-Fi is available in the market, we cannot get the
gigabit speed at all locations. Now cable network has 10 GBPS speed.
 Connectivity/Reliability.
 Wi-Fi signal is depends on the interference. i.e. Concrete wall will reduce
the signal strength. Also, there is a limit for distance to connect Wi-Fi
signals.
 Security.
 Wi-Fi router has various encryption methods to secure our network
password.
 Unlicensed spectrum invites congestion from a range of other devices
using the ISM band, from cordless phones to baby monitors, and now
LTE-U cellular service can encroach on the same frequencies.
 Since 802.11n (2009), no new Wi-Fi standard has improved on the
maximum range of 230 feet indoors, and 802.11ac’s throughput
advantages are unremarkable at 100 feet or more.

39
 Wi-Fi throughput is difficult to estimate due to modulation, coding, and
carrier sensing, increasing the information costs of researching hardware
purchases, which leads consumers to buy range extenders that contribute
to spectrum pollution.
 Another new standard is always just on the horizon, encouraging planned
obsolescence among manufacturers.
 When delivered purely over the air, Wi-Fi is not well-suited to indoor
environments that have metal and concrete obstructions

40
CHAPTER
10
ESP8266

10.1 Introduction:

The ESP8266 series, or family, of Wi-Fi chips is produced by Espressif


Systems, a fabless semiconductor company operating out of Shanghai, China. The
ESP8266 series presently includes the ESP8266EX and ESP8285 chips. Here we used
ESP8266-01 in our project. ESP8266-01 is a very low cost Wi-Fi enabled chip. But it
has very limited I/O.

ESP8266 is a complete and self-contained Wi-Fi network solution that can carry
software applications. When the device is mounted and as the only application of the
application processor, the flash memory can be started directly from an external
Move. Built-in cache memory will help improve system performance and reduce
memory requirements.The ESP8266 highly integrated chip, including antenna switch
balun, power management converter, so with minimal external circuitry, and includes
front-end module, including the entire solution designed to minimize the space
occupied by PCB.

ESP8266 specifically for mobile devices, wearable electronics and networking


applications design and make the machine to achieve the lowest energy consumption,
together with several other patented technology.The ESP8266-01 is the smallest
ESP8266 module and only has 8 pins.

41
Figure 10.1 Wi-Fi microchip of ESP8266

Fig-10.2: Pin diagram of ESP8266

Table 10.1 Command description

FU AT COMMAND RESPONSE
NCTIO
N
Working AT OK

42
Restart AT+RST OK [System Ready,
Vendor:www.ai-
thinker.com]
Firmware AT+GMR AT+GMR
version 0018000902 OK
List AT+CWLAP AT+CWLAP +CWLAP:
Access (4,"RochefortSurLac",-
Points 38,"70:62:b8:6f:6d:58",1)
+CWLAP:(4,"LiliPad2.4",-
83,"f8:7b:8c:1e:7c:6d",1)
OK
Join AT+CWJAP? Query AT+CWJAP?
Access AT+CWJAP="SSID","Pa +CWJAP:"RochefortS
Point ssword urLac" OK
Quit AT+CWQAP=? Query
Access AT+CWQAP
OK
Point
Get IP AT+CIFSR AT+CIFSR 192.168.0.105
Address OK
Set AT+ CWSAP? Query
Paramete AT+ CWSAP= ssid, pwd
rs of <ssid>,<pwd>,<chl>, chl = channel, ecn =
Access <ecn> encryption
Point
Wi-Fi AT+CWMODE? Query
Mode AT+CWMODE=1 STA
AT+CWMODE=2 AP
AT+CWMODE=3 BOTH
Set up AT+CIPSTART=? Query
TCP or (CIPMUX=0) AT+CIPSTART id = 0-4, type =
UDP = <type>,<addr>,<port> TCP/UDP, addr = IP
connectio (CIPMUX=1) address, port= port
n AT+CIPSTART=
<id><type>,<addr>,

43
<port>
TCP/ AT+ CIPMUX? Query
UDP AT+ CIPMUX=0 Single
Connecti AT+ CIPMUX=1 Multiple
ons
Check AT+CWLIF
join
devices'
IP
TCP/IP AT+CIPSTATUS
Connecti AT+CIPSTATUS? no this
on Status fun

Send (CIPMUX=0)
TCP/IP AT+CIPSEND=<length>;
data (CIPMUX=1) AT+CIPSEND=
<id>,<length>

Close AT+CIPCLOSE=<id> or
TCP / AT+CIPCLOSE
UDP
connectio
n
Set as server AT+ CIPSERVER= mode 0 to close server
<mode>[,<port>] mode; mode 1 to open;
port = port
Set the server AT+CIPSTO? Query
timeout AT+CIPSTO=<time> <time>0~28800 in seconds

CHAPTER

44
11

SOFTWARE

11.1 Proteus

Proteus is one of the most famous simulators. It can be used to simulate almost
every circuit on electrical fields. It is easy to use because of the GUI interface that is
very similar to the real prototype board. Moreover it can be used to design Print
Circuit Board (PCB) Proteus is a Design Suite also know as Virtual System
Modelling (VSM) offering the ability to simulate micro-controller code and also
circuits. In this case Proteus ISIS is for simulation from the schematic form of the
hardware and also the micro-controller code. It is possible to develop and test designs
before a physical prototype is constructed. Proteus ISIS (Intelligent Schematic input
system) is used to draw schematics and simulate the circuits in real time. The
simulation allows human access during run time, thus providing real time simulation.

Embedded C
An embedded system is a special-purpose system in which the computer is
completely encapsulated by or dedicated to the device or system it controls. Unlike a
general-purpose computer, such as a personal computer, an embedded system
performs one or a few predefined tasks, usually with very specific requirements. Since
the system is dedicated to specific tasks, design engineers can optimize it, reducing
the size and cost of the product. Embedded systems are often mass-produced,
benefiting from economies of scale.

Personal digital assistants (PDAs) or handheld computers are generally


considered embedded devices because of the nature of their hardware design, even
though they are more expandable in software terms. This line of definition continues
to blur as devices expand. With the introduction of the OQO Model 2 with the
Windows XP operating system and ports such as a USB port — both features usually
belong to "general purpose computers", — the line of nomenclature blurs even more.

45
Physically, embedded system ranges from portable devices such as
digital watches and MP3 players, to large stationary installations like traffic lights,
factory controllers, or the systems controlling nuclear power plants.

In terms of complexity embedded systems can range from very simple


with a single microcontroller chip, to very complex with multiple units, peripherals
and networks mounted inside a large chassis or enclosure.

Figure 11.1 Embedded Sytem

Examples of Embedded Systems:


 Avionics, such as inertial guidance systems, flight control hardware/software
and other integrated systems in aircraft and missiles
 Cellular telephones and telephone switches
 Engine controllers and antilock brake controllers for automobiles
 Home automation products, such as thermostats, air conditioners, sprinklers,
and security monitoring systems
 Household appliances, including microwave ovens, washing machines,
television sets, DVD players and recorders
 Medical equipment
 Personal digital assistant
 Videogame consoles
 Computer peripherals such as routers and printers.
 Industrial controllers for remote machine operation.

46
11.2 Keil

Keil Software development tools are used to create products for


practically every industry like consumer electronics, industrial control, networking,
office automation, automotive, space exploration. Micro Vision Two is a second
generation IDE that simplifies project development and application testing. With
Micro Vision Two, we can easily create embedded applications in a mixture of C and
assembly. Real-time applications benefit from our highly optimized C libraries and
real-time kernels.

MicroVision3 provides a centralized front-end interface for the


compiler, assembler, linker, debugger, and other development tools. The Project
Window in MicroVision3 displays the current target, groups, and source files that
comprise our project. Rather than creating a single target for each project,
MicroVision2allows multiple targets for each project file. So, with a single project
file, we can create a target for simulating, a target for our emulator, and a production
target for programming into EPROM {E-PROM}.

Each target is composed of one or more groups which are in turn


composed of one or more source files. Groups let us divide the source files into
functional blocks or assign source files to different team members. Options may be
configured at each level of the project. This gives us a great deal of freedom and
flexibility when organizing our application. In addition to the on-line help,
MicroVision3 provides on-line versions of the development tool manuals as well as
the device manuals.

Keil C Compilers are based on the ANSI standard and include


extensions necessary to support the 8051, 251, and 166 microcontroller families. The
optimizer in our compiler is tuned for specific architecture and provides the highest
level of code density and execution speed.

The Keil C compilers give full us control over our embedded platform.
We decide which register banks are used, when to access certain memory areas,
which variables are stored in bits, when and how to use special function registers, and

47
so on. Without ever writing any assembly code we may even write interrupt service
routines in C. Code generated by the Keil C compiler compares with that of a
professional assembly programmer. This is due to the level of optimizations that are
performed. One such optimization is global register optimization.

By analyzing which registers are used in each function, the compiler


can better optimize register usage program-wide and generate smaller, faster
programs. This is accomplished by iterative compilation steps during the make
process.

The MicroVision3 debugger is designed to make testing your programs


as efficient as possible. While editing and debugging your programs, text and code
attributes are displayed in the source window. As you step through your program, the
current line is marked with a yellow arrow. Code coverage shows you which lines of
your program have been executed. Green means the line has been run. Grey means is
has not.

Breakpoints are clearly marked in the source window. Red for enabled,
white for disabled. These attributes make following program flow easier than ever.
The features of the Micro Vision Two debugger don’t stop there. When simulating
your programs, you not only get source-level, symbolic simulation. You also get on-
chip peripheral simulation. Dialog boxes display the condition of all peripherals and
on-chip components.

The debugger supports a C macro language that you may use to


simulate external hardware. We may create functions to simulate digital and analog
input signals for your application. This lets you get straight to testing and debugging
before the target hardware is available. With nothing more than the simulator and the
macro language, you can create a high-fidelity simulation of your end product.

11.3 WAMP Server

WampServer is a Web development platform on Windows that allows


you to create dynamic Web applications with Apache2, PHP, and MySQL.
WampServer automatically installs everything you need to intuitively developed Web

48
applications. You will be able to tune your server without even touching its setting
files. Best of all, WampServer is available for free (under GPML license) in both 32
and 64 bit versions. Wampserver is not compatible with Windows XP, SP3, or
Windows Server 2003.

Features
 Manage your Apache and MySQL services

 Switch online/offline (give access to everyone or only localhost)

 Install and switch Apache, MySQL and PHP releases

 Manage servers settings

 Access logs

 Access settings files

 Create alias

11.4 MySQL
MySQL is an open-source relational database management system. Its
name is a combination of MY the name of co-founder Michael Widenius's
daughter, and "SQL", the abbreviation for Structured Query Language. The MySQL
development project has made its source code available under the terms of the GNU
General Public License, as well as under a variety of proprietary agreements. MySQL
was owned and sponsored by a single for-profit firm, the Swedish company MySQL
AB, now owned by Oracle Corporation. For proprietary use, several paid editions are
available, and offer additional functionality

MySQL is a central component of the LAMP open-source web


application software stack (and other "AMP" stacks). LAMP is an acronym for
"Linux, Apache, MySQL, Perl/PHP/Python". Applications that use the MySQL
database include: TYPO3, MODx, Joomla, WordPress, Simple Machines Forum,
phpBB, MyBB, and Drupal. MySQL is also used in many high-profile, large-
scale websites, including Google(though not for
searches),Facebook Twitter Flickr and YouTube.

49
MySQL is written in C and C++. Its SQL parser is written in yacc, but
it uses a home-brewed lexical analyzer. MySQL works on many system platforms.
The MySQL server software itself and the client libraries use dual-
licensing distribution. They are offered under GPL version 2, beginning from 28 June
2000 (which in 2009 has been extended with aFLOSS License Exception) or to use a
proprietary license.

Support can be obtained from the official manual. Free support


additionally is available in different IRC channels and forums. Oracle offers paid
support via its MySQL Enterprise products. They differ in the scope of services and in
price. Additionally, a number of third party organizations exist to provide support and
services, including MariaDB and Percona.

MySQL has received positive reviews, and reviewers noticed it


"performs extremely well in the average case" and that the "developer interfaces are
there, and the documentation (not to mention feedback in the real world via Web sites
and the like) is very, very good". It has also been tested to be a "fast, stable and true
multi-user, multi-threaded sql database server".

11.5 HTML

Hypertext Mark-up Language (HTML) is the standard mark-up


language for creating web pages and web applications. With Cascading Style
Sheets (CSS) and JavaScript, it forms a triad of cornerstone technologies for
the World Wide Web.

Web browsers receive HTML documents from a web server or from


local storage and render the documents into multimedia web pages. HTML describes
the structure of a web page semantically and originally included cues for the
appearance of the document.

HTML elements are the building blocks of HTML pages. With HTML
constructs, images and other objects such as interactive forms may be embedded into
the rendered page. HTML provides a means to create structured documents by
denoting structural semantics for text such as headings, paragraphs, lists, links, quotes
and other items. HTML elements are delineated by tags, written using angle brackets.

50
Tags such as <img /> and <input /> directly introduce content into the page. Other

tags such as <p> surround and provide information about document text and may
include other tags as sub-elements. Browsers do not display the HTML tags, but use
them to interpret the content of the page.

HTML can embed programs written in a scripting language such


as JavaScript, which affects the behaviour and content of web pages. Inclusion of CSS
defines the look and layout of content. The World Wide Web Consortium (W3C),
maintainer of both the HTML and the CSS standards, has encouraged the use of CSS
over explicit presentational HTML since 1997.

11.6 PHP
PHP is a general-purpose scripting language that is especially suited to server-
side web development, in which case PHP generally runs on a web server.
Any PHPcode in a requested file is executed by the PHP runtime, usually to create
dynamic web page content or dynamic images used on websites or elsewhere.

PHP (recursive acronym for PHP: Hypertext Pre-processor) is a widely-used


open source general-purpose scripting language that is especially suited for web
development and can be embedded into HTML.

It was originally created by Rasmus Lerdorf in 1994, the PHP reference


implementation is now produced by The PHP Group.

11.6.1 Database Management System


Database is a collection of related data and data is a collection of facts and
figures that can be processed to produce information. Mostly data represents
recordable facts. Data aids in producing information, which is based on facts. A
database management system stores data in such a way that it becomes easier to
retrieve, manipulate, and produce information.

51
Traditionally, data was organized in file formats. DBMS was a new concept then, and
all the research was done to make it overcome the deficiencies in traditional style of
data management. A modern DBMS has the following

Characteristics:

 Real-world entity: A modern DBMS is more realistic and uses real-world


entities to design its architecture. It uses the behavior and attributes too.
 Relation-based tables: DBMS allows entities and relations among them to
form tables. A user can understand the architecture of a database just by
looking at the table names.
 Isolation of data and application: A database system is entirely different than
its data. A database is an active entity, whereas data is said to be passive, on
which the database works and organizes. DBMS also stores metadata, which is
data about data, to ease its own process.
 Less redundancy: DBMS follows the rules of normalization, which splits a
relation when any of its attributes is having redundancy in values.
Normalization is a mathematically rich and scientific process that reduces data
redundancy.
 Consistency: Consistency is a state where every relation in a database remains
consistent. There exist methods and techniques, which can detect attempt of
leaving database in inconsistent state. A DBMS can provide greater
consistency as compared to earlier forms of data storing applications like file-
processing systems.
 Query Language: DBMS is equipped with query language, which makes it
more efficient to retrieve and manipulate data.

52
CHAPTER

12

SERIAL COMMUNICATION

12.1 Serial and parallel Communication

When electronic devices communicate with each other, they can transfer data in two
different ways. One is serial and other one is parallel. When digital data is transferred
serially, it is transmitted bit by bit whereas in parallel transfer, many bits are
transmitted at same time. Though parallel transfer of data is much faster but requires
many wires. While serial transfer is slower as compared to parallel transfer but
requires few wires. Serial communication can be synchronous or asynchronous. In
synchronous communication, transmitter also transmits a clock along with data. This
clock is used for synchronization between transmitter and receiver device. In
asynchronous transfer of data, there is no clock.

Serial communication can be simplex, half-duplex or full duplex. Simplex


communication means that data will be transmitted only in one direction while half
duplex means data will be transmitted in both directions but at one time, only one
device can transmit, whereas full duplex means data may be transmitted in both
directions at one time, while one device is transmitting, it can also receive data
transmitted from other device at same time. As mentioned before, transmitter and
receiver are configured to communicate at some data transfer rate before
communication starts. This data transfer rate or number of bits transmitted per second
is called baud rate for handling serial communication.

Parallel communication is fast but it is not applicable for long distances (for printers).
Moreover it is also expensive. Serial is not much fast as parallel communication but it
can deal with transmission of data over longer distances (for telephone line, ADC,
DAC). It is also cheaper and requires less physical wires, that’s why we use serial
communication.

53
Figure 12.1 Serial Communication

12.2 Types of Serial Communication

12.2.1 Synchronous Communication

Transfer the block of data (characters) between sender and receiver spaced by fixed
time interval. This transmission is synchronized by an external clock.

Figure 12.2 Types of serial communication

12.2.1.1I2C Protocol

The term I2C or IIC abbreviation is an inter integrated circuit and it is called as I
squared C. I2C is a serial computer bus, which is invented by NXP semiconductors
previously it is named as Philips semiconductors. The I2C bus is used to attach low
speed peripheral integrated circuits to microcontrollers and processors. In the year
2006, to implement the I2C protocol no licensing fee is necessary. But fee is
necessary to get I2C slave address assigned by NXP semiconductors.

54
I2C bus uses two bidirectional open-drain lines such as SDA (serial data line) and SCl
(serial clock line) and these are pulled up with resistors. I2C bus permits a master
device to start communication with a slave device. Data is interchanged between these
two devices. Typical voltages used are +3.3V or +5V although systems with extra
voltages are allowed.

Figure 12.3 Master and Slave Communication

12.2.1.2 SPI Communication

The SPI communication stands for serial peripheral interface communication


protocol, which was developed by the Motorola in 1972. SPI interface is available on
popular communication controllers such as PIC, AVR, and ARM controller, etc. It has
synchronous serial communication data link that operates in full duplex, which means
the data signals carry on both the directions simultaneously.

SPI protocol consists of four wires such as MISO, MOSI, CLK, SS used for
master/slave communication. The master is a microcontroller, and the slaves are other
peripherals like sensors, GSM modem and GPS modem, etc. The multiple slaves are
interfaced to the master through a SPI serial bus. The SPI protocol does not support
the Multi-master communication and it is used for a short distance within a circuit
board.

SPI Lines

MISO (Master in Slave out): The MISO line is configured as an input in a master
device and as an output in a slave device.

55
MOSI (Master out Slave in): The MOSI is a line configured as an output in a master
device and as an input in a slave device wherein it is used to synchronize the data
movement.

SCK (serial clock): This signal is always driven by the master for synchronous data
transfer between the master and the slave. It is used to synchronize the data movement
both in and out through the MOSI and MISO lines.

SS (Slave Select) and CS (Chip Select): This signal is driven by the master to select
individual slaves/Peripheral devices. It is an input line used to select the slave devices.

Master Slave Communication with SPI Serial Bus

Single Master and Single Slave SPI Implementation

Here, the communication is always initiated by the master. The master device first
configures the clock frequency which is less than or equal to the maximum frequency
that the slave device supports. The master then selects the desired slave for
communication by dragging the chip select line (SS) of that particular slave device to
go low state and active. The master generates the information on to the MOSI line that
carries the data from master to slave.

Figure 12.4 Single Master and Single Slave SPI Implementation

56
12.2.2 Asynchronous Communication

There is no clock involved here and transmission is synchronized by special signals


along the transmission medium. It transfers a single byte at a time between sender and
receiver along with inserting a start bit before each data character and a stop bit at its
termination so that to inform the receiver where the data begins and ends. An example
is the interface between a keyboard and a computer. Keyboard is the transmitter and
the computer is the receiver. We use USART and UART for serial communications.
USART or UART is a microcontroller peripheral which converts incoming and
outgoing bytes of data into a serial bit stream. Both have same work but with different
methods which is explained below.

12.2.2.1 USART:

USART stands for Universal Synchronous/Asynchronous Receiver-Transmitter.


USART uses external clock so it needs separate line to carry the clock signal. Sending
peripheral generates a clock and the receiving peripheral recover from the data stream
without knowing the baud rate ahead of time. By use of external clock, USART’s data
rate can be much higher (up to rates of 4 Mbps) than that of a standard UART.

12.2.2.2 UART:

It stands for Universal Asynchronous Receiver-Transmitter. A UART generates its


internal data clock to the microcontroller. It synchronizes that clock with the data
stream by using the start bit transition. The receiver needs the baud rate to know
ahead of time to properly receive the data stream.

57
58

You might also like