Professional Documents
Culture Documents
WI T H
PC INTERFACE
PROJECT REPORT
SUBMITTED TO THE UNIVERSITY OF PUNE
FOR PARTIAL FULFILMENT
OF THE DEGREE OF
B.E. ELECTRONICS
BY
ABY KURUVILLA
MARK SAMUEL
PROJECT GUIDES
Prof. (Mrs.) S.S. VEER (Internal)
Mr. PRASAD PRABHUGHATE (Company)
* 2005-2006 *
POONA DISTRICT EDUCATION ASSOCIATION’S
COLLEGE OF ENGINEERING
MANJRI ROAD, HADAPSAR PUNE-26
Date :
Place :
Certificate
Submitted By:
Aby Kuruvilla
Mark Samuel
Examiner ______________________
Date:
Place
Without hard work, determination and a systematic planning, we cannot
achieve anything in life. However, we do come across a lot of hurdles on the road to
achieving our goal. Here is when we need help, guidance, encouragement, co-
operation, etc from our elders, teachers, etc to overcome such hurdles. Here are a few
words to express our gratitude to a few such special people, without whose timely
help, guidance and blessings, we could not have completed our Project successfully
on time.
First and foremost, we would like to express our profound gratitude to
our Internal Guide, Prof. (Mrs.) S.S. Veer, who has been helping us right from the
conceptualization till the completion of this Project. We have been very fortunate to
get a lot of inspiration, suggestion and guidance from her. We also thank her for all
the help and support during the entire course of the project without which our project
would not have been a success.
We are very thankful to Mr. Prasad Prabhughate, Manager – PWA,
Integrated Supply Chain of Honeywell Automation India Limited, Pune for
suggesting us this project and providing us with constant support and guidance. In
spite of his very trying work schedule, he has always given us a patient listening and
shared his ideas with us at every stage of the Project. We also thank entire team of
Honeywell Automation India for giving us an opportunity to have this wonderful
experience and for providing us with a great working environment.
We are very grateful to Prof. C.G. PATIL (Head of the Department,
Electronics) for allowing us to do this project, and for his kind co-operation and
encouragement.
We would also like to thank all the staff members and the laboratory in
charges for their timely help.
Last but not the least, we take this opportunity to thank our parents for
their relentless support, encouragement, blessings and prayers throughout the project.
Aby Kuruvilla
Mark Samuel
TABLE OF CONTENTS
CHAPTER PAGE NO
RELAYS ………………………………………………………….47
6. SOFTWARE
FLOW CHART – MAIN PROGRAM ……………………………58
RTC TIME SET MODULE ……………………………………….59
USER INPUT PROGRAM MODULE ……………………………60
4.4. RUN PROGRAM MODULE ……………………………………..61
7. TESTING …………………………………………………..62
8. LIST OF COMPONENTS ………………………………..64
9. FUTURE SCOPE …………………………………............65
10. BIBLIOGRAPHY ………………………………………..66
11. DATA SHEETS
1. LITERATURE SURVEY
1
1. LITERATURE SURVEY
This study gave us an insight into the system requirements and helped
us to understand the proposed specifications better. Then we shifted our focus
towards component selection. We zeroed in on certain prime criteria for the selection
of components like easy availability, upgradeability, competitive pricing without
compromising on quality, compatibility and availability of study and reference
material. For this, we went through many data sheets and did a market survey and
then finalized the components.
Important topics like the serial port and I2C bus were understood
through “Serial Port Complete” by Jan Axelson and “Philips Application Data”
available on-line respectively. Data Sheets and other reference materials were
sourced through the net which helped us complete the project successfully.
2. INTRODUCTION
ENVIRONMENTAL TESTING
ENVIRONMENTAL TEST CHAMBER
PROJECT OBJECTIVES
PRODUCT SPECIFICATIONS
BLOCK DIAGRAM
BLOCK DIAGRAM DESCRIPTION
CIRCUIT SCHEMATIC
2
2. INTRODUCTION
Environmental testing calls for a complicated and expensive test facility with the
following provisions and precautions.
The temperature and humidity of the chamber are monitored by sensing
devices located in the work space.
The temperature and relative humidity in the work space can be maintained.
Provision for condensed water to be continuously drained out from the
chamber and not used until it has been re-purified.
Conditions prevailing throughout the work space must be kept uniform and as
similar as possible to those prevailing in the immediate vicinity of the
monitoring devices.
No condensed water from the walls or roof of the test chamber must fall on
the specimens.
The properties or loading of the specimen under test must not influence
conditions within the chamber.
4
Environmental
Chamber
Heater
Cooler
Temperature
Sensor
LM35
Relays
Microcontroller
89C51
Relay Driver
ADC
PCF8591 TxD ULN2003
RxD
MAX232
Keyboard To pc
Power
Supply
6
Through the key pad, the user can input the process starting time,
process ending time, the end temperature to be achieved and also to set the Real Time
Clock.
The Real Time Clock from Dallas DS12C887 is used as a system clock
and to control the process time.
The system is programmed to take the end temperature and end time to
be achieved in the environmental chamber as inputs from the user. Accordingly, the
system senses the temperature inside the environmental chamber and depending on
the magnitude of the temperature being sensed, the microcontroller drives the relays
through a relay driver (ULN2003). The relays, in turn, control the heater and cooler
till the end temperature is achieved. The periodically sensed environmental chamber
temperature and corresponding time are flashed on to the LCD display and the PC
through the serial interface.
3. HARDWARE
MICROCONTROLLER AT89C52
RELAYS
3. HARDWARE
Why use external devices which are expensive and increase the size of the
product? E.g.DS12C887. Why not replace DS12C887 by software implemented
time keeping?
Inherent time-accuracy of DS12C887 RTC chip cannot be achieved with
software-time keeping approach.
DS12C887 is Y2K compatible.
Incorporation of calendar facility is rather difficult without a dedicated RTC
hardware.
DS12C887 has on-chip battery backup facility.
Availability of 114 bytes of non-volatile RAM which will prove useful for
some added features.
Also chip is widely available at a reasonable price (around Rs.150/-)
The temperature sensor portion of the system uses a solid state temperature
sensor IC from National Semiconductor interfaced directly to ADC PCF8591.
Instead of using LM35 and PCF8591 combination, other superior alternatives
include very advanced devices LM 74, LM 75, DS 1820 etc. These devices
have temperature sensor, A/D converter and associated hardware to provide
direct digital output (in serial data format).
Example, LM 74 has a temperature range of -55oC-150 oC and communicates
with the microcontroller via SPI bus. It provides 13 bit signed binary value.
The IC has a temperature sensor and a SIGMA-DELTA A/D converter and
comes in 8 pin SMT package. It works on 3.3 to 5.5 V power supply.
9
2
LM 75 is quite similar to LM 74, except for the use of I C bus. It generates 9
bit serial output and has a comparator to indicate overflow out of the
temperature boundary value.
Disadvantage with these high end sensors is that they are neither widely
available nor inexpensive.
LM 35 is a cheaper alternative.
Another reason for using LM 35 and external A/D converter (PCF 8591) is
that it makes the circuit universal in the sense that practically any physical
quantity can be handled with this.
The microcontroller must meet the task at hand efficiently and cost
effectively. While analysing the needs of a microcontroller based project, the
designer must first see whether an 8-bit, 16-bit, 32-bit or 64-bit microcontroller
can best handle the computing needs of the task most effectively. Some of the
considerations in this category are:
Speed : The highest speed that the microcontroller supports
The type of packaging: eg. 40 pin DIP (Dual Inline Package) or QFP (Quad
Flat Package). This is important in terms of space, assembling and
prototyping of end product.
Power consumption
Amount of on-chip ROM and RAM
Number of I/O pins and timers on chip
Easy upgradability to higher performance or lower power consumption
versions.
Cost per unit
10
Physical size and pin arrangement: While choosing a relay for an existing
PCB, one needs to ensure that its dimensions and pin arrangement are suitable.
This information can be found in the supplier's catalogue.
Coil voltage: The relay's coil voltage rating and resistance must suit the circuit
powering the relay coil. Many relays have a coil rated for a 12V supply but 5V
and 24V relays are also readily available. Some relays operate perfectly well
with a supply voltage which is a little lower than their rated value.
Coil resistance: The circuit must be able to supply the current required by the
relay coil. Ohm’s law can be used to calculate the current:
supply voltage
Relay coil current =
coil resistance
For example: A 12V supply relay with a coil resistance of 400 passes a
current of 30mA. This is OK for a 555 timer IC (maximum output current
200mA), but it is too much for most ICs and they will require a transistor to
amplify the current.
Switch ratings (voltage and current): The relay's switch contacts must be
suitable for the circuit they are to control. The voltage and current ratings need
to be checked. Note that the voltage rating is usually higher for AC, for
example: "5A at 24V DC or 125V AC".
11
Switch contact arrangement (SPDT, DPDT etc): Most relays are SPDT
(Single Pole, Double Throw - This switch can be on in both positions,
switching on a separate device in each case. It is often called a changeover
switch) or DPDT (Double Pole, Double Throw - A pair of on-on switches
which operate together) which are often described as "Single Pole
Changeover" (SPCO) or "Double Pole Changeover" (DPCO).
Advantages of relays:
Relays can switch AC and DC, transistors can only switch DC.
Relays can switch high voltages, transistors cannot.
Relays are a better choice for switching large currents (> 5A).
Relays can switch many contacts at once.
Disadvantages of relays:
Very low current required (in mA) for driving LCD. Maximum 15mA
required.
Numeric values and alphabets can be easily displayed, and also some graphics
can be displayed.
Interfacing to microcontroller is easy.
LED displays require more current.
Features:
Description
The AT89C52 is a low power, high performance CMOS 8-bit
microcomputer with 8K bytes of Flash Programmable and Erasable Read Only
Memory (PEROM). The device is manufactured using Atmel’s high density
nonvolatile memory technology and is compatible with the industry standard 80C51
and 80C52 instruction set and pin out. The on-chip flash allows the program memory
to be reprogrammed in-system or by a conventional nonvolatile memory programmer.
By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel
AT89C52 is a powerful microcomputer which provides a highly flexible and cost
effective solution to many embedded control applications.
Pin Configuration:
PDIP
14
PIN DESCRIPTION :
Port 0 : Port 0 is an 8-bit open-drain bi-directional I/O port. Port 0 occupies a total of
8 pins (pins 32 – 39). It can be used for input or output. To use the pins of Port 0 (P 0)
as both input and output ports, each pin must be connected externally to a 10K ohm
pull-up resistor. This is due to the fact that P0 is an open drain, unlike P1, P2, P3.
Open drain is a term used for MOS chips in the same way that open collector is used
for TTL chips.
Port 0 also receives the code bytes during Flash programming, and
outputs the code bytes during program verification. External pull-ups are required
during program verification.
Port 1: Port 1 is an 8-bit bi-directional I/O port with internal pull-ups and occupies
pins 1 through 8. Port 1 output buffers can sink/source four TTL inputs. When 1s are
written to Port 1 pins they are pulled high by the internal pull-ups and can be used as
inputs. Upon reset Port 1 is configured as output port. Port 1 also receives the low-
order address bytes during Flash programming and verification.
Port 2: Port 2 is an 8 bit bidirectional I/O port with internal pull-ups and occupies
pins 21 through 28. Port 2 output buffers can sink/source four TTL inputs. When 1s
are written to Port 2 pins they are pulled high by the internal pull-ups and can be used
as inputs. Upon reset Port 2 is configured as output port. Port 2 emits the high-order
address byte during fetches from external program memory and during accesses to
external data memory that use 16 bit addresses. In this application it uses strong
internal pull-ups when emitting 1s. During accesses to external data memory that use
8 bit addresses, Port 2 emits the contents of the P2 Special Function Register. Port 2
also receives the high order address bits and some control signals during Flash
programming and verification.
Port 3: Port 3 is an 8 bit bidirectional I/O port with internal pull-ups and occupies
pins 10 through 17. Port 3 output buffers can sink/source four TTL inputs. When 1s
are written to Port 3 pins they are pulled high by the internal pull-ups and can be used
as inputs. Although Port 3 is configured as an output port upon reset, this is not the
way it is most commonly used. Port 3 has the additional function of providing some
extremely important signals of the AT89C51 as listed below.
RST: RST pin 9 is the reset pin. It is an input and is active high (normally low). Upon
applying a high pulse to this pin, the microcontroller will reset and terminate all
activities. This is often referred to as a power-on reset. Activating a power-on reset
will cause all values in the registers to be lost. In order for the reset input to be
effective, it must have a minimum duration of two machine cycles. In other words the
high pulse must be high for a minimum of two machine cycles before it is allowed to
go low. A machine cycle is defined as 12 oscillator periods.
ALE/PROG: The ALE or the Address Latch Enable (Pin 30) is an output pulse and is
active high. It is used for latching the address during accesses to external memory.
This pin is also the program pulse input (PROG) during flash programming. The
ALE pin is used for demultiplexing the address and data bus.
PSEN: The PSEN or Program Store Enable (Pin 29) is an output pin. It is the read
strobe to external program memory. When the AT89C52 is executing code from
external program memory, PSEN is activated twice each machine cycle, except that
two PSEN activations are skipped during each access to external data memory.
EA/VPP: The EA or External Access Enable (Pin 31) must be strapped to GND in
order to enable the device to fetch code from external program memory locations
starting at 0000H to FFFFH. If lock bit 1 is programmed, EA will be internally
latched on reset.
17
XTAL1: XTAL1 (Pin 19) acts as input to inverting oscillator amplifier and internal
clock operating circuit.
XTAL2: XTAL2 (Pin 18) acts as output from the inverting oscillator amplifier.
Oscillator Characteristics
XTAL1 and XTAL2 are the input and output respectively of an inverting amplifier
which can be configured for use as an on-chip oscillator as shown in Figure below.
Most often a quartz crystal or ceramic resonator may be used. The quartz crystal is
connected to inputs XTAL1 (Pin 19) and XTAL2 (Pin 18). The quartz crystal
oscillator connected to XTAL1 and XTAL2 also needs two capacitors of 30pF value.
If ceramic resonators are connected between XTAL1 and XTAL2, two 40pF
capacitors are used. One side of each capacitor is connected to the ground.
Figure
Idle Mode
In idle mode, the CPU puts itself to sleep while all on-chip peripherals remain active.
The mode is invoked by software. The content of on-chip RAM and all special
function registers remain unchanged during this mode. The idle mode can be
terminated by enabling an interrupt or by a hardware reset.
Power-Down Mode
In the power-down mode, the oscillator is stopped and the instruction that invokes
power-down is the last instruction executed. The on-chip RAM and special function
registers retain their values until the power-down mode is terminated. The only exit
from power-down is a hardware reset. Reset redefines the SFRs, but does not change
the on-chip RAM.
Features:
Calibrated directly in Celsius (Centigrade)
Linear + 10.0mV/°C scale factor
0.5°C accuracy guaranteeable (+25 °C)
Rated for full -55 °C to +150 °C range
Suitable for remote applications
Low cost due to wafer level trimming
Operates from 4 to 30 volts
Less than 60µA current drain
Low self-heating, 0.08°C in still air
Non-linearity only ±¼°C typical
Low impedance output, 0.1 Ω or 1 mA load
20
Vout
Vcc GND
Description:
The LM35 series are precision integrated-circuit temperature sensors,
manufactured by National Semiconductor, whose output voltage is linearly
proportional to the Celsius (Centigrade) temperature. The LM35 thus has an
advantage over linear temperature sensors calibrated in ° Kelvin as the user is not
required to subtract a large constant voltage from its output to obtain convenient
centigrade scaling.
Features:
General Description:
Pin Description
Functional Description:
MSB LSB
1 0 0 1 A2 A1 A0 R/W
Addressing:
Each PCF-8591 device in an I2C bus system is activated by sending a valid address to
the device. The address consist of a fixed part and a programmable part. The address
always has to be sent as the first byte after the start condition in the I2C bus protocol.
The last bit of the address byte is the read/write-bit which sets the direction of the
following data transfer.
Control Byte:
The second byte sent to a PCF 8591 device will be stored in its control register and is
required to control the device function.
MSB LSB
0 x x x 0 x x x
7 6 5 4 3 2 1 0
AUTOINCREMENT FLAG
00 Channel 0
01 Channel 1
10 Channel 2
11 Channel 3
D/A Conversion:
The third byte sent to the PCF 8591 is stored in the DAC data register
and is converted to the corresponding analog voltage using the on-chip D/A converter
which consists of a resistor divider chain connected to an external reference voltage
with 256 taps and selection switches. The analog output voltage is buffered by an
auto-zeroed unity gain amplifier.
A/D Conversion:
The A/D converter makes use of successive approximation technique. The on-chip
D/A converter and a high gain comparator are used temporarily during an A/D
conversion cycle. An A/D conversion cycle is started after sending a valid read mode
address to a PCF 8591 device. A/D conversion cycle is triggered at the trailing edge
of the acknowledged clock pulse. The conversion result is stored in the ADC data
register and awaits transmission.
25
Reference Voltage:
For the D/A and A/D conversion, either a stable external voltage
reference or the supply voltage has to be applied to the register divider chain (pins
VREF and AGND). The AGND pin has to be connected to the system analog ground.
The D/A converter can be used as one quadrant multiplier by applying a low
frequency to VREF and AGND. The A/D converter may be used as a one or two
quadrant analog divider by dividing the analog input voltage by the reference voltage.
Oscillator:
An on-chip oscillator generates the clock signal required for the A/D
conversion cycle and for refreshing the auto-zeroed buffer amplifier. When using the
oscillator, EXT pin must be connected to VSS. At the OSC pin, the oscillator
frequency is available. To feed an external clock signal to OSC, the EXT pin must be
connected to VDD.
Designer Benefits:
I2C bus compatible ICs allow system design to rapidly progress from a
functional block diagram to a prototype. Since they clip directly onto the I2C bus
without any additional external interfacing, they allow easy upgradation and
modification of the prototype.
Here are some of the features of I2C bus compatible ICs particularly useful for
designers.
Functional blocks on the block diagram correspond with actual ICs; designs
proceed rapidly from block diagram to final schematic.
No need to design bus interfaces because the I2C bus interface is already
integrated on-chip.
Integrated addressing and data transfer protocol allow systems to be
completely software defined.
27
Manufacturer Benefits:
I2C bus compatible ICs provide a wide range of benefits to manufacturers also. They
are:
The simple 2-wire serial I2C bus minimizes inter-connections, so ICs have
fewer pins thus reducing the number of PCB tracks resulting in smaller and
less expensive PCBs.
The completely integrated I2C bus protocol eliminates the need for address
decoders and other ‘glue logic’.
The multi-master capability of the I2C bus allows rapid testing and alignment
of end-user equipment via external connections to the assembly line.
The availability of I2C bus compatible ICs in SO (Small Outline), VSO (Very
Small Outline) as well as DIL packages reduces space requirement even more.
28
In addition to this, I2C bus compatible ICs increase system design flexibility
by allowing simple construction of equipment variants and easy
upgradeability.
TERM DESCRIPTION
MULTI MASTER More than one master can attempt to control the bus at the
same time without corrupting the message.
Master reads slave immediately after first byte. At the moment of the first
acknowledge, the master-transmitter becomes master-receiver and slave-
receiver becomes a slave-transmitter. This first acknowledge is still generated
by the slave. The stop condition is generated by the master, which has
previously sent a not-acknowledge.
NOTE
Features:
Description:
Pin Description:
32
Operation:
The block diagram below shows the pin connection and major internal functions of
DS12C887. The following paragraphs describe the functions of each pin.
When Vcc falls below 4.25V, the chip select input is internally forced to an inactive
level regardless of the value of CS at the input pin. The DS12C887 is therefore write-
protected. When the DS12C887 is in write-protected state, all the inputs are ignored
and all outputs are in high impedance state. When Vcc falls below 3V, the external
Vcc supply is switched off and an internal lithium energy source supplies power to the
Real Time Clock and the RAM memory.
Signal Descriptions:
GND, Vcc DC power is provided to the device on these pins. Vcc is the
+5V input. When 5V is applied within normal limits, the device is fully
accessible and data can be written and read. When Vcc is below 4.25V, reads
and writes are inhibited. However, the time keeping function continues
unaffected by the low input voltage. When Vcc falls below 3V, the RAM and
time keeper are switched over to the internal lithium energy source. The time
keeping function has an accuracy of ±1 minute per month at 250C regardless
of the input voltage on Vcc pin.
MOT (Mode Select) The MOT pin offers the flexibility to choose
between two bus types. When connected to Vcc, Motorola bus timing is
selected. When connected to ground or left disconnected, Intel bus timing is
selected. The pin has internal pull-down resistance of approximately 20KΩ.
SQW (Square Wave Output) The SQW pin can output a signal from one
of the 13 taps provided by the 15 internal divider stages of the Real Time
Clock. Frequency of the SQW pin can be changed by programming Register
A. The SQW signal can be turned on and off using SQWE bit in Register B.
The SQW signal is not available when Vcc is less than 4.25V.
AD0-AD7 (Multiplexed Bidirectional Address/Data Bus) Multiplexed
buses save pins because address information and data information time share
the same signal paths. Address/data multiplexing does not slow access time
of the DS12C887 since the bus change from address to data occurs during the
internal RAM access time.
34
DS (Data Strobe or Read Input) The DS/RD pin has two modes of
operation depending on the level of the MOT pin. When MOT is connected
to Vcc (i.e. Motorola bus timing selected), DS is a positive pulse during the
latter portion of the bus cycle and is called data strobe. During read cycles,
DS signifies the time that the DS12C887 is to drive the bidirectional bus. In
write cycles, the trailing edge of DS causes the DS12C887 to latch the written
data. When MOT pin is connected to GND (i.e. Intel bus timing selected), DS
pin is called Read (RD). RD identifies the time period when the DS12C887
drives the bus with red data.
R/W (Read/Write Input) The R/W pin has two modes of operation.
When MOT pin is connected to Vcc (Motorola timing), R/W indicates
whether the current cycle is a read or write. A read cycle is indicated by a
high level on R/W while DS is high. Write cycle is indicated when R/W is
low during DS. When the MOT pin is connected to GND (Intel timing), the
R/W signal is an active low signal called WR, i.e. a write enable signal.
CS (Chip Select Input) The chip select signal must be asserted low for a
bus cycle in DS12C887 to be accessed. CS must be kept in active state during
DS and AS for Motorola timing and during RD and WR for Intel timing. Bus
cycles which take place without asserting CS will latch addresses but no
access will occur. When Vcc falls below 4.25V, the DS12C887 internally
inhibits access cycles by internally disabling the CS input to protect the Real
Time Clock data and RAM data during power outages.
35
IRQ (Interrupt Request Output) The IRQ pin is an active low output of
the DS12C887 that can be used as an interrupt input to a processor. The IRQ
output remains low as long as the status bit causing the interrupt is present and
the corresponding interrupt enable bit is set. To clear the IRQ pin, the
processor program normally clears the C Register. Multiple interrupting
devices can be connected to an IRQ bus. The IRQ bus is an open drain output
and requires an external pull-up resistor.
RESET (Reset Input) The reset pin has no effect on the clock, calendar
or RAM. On power-up, the reset pin can be held low for a time, to allow the
power supply to stabilize depending on the application. If reset is used on
power-up, the time for which reset is low should not exceed 200 ms. When
reset is low and Vcc is above 4.25V, the Periodic Interrupt Enable (PEI),
Alarm Interrupt Enable (AIE), Update Ended Interrupt Flag (UF), Interrupt
Request Status Flag (IRQF), Periodic Interrupt Flag (PF), Alarm Interrupt
Flag (AF), Square Wave Output Enable (SQWE), Update Ended Interrupt
Enable (UIE) bits are cleared to zero. IRQ pin is in high impedance state.
The device is not accessible until reset is returned high. In a typical
application, reset can be connected to Vcc allowing the DS12C887 to go in
and out of power fail without affecting any of the control registers.
Introduction: Computers transfer data in two ways: parallel and serial. In parallel
data transfers, often 8 or more lines (wire conductors) are used to transfer data to a
device that is only a few feet away, example printers, hard disks, etc. Although in
such cases a lot of data can be transferred in a short amount of time by using many
wires in parallel, the distance cannot be great. To transfer to a device located many
meters away, the serial method is used. In serial communication, the data is sent one
bit at a time in contrast to parallel communication, in which the data is sent a byte or
more at a time. As the AT89C52 has built-in serial communication capability, it is
possible for fast data transfer using only a few wires.
36
D0
Sender Receiver
Sender Receiver
D7
Data Transfer Rate: The rate of data transfer in serial data communication is stated
in bps (bits per second). Another widely used terminology for bps is baud rate.
However, baud and bps rates need not be equal because baud rate is defined as the
number of signal changes per second and there might be occasions when a single
change of signal transfers several bits of data, e.g. modems. As far as conductor wires
are concerned, baud rate and bps are the same. In asynchronous serial data
communication, the baud rate is generally limited to 100,000 bps.
RS-232 Pins:
The table below provides the pins and labels for the RS-232 cable,
commonly referred to as the DB-25 connector. In labelling, DB-25P refers to the plug
connector (male) and DB-25S is for the socket connector (female).
40
Since not all the pins are used in PC cables, IBM introduced the DB-9 version of the
serial I/O standard, which uses 9 pins only as shown in table below. The DB-9 pins
are as shown in figure below.
To ensure fast and reliable data transmission between two devices, the
data transfer must be coordinated. Many of the pins of RS-232 connector are used
for handshaking signals. Their description is provided below.
Note: These are not supported by the 8051 UART chip.
DTR (Data Terminal Ready): When the terminal (or PC COM port) is
turned on, after going through a self-test, it sends out signal DTR to indicate
that it is ready for communication. This is an active-low signal. This signal
will not be activated if there is something wrong with the COM port.
DSR (Data Set Ready): When the DCE is turned on and has gone through
the self-test, it asserts DSR to indicate that it is ready to communicate. Thus it
can be an output from the modem (DCE) and input to the PC (DTE). This is
an active-low signal. If the modem cannot make a connection to the
telephone, this signal remains inactive.
RTS (Request To Send): When the DTE device has a byte to transmit, it
asserts RTS to signal the modem that it has a byte of data to transmit. RTS is
an active-low output from the DTE and input to the DCE.
CTS (Clear To Send): In response to the RTS, the DCE has room for storing
the data it is to receive, it sends out signal CTS to the DTE to indicate that it
can receive the data now so that the DTE can start transmission.
43
DCD (Data Carrier Detect): The modem asserts signal DCD to inform the
DTE that a valid carrier has been detected and that contact between it and the
modem is established. DCD is an output from the modem and an input to the
PC.
RI (Ring Indicator): An output from the modem (DCE) and an input to a PC
(DTE) indicate that the telephone is ringing. It goes on and off in
synchronization with the ringing sound. It is least used handshaking signal as
modems take care of answering the phone. It is used if the PC is in charge of
an answering the phone in a given system.
Introduction:
Description:
Features:
PIN Configuration:
Features:
PIN Connection:
Description:
3.8. Relays
Relays
A relay is an electrically operated switch. Current flowing through the coil of the
relay creates a magnetic field which attracts a lever and changes the switch contacts.
The coil current can be on or off so relays have two switch positions and they are
double throw (changeover) switches.
Relays allow one circuit to switch a second circuit which can be completely separate
from the first. For example a low voltage battery circuit can use a relay to switch a
230V AC mains circuit. There is no electrical connection inside the relay between the
two circuits, the link is magnetic and mechanical.
The coil of a relay passes a relatively large current, typically 30mA for
a 12V relay, but it can be as much as 100mA for relays designed to operate from
lower voltages. Most ICs (chips) cannot provide this current and a transistor is usually
used to amplify the small IC current to the larger value required for the relay coil. The
maximum output current for the popular 555 timer IC is 200mA so these devices can
supply relay coils directly without amplification.
48
Most relays are designed for PCB mounting but you can solder wires directly to the
pins, provided you take care to avoid melting the plastic case of the relay.
The supplier's catalogue should show you the relay's connections. The coil will be
obvious and it may be connected either way round. Relay coils produce brief high
voltage 'spikes' when they are switched off and this can destroy transistors and ICs in
the circuit. To prevent damage a protection diode needs to be connected across the
relay coil.
The relay's switch connections are usually labelled COM, NC and NO:
COM = Common, always connect to this, it is the moving part of the switch.
NC = Normally Closed, COM is connected to this when the relay coil is off.
NO = Normally Open, COM is connected to this when the relay coil is on.
Connect to COM and NO for the switched circuit to be on when the relay coil
is on.
Connect to COM and NC for the switched circuit to be on when the relay coil
is off.
Description:
Definition of Terminals:
Before sending commands or data to the LCD module, the module must be
initialized. This is done using the following series of operations for 8-bit mode:
A power supply is a vital part of all electronic systems. Most digital ICs including
microprocessors, microcontrollers and memory ICs operate on ± 5V supply. The
power supply consists of Step-Down Transformer, Bridge Rectifier, Filter and IC
Regulator. The figure below shows the block diagram of a typical power supply.
Concept:
The schematic above shows the design of a power supply that provides
an output voltage of +5V at 0.5A. The +5V supply voltages are obtained from the
12V step down transformer. The secondary output of the transformer is applied to the
bridge rectifier circuit made using diodes IN4007 which convert the sinusoidal inputs
into full wave rectified outputs. The filter capacitor (electrolytic) at the output of the
bridge rectifier is charged to the peak value of the rectified output voltage whenever
52
the diodes are forward biased. Since the diodes are not forward biased during the
entire positive and negative half cycle of the input wave form, the voltage across the
filter capacitor is a pulsating DC that is a combination of DC and a ripple voltage.
From the pulsating DC voltage, a regulated DC voltage is extracted by a regulator IC
(7805).
Design Process:
Let us first consider how the +5V supply voltages are obtained in the
circuit. The 7805 is a ±5V regulator and it can deliver output current in an excess of
1A. Hence, it will perform satisfactorily in the circuit providing ±5V at 0.5A.
However, since the drop out voltage (Vin – Vo) is 2V, the input voltage of 7805
must be at least +7V, which it turn implies that the secondary voltage must be larger
than 14V peak or 10Vrms. The voltage across the transformer secondary is 12Vrms,
thus satisfying the minimum voltage requirement of 10Vrms. Also the peak voltage
at the secondary is 6(√2) = 8.5V peak which is less than the maximum peak voltage
of 7805.
During the positive half cycle, the diodes D1 and D3 conduct and
capacitor C4 charges towards the positive peak value ≈8.5V. During the negative half
cycle of the input wave form, diode D2 and D4 conduct and charge capacitor C4
towards the peak voltage of 8.5V. Note that the diode that conducts during either the
positive or negative half cycle does not do so for the entire half cycle. The diode
conducts only during the time the anodes are positive w.r.t the cathodes, i.e., when the
diodes are forward biased, the capacitors are charged by current pulses. The
maximum average rectified current Iomax that IN4007 can safely handle is 1 A.
In addition, when the power supply is first turned on, the initial charging of the
capacitor causes a large transient current called the surge current IFS to pass through
the diodes for a short period. It is larger than Iomax. For IN4007, the surge current
IFSM is 30A.
53
Finally, the size of the filter capacitor depends on the secondary
current rate of transformer. As a rule of thumb, a 1500µF capacitor should be used
for each ampere of current. The working voltage rating of the capacitor must be at
least 20% higher than the peak value of the voltage it is expected to charge to.
Capacitor C4 satisfies this requirement. The capacitor C5 at the output of 7805
regulator helps to improve the transient response and should be in the range of
1µF. The power dissipated by the 5V regulator is given by:
5. PCB DESIGN
Types of Boards:
Two most popular types of PCBs are:
Single sided boards: Single sided PCBs are used mostly in entertainment
electronics, industries where manufacturing costs have to be kept to the
minimum or during prototype testing. To jump over conductor tracks, jumper
wires are used. Jumper wire should be minimum, otherwise use of double
sided PCBs should be considered.
Double sided boards: Double sided PCBs can be made with or without
plated through holes. Boards with plated through holes are fairly expensive
and are chosen only where the circuit complexity and density do not leave any
other choice.
55
PCB Construction:
PCB consists of two layers.
Laminate: Laminate consists of filler material with resin. The common filler
materials are paper, rags, craft paper. Common resins used are phenolic,
epoxy, polytetra fluoro ethylene (PTFE).
Copper foil: The copper cladding is having a thickness of 35 µ or 70 µ.
Copper foil is pressed against the laminate at a temperature of 150-1700C and
a pressure of 20-80 cm2.
Paper Phenolic: It is one of the cheapest types of PCBs available with lower
mechanical strength. It is used in entertainment electronics and prototype
testing.
Glass Epoxy: This type of PCBs contain glass cloth as filler material. It has
high mechanical strength and is highly resistant to insulation. It is costlier
than paper phenolic PCBs.
PTFE PCB: It is a double sided PCB. It has very good insulation and good
mechanical strength and is costlier than glass epoxy. It is used for high
switching circuits.
Multi-layered PCB: It is manufactured by computer controlled machines.
The pins go through the layers without making any contact with other layers in
the PCB. It is useful when there are various signal levels and supply voltage
in the electronic circuits. It is difficult to repair such PCBs and needs to be
thrown away.
56
Completing the PCB layout is the first part of the process that culminates in the
fabrication and assembly of the PCB. The link between the design and finished board
are the print, Gerber and NC drill fabrication files, as well as the Bill of Materials,
testpoint report, and pick and place assembly files.
Once the PCB design process is complete and the design has passed all
the design rule checks, the Gerber files are generated, one for each layer needed in the
fabrication process. The Gerber language is the standard language format used to
transfer PCB layout data from the PCB design software to the phototool creation
process. These Gerber files are then sent to the manufacturer, who loads them into a
photoplotting machine and creates the phototools.
58
6. SOFTWARE
Flowchart:
Start
Initialize LCD
Display ‘Welcome’
Messages
Any Command
No Key Pressed?
Yes
59
A
Start
Enter Present
Hour Value <24
Is ‘Set Key’
Pressed?
No
Yes
Enter Present
Minute Value <60
Is ‘Set Key’
Pressed?
No
Yes
Is ‘Set Key’
Pressed?
No
Yes
Stores Process Start
Time in RTC
Is ‘Set Key’
* Program 1 *
Pressed?
No
Yes
Stores Process End
Time in RTC
Enter End
Temperature to be
Achieved <100
Is ‘Set Key’
Pressed?
No
Yes
Stores End
Temperature in RTC
* Program 5 *
No
Is Present Time=
Start Time?
Yes
Read Present Temp from CH1 of ADC
No No
Is Present Is Present Heater Off, Cooler
Temp=End Temp<End On & Alarm On
Temp Temp
Yes Yes
Heater & Cooler Off Heater On & Cooler Off
No
Is Present
Time =End
Time?
Yes
End Process
7. TESTING
“If you don’t test and engineer right, if the people and engineers are not right,
you know the consequences, right?” …. National Technical Systems Corp.
Keeping the specifications and end product in mind, the testing was
done in a step-by-step procedure.
Once the schematic and the PCB design were finalized, we split the rest of the
project into different modules and kept upgrading the software and testing each
module using SIM31 simulator.
PCB Testing: The PCB was tested by tracing the tracks from the netlist and
the artwork of the PCB. The errors in the artwork were eliminated while
testing and after that it was given for PCB manufacture. The PCB was tested
using DMM to check continuity of tracks.
LCD Module Testing: Once we had the PCB in hand, our motto was to check
the PCB design. For this, we mounted just enough components (power
supply, LCD through connector, microcontroller with crystal and reset switch)
and developed a basic LCD initialization program to check whether
microcontroller, crystal, reset circuit and LCD display were working.
RTC Time Set Module Testing: Once the LCD program was found working,
we shifted our focus to displaying the present time. For this, we mounted the
RTC (DS12C887) and developed an RTC initialization program to both
display and edit the time on LCD.
63
8. LIST OF COMPONENTS
Approx. cost
S.No. Name of parts Manufacturer Nos.
(Rs.)
1 AT89C52 Atmel 75 1
2 PCF8591 Philips 200 1
3 MAX-232 Maxim 50 1
4 LCD (2 x 16) 250 1
5 DS12C887 Dallas 250-300 1
6 Relay 15 2
7 ULN-2003 ST 10 1
National
8 LM 35 75 1
Semiconductor
9 7805 ST 15 2
10 Power Supply - 300-350 -
11 PCB (Artwork) - 10/sq.cm. -
IC sockets
40 pm 5
12 -
8 pm 2
16 pm 3
DS 12887
13 - 4 1
socket
LCD
14 - 25 1
Connector
Presto
15 Cabinet 1
Enclosures
16 Buzzer - 20 1
Connectors
17 - 10
(RS-232)
18 Crystal - 10 1
19 Switches - 8/switch 1
4x4 Key Pad
20 - 190 1
(Tactile)
9. FUTURE SCOPE
65
9. FUTURE SCOPE
When we set forth to make this project, the basic aim in mind was to
make a competitively priced environmental chamber controller which can simulate
the harsh weather conditions faced by electronic equipments in real environments.
The controller needed to be user-friendly, ergonomic, and fully user-programmable in
real time with computer interface and data logging.
Although, in the short time available to us we have managed to achieve
our target, we would like to see our project being transformed into a valued product
being used by industries with many more added features. A few added features which
we can think of now are listed below.
Ability to remotely load the system and interact with it through software.
Self-diagnosis and ability to detect errors with better control system.
We have used RS232 serial communication and given a provision to upgrade
to RS485 in future which we would like to see as a standard feature in our
product in future. RS485 would help to increase the distance of data
transmission helping it to operate remotely.
At the moment we are controlling only the temperature and time. We would
like more parameters like humidity, pressure, vibration, etc being controlled.
The PCF8591 A/D converter which we have used allows upgradeability to
control three more parameters.
Hopefully in the future with better sensors flooding the market at affordable
rates, we could get better and properly calibrated sensors to control more
parameters and over a greater range.
At present the data logged is only the present temperature and the
corresponding time (hours and minutes) which is flashed on the PC through
Hyper Terminal. We would like to improve data logging in future by using an
exclusive VB software with a good and easy user interface.
Although the user-programmed data is safe even in case of a power failure in
the real time clock, the controller would go off in case of a power failure. We
can avoid this by using a battery back-up.
Also the product would do well with better looks by using a custom made key
pad and enclosure.
10. BIBLIOGRAPHY
66
10. BIBLIOGRAPHY
Books:
1. The 8051 Microcontroller and Embedded Systems
- Muhammad Ali Mazidi and
Janice Gillispie Mazidi
2. Programming & Customizing the 8051 Microcontroller
- Myke Predko
3. Microcontroller Design & Projects Handbook
- Chandra Sekhar Roy
4. Serial Port Complete
- Jan Axelson
5. Op-Amps and Linear Integrated Circuits
- Ramakant A. Gayakwad
6. Printed Circuit Boards
- Bosshart
7. National Semiconductor Analog Products Data Book
8. Microprocessor and Microcontroller
- Techmax Publication
On-Line Resources:
1. www.atmel.com
2. www.maxim-ic.com
3. www.semiconductors.philips.com
4. www.national.com
5. www.st.com
6. www.iguanalabs.com
7. www.zytrax.com
8. http://eserver.bell.ac.uk/mirrors/dc100www/dc_014.htm
9. www.keylabs.com
10. www.ntscorp.com