Professional Documents
Culture Documents
LIFI Document
LIFI Document
INDUSTRIAL NETWORKING
A PROJECT REPORT
Submitted by
Ms. R.KRITHIGA
- 821311106019
Ms. N.TAMILMAGAL
- 821311106048
Ms. R.VINOTHA
- 821311106055
Mr. M. ARUN
- 821311106703
BACHELOR OF ENGINEERING
IN
ELECTRONICS AND COMMUNICATION ENGINEERING
PARISUTHAM INSTITUTE OF TECHNOLOGY AND SCIENCE,
THANJAVUR.
A PROJECT REPORT
Submitted by
Ms. R.KRITHIGA
- 821311106019
Ms. N.TAMILMAGAL
- 821311106048
Ms. R.VINOTHA
- 821311106055
Mr. M. ARUN
- 821311106703
BACHELOR OF ENGINEERING
IN
ELECTRONICS AND COMMUNICATION ENGINEERING
PARISUTHAM INSTITUTE OF TECHNOLOGY AND SCIENCE,
THANJAVUR.
SIGNATURE
SIGNATURE
Mrs.S.Bhuvaneswari
SUPERVISOR
Professor
Assistant Professor
Department of ECE
Department of ECE
Parisutham Institute of
Technology and Science ,
Parisutham Institute of
Technology and Science,
Thanjavur.
Thanjavur.
INTERNAL EXAMINER
EXTERNAL EXAMINER
ACKNOWLEDGEMENT
The success of any work lies in the involvement and commitment of its
makers, this being no exception. At this juncture I would like to acknowledge the
many minds that made this project to be a reality.
My grateful thanks to our beloved Chairman Mr. S. P. ANTHONISAMY,
M.A., B.L., for the continuous help during our course period by arranging various
activities.
I extend my grateful thanks to our lovable Dean Mrs. J.NIRMALA, M.Tech,
(Ph.D) for providing her hands to us to successfully complete the course.
The Encouragement and support of our Head Dr. G. MARY AMIRTHA
SAGAYEE, B.E, M.S, M.E, M.B.A, (PhD), Department of Electronics
and
ABSTRACT
This Project is about the data communication in Industrial networking using
Visible Light Communication based on White LEDs. To establish this process, it is
needed to integrate the visible light communication. So a new method is developed
by using LI-FI as wireless communication medium. This is the smart way of
providing data communication for Industrial networking.
In this project microcontrollers and sensors are used. The Visible Light
Communication is used to transmit the data. The photo detector will act as a receiver.
LI-FI act as a wireless medium between the transmitter and the receiver.
Li-Fi technology works on a simple digital principle which is nothing but an
led is ON a digital data 1 can be transmitted and if it is OFF digital data 0 can be
transmitted. So, in this project work the LEDs were switched very quickly. These fast
switching can be achieved by PWM technique to transmit digital data stream
containing strings. To acquire this, it needs programming the microcontroller to
varies the duty cycle of the PWM signal which has the task of regulating the current
in the LED. The biased current is fed to LED driver unit. The power of LED is varied
according to the waveform of data signal. At the receiver side photodiode sensor
produces a current proportional to the received instantaneous power. From this data
can be filtered and it can be displayed on PC .
CHAPTER-1
INTRODUCTION
Li-Fi is the term some have used to label the fast and cheap wireless-communication
system, which is the optical version of WI-FI. The term was first used in this context
by Harald Haas in his TED Global talk on Visible Light Communication (VLC). The
technology was demonstrated at the 2012 Consumer Electronics Show in Las Vegas
using a pair of Casio smartphones to exchange data using light of varying intensity
given off from their screens, detectable at a distance of up to ten meter.
In October 2011 a number of companies and industry groups formed the Li-Fi
Consortium, to promote high-speed optical wireless systems and to overcome the
limited amount of radio-based wireless spectrum available by exploiting a
completely different part of the electromagnetic spectrum.
The consortium
believes it is possible to achieve more than 10 Gbps, theoretically allowing a highdefinition film to be downloaded in 30 seconds. Li-Fi has the advantage of being
able to be used in sensitive areas such as in aircraft without causing interference.
However, the light waves used cannot penetrate walls. Later in 2012, VLC, a firm set
up to commercialize Li-Fi, will bring out Li-Fi products for firms installing LEDlighting systems. In future data for laptops, Smartphone's, and tablets can be
transmitted through the light in a room by using Li-Fi.
Li-Fi or Light Fidelity is a high speed, bidirectional and fully networked subsets of
visual light communications (VLC). It uses visible light communication instead of
radio frequency (RF) waves which carry more information. Thus Li-Fi is an emergent
technology that has the potential to deliver enormous bandwidth. As data transmission
through radio waves approaches its limits, a new medium presents itself. Most of us
are familiar with WI-FI (Wireless Fidelity) uses 2.4-5 GHz RF to deliver wireless
data, information or internet access around. It can cover up a large area, but it fails to
cover up all the area as its bandwidth is typically limited to 50-100 mega-bits per
second (Mbps). This is a good match to the speed of internet services, but insufficient
for moving large data files like HDTV movies, music libraries and video games. The
bandwidth and speed is directly proportional medium of communication. Therefore
RF-based technologies such as to-days WI-FI are not the optimal way. In addition to
that WI-FI fails to provide new desired capabilities such as precision in-door
positioning and gesture recognition.
To this a new trend has come in technology that overcomes these flaws, that is Li-Fi
or Light Fidelity informally known as optical wireless technology, a vivid
permutation of speed, reliability, flexibility and usability.
Li-Fi is transmission of data through illumination by taking the fiber out of fiber
optics by sending data through a LED light bulb that varies in intensity faster than the
human eye can follow. Li-Fi is the term some used to label the fast and cheap wireless
communication system which is the optical version of WI-FI. It is possible to encode
data in the light by varying the rate at which the LEDs flicker on and off to give
different strings of 0s and 1s. The LED intensity is modulated so rapidly that human
eye cannot notice, so the output appears constant. More sophisticated techniques and
ways could dramatically increase visible communication data rate.
Transfer of data from one place to a different place is one of the most important day
today manners. The current wireless networks that attach us to the internet are
extremely slow when numerous devices are connected. As the amount of devices that
access the internet increases, the fixed bandwidth accessible makes it extra and extra
tricky to enjoy high data transfer rates and attach to a secure network. But, radio
waves are just a minute part of the band available for data transfer.
With the wide use of wireless gadgets, the demand of wireless internet is increasing at
a very high pace and stealing it from the guy next door, or competing for bandwidth
at a conference, the slow speeds you face when more than one device is tapped into
the network. When many devices access wireless internet, clogged airwaves are going
to make it. To over come this there is a solution known as Data through
illumination. This technology is known as LI-FI Li-Fi is a technology that makes
use of LED light which helps in the transmission of data much faster and flexible than
data that can be transmitted through Wi-Fi. Light reaches nearly everywhere so
communication can also go along with light freely. Light Fidelity is a branch of
optical wireless communication which is an emerging technology. By using visible
light as transmission medium, Li-Fi provides wireless indoor communication. The bit
rate achieved by Li-Fi cannot be achieved by Wi-Fi. Li-Fi is the transfer of data
through light by taking fiber out of fiber optics and sending data through LED light.
In this paper we are concerned with the use of li-fi in the field of medicine. As the WiFi cannot be used along with the medical equipments due to the radio waves we
implement li-fi in those places.
Heart of this technology lies in the intensity and the potential of the light emitting
diodes. Major reason that leads to the development of the LI-FI is confinement of WIFI to comparatively small distance. As many devices are coming up in day to day
lifes the signals are being clogged up due to heavy traffic, so there is a need for error
free transmission technology. And the remedy for this problem is li-fi technology. It
has been designed in such a way so that it can overcome the disadvantages of WI-FI.
In Industrial networking since from beginning, data can be transferred through the
wireless devices like Bluetooth, ZigBee, WI-FI etc.., But apart from these
technologies LI-FI has made these Industrial networking free from environmental as
well as health issues due to RF radiations. Though this technology may has short
coverage area this also can be eradicated by installing more number of VLC
transmitters since it consists of only LEDs, power consumption will be low and cost
is also reduced.
This LI-FI technology probably produces high data rate transmission even with less
intensity. When the LEDs becoming dim it will not affect the data rate those
intensities for LED can also hence, it is easy to monitor the industrial environment
conditions via Visible Light Communication.
CHAPTER-2
EXPERIMENTAL SETUP
2.1 LITERATURE SURVEY
2.1.1 [1] Title: Smart Parking Information System Exploiting Visible Light
communication.
Abstract- In this paper, we propose a smart parking information system exploiting
visible light communication (VLC) technology to help drivers getting the real-time
parking information as well as direction guide. By providing accurate information on
available parking spaces, drivers save time and fuel and increase efficiency of the
parking process. The effectiveness of the proposed scheme is validated through
experiments in an indoor environment.
Authors- Nammoon Kim, Changqiang Jing, Biao Zhou and Youngok Kim.
Year and Publication- IJSN 2014.
Technology used- A novel smart parking information system exploiting the real-time
parking information as well as the direction guide. In the parking entrance, VLC
module of safety bar, ground or ceiling and head light or installed VLC module in
car are communicating. In this process, the vehicle and light module of celling
exchange number of vehicle and ID of light. Thus, the smart parking lot system can
guide the driver to the nearest empty parking space by using direction indicator
based on location information of vehicles. Digital encodings such as Non Return to
Zero (NRZ), Return to Zero (RZ), Manchester encoding for data transmission.
Merits- Low Pass Filter (LPF) was applied to eliminate external noise and light from
other light source.
2.1.2 [2] Title: Reading Lamp-Based Visible Light Communication System for Inflight Entertainment.
Abstract- This paper explores the use of a reading lamp as an access point for a
Visible Light Communication (VLC) downlink channel. We have established an
infrared uplink channel based on a network adapter, supporting both a VLC receiver
and an infrared emitter. The optical signal power distribution over the passenger area
has been also studied using a Monte Carlo Ray-Tracing algorithm. The hardware
implementation and testing results are also presented.
Authors- C. Quintana, V. Guerra, J. Rufo, J. Rabadan and R. Perez-Jimenez.
Year and publication- IEEE MARCH 2013.
Technology used- In this paper we propose a full optical wireless strategy for
passenger connectivity in planes during flight. It uses a VLC system as a downlink,
while an infrared link provides the uplink channel. A network adapter was introduced
to improve the performance. And also OOK and PPM provides better performance
against AWGN. Using Ethernet as a distribution network inside the aircraft and the
use of a Power over Ethernet (PoE) system to feed them up, and so the shielded
twisted pair cable will be used to power the lamps.
Merits- Use of optical lenses for collimating the light beam in the passengers table.
A simulation based on a Monte Carlo-Ray tracing algorithm has been performed in
order to calculate the signal to noise ratio at different points of the users table.
Demerits- OOK does not guarantee the absence of flickering and both of them
(OOK and PPM) have lower spectral efficiency.
2.1.3 [3] Title: Design of an Integrated Optical Receiver for Mobile Visible Light
Communications.
Abstract- This paper presents a project to design and implement, an optical receiver
system for a visible light communications (VLC). The link is capable of receiving
on-off keying non-return zero data (OOK NRZ) at speeds up to 10 Mbit/s and it be
interfaced with a PC, Notebook or mobile phone through a USB 2.0 port. The paper
shows the practical implementation and the experiment results of the designed
receiver.
Authors- A. Burton, C. Amiot, H. Le Minh and Z. Ghassemlooy.
Year and publication- 2011 PGNet.
Technology used - This paper presents the design and analysis of a mobile VLC
receiver with an interface for a PC or Note Book via the USB 2.0 port capable of
receiving OOK NRZ data at 10Mbit/s error free. The Band-pass filter is required to
remove the high frequency components of the signal above the required 10 MHz
level as signals above this will contribute towards the noise. The next stage of the
receiver will be to realize the band-pass filter and connect the FT232R USB UART
I.C. This will enable full connectivity to a PC or Notebook.
Merits- The received arbitrary OOK NRZ data (length 210-1) at speeds of 1, 2, 3
and 4 Mbit/s after the TIA. The eyes are clear thus show error free performance.
Demerits- The bottle-neck to the system currently restricting the bandwidth is tied
to the unequalized modulation bandwidth of the LED.
2.1.4 [4] Title: A Study on Realization of Visible Light Communication System for
Power Line Communication Using 8-bit Microcontroller.
Abstract- To solve the problems of the current wireless communications system, a
visible light communications system for power line communication (PLC) via 8-bit
Micro controller is created and the capacity is analyzed. The exclusive PLC chip
PLC-485MA, an 8-bit ATmega16 microcontroller, high brightness 5pi light emitting
diodes (LEDs), and the LLS08-A1 visible light-receiving sensor were used for the
transmitter and receiver.
Authors- Ji-Hun Yun, Geun-Bin Hong, and Yong-kab Kim.
Year and Publication- 2010 KIEEME.
Technology used- Visible light communication technology, which has gotten notice
as a next generation communication technology, is particularly attractive for home
networks. Among the technologies, the visible light communication system is
designed and brought into a network using PLC to study application of the LED
system that is necessarily relevant for living.
Merits- The voltage loss of the green LED is 1.46 V, and the voltage loss of the blue
LED is 0.47 V, which shows the best performance among the LEDs.
Demerits- At a distance of 50 cm, the voltage was 3.26 V, so that 1.06 V was
confirmed as the voltage loss.
problem. The MTTR performance shows a similar trend. As the distance from Host-I
to Most-B changes from 12ft to 4ft, MTTR increases 15%.
Power
supply
Motor
Pressure
sensor
Humidity
sensor
Micro
controller
VLC
Transmitter
Temperatu
re sensor
PC
LED Light
Fixtures
RS232
Photo
detector
In this proposed system, it is implemented that wireless data transfer through light
medium. First the sensor module consists of different sensors of industries like
Temperature, Pressure, Gas sensors these analog devices produce analog output
which is given to microcontroller(ARM7LPC2148) a 32 bit controller which has
inbuilt ADC in it. Then those analog values will be converted to digital values and it
will be received by the VLC Transmitter ie. Array of LEDs. This Visible light
module again converts the output of Microcontroller to Light signals with binary
values which actually changes the intensity of light that cannot be identified through
human eyes.
These Binary Light signals will be received by the photo-detector which can act as
light sensor this again converts signals to decimal values which will be displayed in
PC through Visual B.6.
Fig
Fig
Port 0: Port 0 is a 32-bit I/O port with individual direction controls for each bit.
Total of 28 pins of the Port 0 can be used as a general purpose bi-directional digital
I/Os while P0.31 provides digital output functions only. The operation of port 0 pins
depends upon the pin function selected via the pin connect block. Pins P0.24, P0.26
and P0.27 are not available.
PORT
P0.0
PIN
19
FUNCTION
TXD0 Transmitter output for UART0
PWM1 Pulse Width Modulator output 1
P0.1
21
P0.2
22
P0.3
26
P0.4
27
P0.5
29
P0.6
30
P0.8
33
P0.9
34
P0.10
35
P0.11
37
P0.12
38
39
P0.14
41
P0.15
45
P0.16
46
P0.17
47
P0.18
53
P0.19
54
P0.20
55
P0.21
P0.22
P0.23
58
P0.25
P0.28
13
P0.29
14
P0.30
15
P0.31
17
PORT1: Port 1: Port 1 is a 32-bit bi-directional I/O port with individual direction
controls for each bit. The operation of port 1 pins depends upon the pin function
selected via the pin connect block. Pins 0 through 15 of port 1 are not available.
PORT
PIN
FUNCTION
P1.16
16
P1.17
12
P1.18
P1.20
48
P1.21
44
P1.22
40
P1.23
36
P1.24
32
P1.25
28
P1.26
24
P1.27
64
P1.28
60
P1.29
56
P1.30
52
P1.31
20
THUMB code is able to provide up to 65% of the code size of ARM, and 160% of
the performance of an equivalent ARM processor connected to a 16-bit memory
system.
In Thumb state, the Program Counter (PC) uses bit 1 to select between alternate half
words. Transition between ARM and Thumb states does not affect the processor
mode or the register contents.
All exception handling is performed in ARM state. If an exception occurs in Thumb
state, the processor reverts to ARM state. The transition back to Thumb state occurs
automatically on return.
The operating state of the ARM7TDMI-S core can be switched between ARM state
and Thumb state using the BX instruction.
2.4.1.5.1 The Advantages of THUMB:
THUMB instructions operate with the standard ARM register configuration,
allowing excellent interoperability between ARM and THUMB states. Each 16-bit
THUMB instruction has a corresponding 32-bit ARM instruction with the same
effect on the processor model.
The major advantage of a 32-bit (ARM) architecture over a 16-bit architecture is its
ability to manipulate 32-bit integers with single instructions, and to address a large
address space efficiently. When processing 32-bit data, a 16-bit architecture will take
at least two instructions to perform the same task as a single ARM instruction.
2.4.1.5.2 Memory map concepts and operating modes:
The basic concept on the LPC2141/2/4/6/8 is that each memory area has a "natural"
location in the memory map. This is the address range for which code residing in that
area is written. The bulk of each memory space remains permanently fixed in the
same location, eliminating the need to have portions of the code designed to run in
different address ranges.
Because of the location of the interrupt vectors on the ARM7 processor (at addresses
0x0000 0000 through 0x0000 001C,) a small portion of the Boot Block and SRAM
spaces need to be re-mapped in order to allow alternative uses of interrupts in the
different operating modes Re-mapping of the interrupts is accomplished via the
Memory Mapping Control feature.
2.4.1.5.3 Memory formats:
The processor views memory as a linear collection of bytes numbered in ascending
order from zero. For example, bytes 0-3 in memory hold the first stored word, and
bytes 4-7 hold the second stored word.
There are two types of formats:
Big Endian format:
In byte-invariant big-endian format, the processor stores the most significant byte of
a word at the lowest-numbered byte, and the least significant byte at the highestnumbered byte. Therefore, byte 0 of the memory system connects to data.
Little Endian Format:
In little-endian format, the lowest-numbered byte in a word is the least significant
byte of the word and the highest-numbered byte is the most significant. Therefore,
byte 0 of the memory system connects to data lines.
2.4.1.62GPIO:
General Purpose Input/output (GPIO) is an interface available on some devices. A
microprocessor, microcontroller or interface device may have one or more GPIO
connections to interface with external devices and peripherals. These can act as
input, to read digital signals from other parts of a circuit, or output, to control or
signal to other devices. GPIOs are often arranged into groups, typically of 8 pins - a
GPIO port - that usually have individual GPIOs configurable either as input or
outputs. In some cases, GPIOs may be configurable to produce CPU interrupts and
be able to use Direct Memory Access to move large quantities of data efficiently into
or out of the device.
GPIO peripherals vary quite widely. In some cases, they are very simple, a group of
pins that can be switched as a group to either input or output. In others, each pin can
be setup flexibly to accept or source different logic voltages, with configurable drive
strengths and pull up/downs. The input and output voltages are typically, though not
universally limited to the supply voltage of the device with the GPIOs on, and may
be damaged by greater voltages.
The GPIO peripheral provides dedicated general-purpose pins that can be configured
as either inputs or outputs.
When configured as an output, you can write to an internal register to control the
state driven on the output pin. When configured as an input, you can detect the state
of the input by reading the state of an internal register.
2.4.1.6.1 Purpose of the Peripheral
Most system on a chip (SoC) devices require some general-purpose input/output
(GPIO) functionality in order to interact with other components in the system using
low-speed interface pins. The control and use of the GPIO capability on this device
is grouped together in the GPIO peripheral and is described in the following sections.
2.4.1.6.2 Features
The GPIO peripheral consists of the following features.
Output set/clear functionality through separate data set and clear registers allows
multiple software
processes to control GPIO signals without critical section protection.
Set/clear functionality through writing to a single output data register is also
supported.
Separate input/output registers
Output register can be read to reflect output drive status.
Input register can be read to reflect pin status.
All GPIO signals can be used as interrupt sources with configurable edge detection.
All GPIO signals can be used to generate events to the EDMA.
Programmable debounce circuit provided on GPIO.
The purpose of the Pin Connect Block is to configure the microcontroller pins to the
desired functions. The pin connect block allows selected pins of the microcontroller
to have more than one function. Configuration registers control the multiplexers to
allow connection between the pin and the on chip peripherals. The Pin Control
Module contains registers as shown below:
Name
Description
Access
Read/Writ
Reset value
0x0000
Address
0xE002
e
Read/Writ
0000
0x0000
C000
0xE002
e
Read/Writ
0000
C004
0xE002
C014
Interrupt latency:
The amount of time between the assertion of an interrupt signal and the start of the
associated interrupt service routine. Factors that affect interrupt latency include the
length of time that interrupts are disabled during normal program execution,
processor speed, and preemption of the processor by higher priority interrupts.
Interrupt service routine:
A small piece of software executed in response to a particular interrupt. Abbreviated
ISR.
Interrupt type:
A unique number associated with each interrupt. The interrupt type is typically the
processor's index into the interrupt vector.
Interrupt vector:
The address of an interrupt service routine. This term is sometimes used incorrectly
to refer to either the interrupt type or the address of the interrupt vector.
External Interrupts:
External interrupts are a mechanism for I/O devices that communicate infrequently
with the CPU to get the attention of the CPU. Rather than have the CPU constantly
check to see if the I/O device needs attention (this is polling), the device interrupts
the CPU.
There's a protocol between device and CPU that allows the device to indicate what
kind of service it wants from the CPU. Usually, this is done using an interrupt
number. The CPU then locates an interrupt handler based on this number, runs the
code for the handler, and tells the device it's done.
Dealing with I/O devices can slow down the CPU a lot because devices are often as
slow as hard drives, in response time. However, such interrupts are infrequent, so the
CPU only has to manage the interrupts when needed.
At this point, you should know what an external interrupt is, and be able to
summarize the protocol between the CPU and the interrupting device.
Vector interrupts:
This is the fastest system. The onus is placed on the requesting device to request the
interrupt, and identify itself. The identity could be a branching address for the
desired interrupt-handling routine.
If the device just supplies an identification number, this can be used in conjunction
with a lookup table to determine the address of the required service routine.
Response time is best when the device requesting service also supplies a branching
address.
Priority Interrupt Controller Chips (PIC's) are hardware chips designed to make the
task of a device presenting its own address to the CPU simple. The PIC also assesses
the priority of the devices connected to it. Modern PIC's can also be programmed to
prevent the generation of interrupts which are lower than a desired level.
The decoded location is connected to the output of a priority encoder. The input of
the priority encoder is connected to each device. When a device requests service, the
priority encoder presents a special code combination (unique for each device) to the
decoded memory location. The port thus holds the value or address associated with
the highest device requesting service.
The priority encoder arranges all devices in a list, devices given a lower priority are
serviced when no other higher priority devices need servicing. This simplifies the
software required to determine the device, resulting in an increase in speed.
2.4.1.7 ADC Converter:
ARM7 LPC2148 has 14 channel 10 bit ADC. It give the digital outputs with 10bit
resolution. The ADC channels are classified into two types ADC0 and ADC1. ADC0
has six channels (ADC0.0 ADC0.5) and ADC1 has 8 channels (ADC1.0 to 1.7).
The ADC control register (ADCR) and ADC Data Register (ADDR) and ADGDR
(ADC Global Data Register) are used to develop the code in ARM7 2148.in the
ADGDR the digital output is stored.
Additional features:
Power-down mode.
Measurement range 0 V to VREF (typically 3 V; not to exceed VDDA voltage
level).
10 bit conversion time 2.44 s.
Burst conversion mode for single or multiple inputs.
Optional conversion on transition on input pin or Timer Match signal.
Global Start command for both converters is also available in LPC214x series
UART: ARM7 2148 have 2 UART channels UART0 and UART1. P0.0 and P0.1 are
used for UART0 TX and Rx pins. And P0.8 and P0.9 is used for UART1.
2.4.2 POWER SUPPLY
BLOCK DIAGRAM
The ac Voltage, typically 220V RMS is connected to a transformer, which steps that
ac voltage down to the level of desired dc output. A diode rectifier then provides a
full-wave rectified voltage that is initially filtered by a simple capacitor filter to
produce a dc voltage. This resulting dc voltage usually has some ripple or ac voltage
variation.
reverse D2.At this time D3 and D1 re forward biased and we allow current flow to
pass through them,D4 and D4 are reverse biased and will block current flow.
One advantage of a bridge rectifier over a conventional full-wave rectifier is that
with a given transformer the bridge rectifier produces a voltage output that is nearly
twice that of conventional full-wave circuit .
This may be shown by assigning values to some of the components shown in views
A and B. Assume that the same transformer is used in both circuits the peak voltage
developed between points X and Y is 1000V in both circuits.
is repeated for each byte sent. Figure 1 shows a diagram of what a byte transmission
would look like.
At this point you may want to know what the duration of a bit is. In other words,
how long does the signal stay in a particular state to define a bit. The answer is
simple. It is dependent on the baud rate. The baud rate is the number of times the
signal can switch states in one second. Therefore, if the line is operating at 9600
baud, the line can switch states 9,600 times per second. This means each bit has the
duration of 1/9600 of a second or about 100sec.
When transmitting a character there are other characteristics other than the baud rate
that must be known or that must be setup. These characteristics define the entire
interpretation of the data stream.
that will be transmitted. This length in general can be anywhere from 5 to 8 bits.
The second characteristic is parity. The parity characteristic can be even, odd, mark,
space, or none. If even parity, then the last data bit transmitted will be a logical 1 if
the data transmitted had an even amount of 0 bits. If odd parity, then the last data bit
transmitted will be a logical 1 if the data transmitted had an odd amount of 0 bits. If
MARK parity, then the last transmitted data bit will always be a logical 1. If SPACE
parity, then the last transmitted data bit will always be a logical 0. If no parity then
there is no parity bit transmitted.
The third characteristic is the amount of stop bits. This value in general is 1 or 2.
Assume we want to send the letter 'A' over the serial port. The binary representation
of the letter 'A' is 01000001. Remembering that bits are transmitted from least
significant bit (LSB) to most significant bit (MSB), the bit stream transmitted would
be as follows for the line characteristics 8 bits, no parity, 1 stop bit and 9600 baud.
LSB (0 1 0 0 0 0 0 1 0 1) MSB
The above represents (Start Bit) (Data Bits) (Stop Bit). To calculate the actual byte
transfer rate simply divide the baud rate by the number of bits that must be
transferred for each byte of data. In the case of the above example, each character
requires 10 bits to be transmitted for each character. As such, at 9600 baud, up to 960
bytes can be transferred in one second.
The above discussion was concerned with the "electrical/logical" characteristics of
the data stream. We will expand the discussion to line protocol. Serial
communication can be half duplex or full duplex. Full duplex communication means
that a device can receive and transmit data at the same time. Half duplex means that
the device cannot send and receive at the same time. It can do them both, but not at
the same time. Half duplex communication is all but outdated except for a very small
focused set of applications.
Half duplex serial communication needs at a minimum two wires, signal ground and
the data line. Full duplex serial communication needs at a minimum three wires,
signal ground, transmit data line, and receive data line. The RS232 specification
governs the physical and electrical characteristics of serial communications. This
specification defines several additional signals that are asserted (set to logical 1) for
information
and
control
beyond
the
data
signal
These signals are the Carrier Detect Signal (CD), asserted by modems to signal a
successful connection to another modem, Ring Indicator (RI), asserted by modems to
signal the phone ringing, Data Set Ready (DSR), asserted by modems to show their
presence, Clear To Send (CTS), asserted by modems if they can receive data, Data
Terminal Ready (DTR), asserted by terminals to show their presence, Request To
Send (RTS), asserted by terminals if they can receive data. The section RS232
Cabling describes these signals and how they are connected.
The above paragraph alluded to hardware flow control. Hardware flow control is a
method that two connected devices use to tell each other electronically when to send
or when not to send data. A modem in general drops (logical 0) its CTS line when it
can no longer receive characters. It re-asserts it when it can receive again. A terminal
does the same thing instead with the RTS signal. Another method of hardware flow
control in practice is to perform the same procedure in the previous paragraph except
that the DSR and DTR signals.
Note that hardware flow control requires the use of additional wires. The benefit to
this however is crisp and reliable flow control. Another method of flow control used
is known as software flow control. This method requires a simple 3 wire serial
communication link, transmit data, receive data, and signal ground. If using this
method, when a device can no longer receive, it will transmit a character that the two
devices agreed on. This character is known as the XOFF character. This character is
generally a hexadecimal 13. When a device can receive again it transmits an XON
character that both devices agreed to. This character is generally a hexadecimal 11.
2.4.4 RS232:
When we look at the connector pin out of the RS232 port, we see two pins which are
certainly used for flow control. These two pins are RTS, request to send and CTS,
clear to send. With DTE/DCE communication (i.e. a computer communicating with
a modem device) RTS is an output on the DTE and input on the DCE. CTS are the
answering signal coming from the DCE.
Before sending a character, the DTE asks permission by setting its RTS output. No
information will be sent until the DCE grants permission by using the CTS line.
If the DCE cannot handle new requests, the CTS signal will go low. A simple but
useful mechanism allowing flow control in one direction. The assumption is that the
DTE can always handle incoming information faster than the DCE can send it. In
the past, this was true. Modem speeds of 300 baud were common and 1200 baud was
seen as a high speed connection.
For further control of the information flow, both devices have the ability to signal
their status to the other side. For this purpose, the DTR data terminal ready and DSR
data set ready signals are present. The DTE uses the DTR signal to signal that it is
ready to accept information, whereas the DCE uses the DSR signal for the same
purpose. Using these signals involves not a small protocol of requesting and
answering as with the RTS/CTS handshaking. These signals are in one direction
only.
The last flow control signal present in DTE/DCE communication is the CD carrier
detect. It is not used directly for flow control, but mainly an indication of the ability
of the modem device to communicate with its counterpart. This signal indicates the
existence of a communication link between two modem devices.
2.4.5 SENSORS:
2.4.5.1TEMPERATURE SENSOR:
The silicon band gap temperature sensor is an extremely common form of
temperature sensor (thermometer) used in electronic equipment. Its main advantage
is that it can be included in a silicon integrated circuit at very low cost. The principle
of the sensor is that the forward voltage of a silicon diode is temperature-dependent,
according to the following equation:
Where,
T = temperature in kelvins
T0 = reference temperature
VG0 = band gap voltage at absolute zero
VBE0 = band gap voltage at temperature T0 and current IC0
K = Boltzmann's constant
q = charge on an electron
n = a device-dependent constant
By comparing the band gap voltages at two different currents, IC1 and IC2, many of
the variables in the above equation can be eliminated, resulting in the relationship:
An electronic circuit, such as the Brokaw band gap reference, that measures VBE can
therefore be used to calculate the temperature of the diode. The result remains valid
up to about 200 C to 250 C, when leakage currents become large enough to corrupt
the measurement. Above these temperatures, materials such as silicon carbide can be
used instead of silicon.
If high precision is not required it is enough to bias a diode with any constant low
current and use its 2 mV/C thermal coefficient for temperature calculation,
however this requires calibration for each diode type. This method is common in
monolithic temperature sensors.
Pin
Function
Name
Vcc
No
1
Output
Ground (0V)
Ground
limited by diffusion and thus the output from the sensor is linearly proportional to the
gas concentration. This linear output is one of the advantages of electrochemical
sensors over other sensor technologies, (e.g. infrared), whose output must be
linearized before they can be used. A linear output allows for more precise
measurement of low concentrations and much simpler calibration (only baseline and
one point are needed).
Diffusion control offers another advantage. Changing the diffusion barrier allows the
sensor manufacturer to tailor the sensor to a particular target gas concentration range.
In addition, since the diffusion barrier is primarily mechanical, the calibration of
electrochemical sensors tends to be more stable over time and so electrochemical
sensor based instruments require much less maintenance than some other detection
technologies. In principle, the sensitivity can be calculated based on the diffusion
properties of the gas path into the sensor, though experimental errors in the
measurement of the diffusion properties make the calculation less accurate than
calibrating with test gas.
2.4.5.2.3 CROSS SENSITIVITY:
For some gases such as ethylene oxide, cross sensitivity can be a problem because
ethylene oxide requires a very active working electrode catalyst and high operating
potential for its oxidation. Therefore gases which are more easily oxidized such as
alcohols and carbon monoxide will also give a response. Cross sensitivity problems
can be eliminated though through the use of a chemical filter, for example filters that
allows the target gas to pass through unimpeded, but which reacts with and removes
common interferences.
While electrochemical sensors offer many advantages, they are not suitable for every
gas. Since the detection mechanism involves the oxidation or reduction of the gas,
electrochemical
which are
response. Sensors for carbon dioxide are an example of this approach and they have
been commercially available for several years.
2.4.6 MAX 3232:
INTRODUCTION:
The MAX232 is an integrated circuit that converts signals from an RS-232 serial
port to signals suitable for use in TTL compatible digital logic circuits. The MAX232
is a dual driver/receiver and typically converts the RX, TX, CTS and RTS signals.
The drivers provide RS-232 voltage level outputs (approx. 7.5 V) from a single
+ 5 V supply via on-chip charge pumps and external capacitors. This makes it useful
for implementing RS-232 in devices that otherwise do not need any voltages outside
the 0 V to + 5 V range, as power supply design does not need to be made more
complicated just for driving the RS-232 in this case.
The receivers reduce RS-232 inputs (which may be as high as 25 V), to standard
5 V TTL levels. These receivers have a typical threshold of 1.3 V, and a typical
hysteresis of 0.5 V.
The later MAX232A is backwards compatible with the original MAX232 but may
operate at higher baud rates and can use smaller external capacitors 0.1 F in place
of the 1.0 F capacitors used with the original device.
The newer MAX3232 is also backwards compatible, but operates at a broader
voltage range, from 3 to 5.5 V. Pin to pin compatible: ICL232, ST232, ADM232, and
HIN232.
2.4.7 VOLTAGE LEVELS:
It is helpful to understand what occurs to the voltage levels. When a MAX232 IC
receives a TTL level to convert, it changes a TTL Logic 0 to between +3 and +15 V,
and changes TTL Logic 1 to between -3 to -15 V, and vice versa for converting from
RS232 to TTL. This can be confusing when you realize that the RS232 Data
Transmission voltages at a certain logic state are opposite from the RS232 Control
Line voltages at the same logic state. To clarify the matter, see the table below. For
more information see RS-232 Voltage Levels.
RS232 Line Type & RS232 Voltage
Logic Level
Data
Transmission +3 V to +15 V
0V
(Rx/Tx) Logic 0
Data
Transmission -3 V to -15 V
5V
(Rx/Tx) Logic 1
Control
Signals -3 V to -15 V
5V
(RTS/CTS/DTR/DSR)
Logic 0
Control
Signals +3 V to +15 V
0V
(RTS/CTS/DTR/DSR)
Logic 1
is
Many
relays
use an
control and controlled circuits), or where several circuits must be controlled by one
signal. The first relays were used in long distance telegraph circuits as amplifiers.
They repeated the signal coming in from one circuit and re-transmitted it on
another circuit. Relays were used extensively in telephone exchanges and early
computers to perform logical operations.
voltage spikes while driving inductive loads. The schematic for each driver is
given below:
2.4.8.1 FEATURES
50 V output
2.4.8.2APPLICATIONS
Drive relays
LED displays or lamp
Stepper motors
It was invented by Joseph Henry in 1835. A relay is an electrical switch that
opens and closes under the control of another electrical circuit. In the
original form, the switch is operated by an electromagnet to open or close one or
many sets of contacts.
Switches is also applied to relays. A relay will switch one or more poles, each of
whose contacts can be thrown by energizing the coil in one of three ways:
1. Normally - open (NO)
2. Normally - closed (NC)
3. Change-over or double-throw
All relays contain a sensing unit, the electric coil, which is powered by AC or DC
current. When the applied current or voltage exceeds a threshold value, the coil
activates the armature, which operates either to close the open contacts or to open
the closed contacts. When a power is supplied to the coil, it generates a magnetic
force that actuates the switch mechanism. The magnetic force is, in effect,
relaying the action from one circuit to another. The first circuit is called the
control circuit; the second is called the load circuit.
Electromechanical Relays
In our project we will be using an electromechanical relay, which will be a 5 pin
relay and the working of the relay will be like as. The general-purpose relay is
rated by the amount of current its switch contacts can handle. Most versions of the
general-purpose relay have one to eight poles and can be single or double throw.
These are found in computers, copy machines, and other consumer electronic
equipment and appliances.
Relay Driver (Uln2003):
The ULN2001A, ULN2002A, ULN2003 and ULN2004Aare high Voltage, high
current Darlington arrays each containing seven open collector Darlington pairs
with common emitters. Each channel rated at 500mAand can withstand peak
currents of 600mA.Suppressiondiodesare included for inductive load driving and
the inputs are pinned opposite the outputs to simplify board layout. These versatile
devices are useful for driving a wide range of loads including solenoids, relays DC
Motors; LED displays filament lamps, thermal print heads and high power buffers.
The ULN2001A/2002A/2003A and 2004A are supplied in 16 pin plastic DIP
packages with a copper lead frame to reduce thermal resistance. They are available
also in small outline package (SO-16) as ULN2001D/2002D/2003D/2004D.
2.5 SOFTWARE COMPONENTS
2.5.1 KEIL Software
Keil compiler is software used where the machine language code is written and
compiled. After compilation, the machine source code is converted into hex code
which is to be dumped into the microcontroller for further processing. Keil
compiler also supports C language code.
STEPS TO WRITE AN ASSEMBLY LANGUAGE PROGRAM IN
KEIL AND HOW TO COMPILE IT:
A small window opens showing the options like new project, import
A small window with the title bar Create new project opens. The
window asks the user to give the project name with which it should be
created and the destination location. The project can be created in any of
the drives available. You can create a new folder and then a new file or can
create directly a new file.
The most widely used vendor is Atmel. So click on Atmel and now
the family of microcontrollers manufactured by Atmel opens. You can
select any one of the microcontrollers according to the requirement.
is the
AT89C51.
Click on this
A small window opens asking whether to copy the startup code into the
file you have created just now. Just click on No to proceed further.
Now you can see the TARGET and SOURCE GROUP created in the
project workspace.
Now click on File and in that New. A new page opens and you can
start writing program in it.
After the program is completed, save it with any name but with the
.asm extension. Save the program in the file you have created earlier.
You can notice that after you save the program, the predefined
keywords will be highlighted in bold letters.
Now add this file to the target by giving a right click on the source group.
A list of options open and in that select Add files to the source group.
Check for this file where you have saved and add it.
Right click on the target and select the first option Options for target.
A window opens with different options like device, target, output etc.
First click on target.
Now click the option Output and give any name to the hex file to
be created in the Name of executable text area and put a tick to the
Create HEX file option present in the same window.
The hex file can be created in any of the drives. You can change the
folder by clicking on Select folder for Objects.
Now to check whether the program you have written is errorless or not,
click on the icon exactly below the Open file icon which is nothing but
You can even use the shortcut key F7 to compile the program written.
To check for the output, there are several windows like serial
window, memory window, project window etc.
Click on this icon and now click on the option View and select
the appropriate window to check for the output.
After this is done, click the icon debug again to come out of the
debug mode.
Embedded C:
An embedded system is an application that contains at least one programmable
computer (typically in the form of a microcontroller, a microprocessor or digital
signal processor chip) and which is used by individuals who are, in the main,
unaware that the system is computer-based.
Typical examples of embedded applications that are constructed using the
techniques discussed in this book include:
Mobile phone systems (including both customer handsets and base stations).
Automotive applications (including braking systems, traction control, airbag
release systems, engine-management units, steer-by-wire systems and cruise
control Applications).
Domestic appliances (including dishwashers, televisions, washing machines,
microwave ovens, video recorders, security systems, garage door controllers).
Aerospace applications (including flight control systems, engine controllers,
autopilots and passenger in-flight entertainment systems).
Medical equipment (including anesthesia monitoring systems, ECG monitors,
drug delivery systems and MRI scanners).
Defense systems (including radar systems, fighter aircraft flight control systems,
radio systems and missile guidance systems).
Please note that our definition of embedded systems excludes applications such as
personal digital assistants (PDAs) running versions of Windows or similar
operating systems: from a developers perspective, these are best viewed as a cutdown version of a desktop computer system. This type of application makes up a
very small percentage of the overall embedded market.
CODING:
Embedded C:
#include <lpc214x.h>
#include <stdio.h>
#include "Utility.h"
#define DONE
0x80000000
#define START
0x01000000
*/
U0LCR = 0x83;
U0DLL = 195;
U0LCR = 0x03;
/* DLAB = 0
}
//-----------------------//Delay Routine start here
//-----------------------void delay(int n)
{
int i,j;
*/
*/
*/
for(i=0;i<n;i++)
{
for(j=0;j<0x5000;j++)
{;}
}
}
//Main program starts here
int main(void)
{
unsigned long val[4],T,G;
unsigned int ADC_CH,i=0;
float T_F;
PINSEL0 = 0x00000005;
PINSEL1
|=
//Enable ADC0.1
PINSEL1
|=
PINSEL1
|=
//Enable ADC0.3
VPBDIV
0x02;
AD0CR
0x00250602;
//Enable ADC0.2
AD0CR
|=
0x01000000;
serial_init();
//serial initialization
to complete
val[ADC_CH] = ((val[ADC_CH] >> 6) & 0x03FF);
ADC_CH++;
delay(10);
AD0CR
PRESET | (1<<ADC_CH);
AD0CR
|=
START;
} //Temperature
U0THR
= 0xAB;
delay(5);
U0THR
= 0xB1;
delay(5);
T=
delay(5);
T_F = T;
U0THR = T;
//PRE
U0THR
= 0xAB;
delay(5);
U0THR
= 0xB2;
delay(5);
G=
delay(5);
U0THR =G;
//GAS
U0THR
= 0xAB;
delay(5);
U0THR
= 0xB3;
delay(5);
G=
U0THR =P;
delay(5);