Friday, 12 July 2013


“INDUSTRIAL PROCESS MONITORING AND CONTROL SYSTEM ”

ABSTRACT

In today’s technology oriented world, the industries have emerged as the biggest gainers of this technological revolution. With the use of latest and newly emerging technologies the industries have now begun to produce large varieties of products on a large scale. But in mass producing the required goods it becomes imperative that the quality of these goods should also be maintained. For such purposes to retain the quality of the goods it becomes necessary to regulate the parameters associated with that product. Among the most important parameters, the parameters like “Temperature, Light intensity, Level, etc.”, which became increasingly associated with the precise and qualitative manufacturing of the required products. Hence it became necessary to develop certain systems, which would not only monitors the parameters associated with the product and the surrounding conditions but also regulate them within the specified ranges.

The project “MICROCONTROLLER BASED INDUSTRIAL PROCESS MONITORING AND CONTROL SYSTEM” is an effective and efficient system designed and developed for regulating the parameters like Temperature, Light Intensity and Level to the optimum level. This project comprises of the latest devices such as Microcontroller, A/D converter and various type of sensors. It is hoped that this project will contribute in developing more modern systems for monitoring and regulating the parameters in the industries.

Chapter 1
Introduction

1.1 Background

In today’s technology oriented world, the industries have emerged as the biggest gainers of this technological revolution. With the use of latest and newly emerging technologies the industries have now begun to produce large varieties of products on a large scale. But in mass producing the required goods it becomes imperative that the quality of these goods should also be maintained.

For such purposes to retain the quality of the goods it becomes necessary to regulate the parameters associated with that product. Among the most important parameters, the parameters like “Temperature, Light intensity, Level, etc.”, which became increasingly associated with the precise and qualitative manufacturing of the required products. Hence it became necessary to develop certain systems, which would not only monitors the parameters associated with the product and the surrounding conditions but also regulate them within the specified ranges.

1.2 Project objectives 

The project “MICROCONTROLLER BASED INDUSTRIAL PROCESS MONITORING AND CONTROL SYSTEM” is an effective and efficient system designed and developed for regulating the parameters like Temperature, Light Intensity and Level and to the optimum level.

This project comprises of the latest devices such as Microcontroller, A/D converter and various type of sensors. It is hoped that this project will contribute in developing more modern systems for monitoring and regulating the parameters in the industries.

1.3 Outline of the project report

Chapter 1 includes the introduction and the basic idea and aim behind the project.
Chapter 2 includes general theory about the circuit at block diagram level.
Chapter 3 includes complete circuit diagram and explanation of each circuit block e.g. power supply, clock circuit, relay circuit, instrumentation amplifier and sensors.
Chapter 4 includes the flow chart.
Chapter 5 and chapter 6 include the application and future development of the project respectively.

Appendix includes assembly language code, PCB layout, component list and datasheets of all the ICs used in the project.

Chapter 2
Block Diagram Description
2.2 Description

Fig 2.1 shows basic block diagram of project “Microcontroller Based Industrial Monitoring and Control System”. This project consists of following main blocks

1) Sensors
a) Temperature sensor
b) Level sensor
c) Light sensor
2) Instrumentation amplifier
3) 8-Channel A/D converter
4) Clock generator
5) Micro controller unit
6) 16x2 LCD display
7) Relays
a) Temperature relay
b) Light relay
c) Level relay
8) Power supply

1) Sensors
Sensors are basically used to convert physical quantity in electrical form. There are different types of sensors available for various physical quantities. In our project we control three parameters which are Temperature, light and Level. For these three different parameters we use three different sensors.

a) Temperature sensor
Temperature sensors are used to sense changes in temperature. There are various type of temperature sensors available in market, such as NTC Thermister, PTC Thermister, PT-100, Thermocouple etc.; out of which NTC & PTC Thermister and PT-100 give change in resistance with respect to change in temperature, so there is need of resistance bridge circuit which is critical and lack accuracy.

But IC LM35D sensor gives directly output in mili-volts with respect to change in temperature. This temperature is further modified by instrumentation amplifier, so it is an easy and simple way to convert temperature in required electrical form, so we use IC LM35D as temperature sensor in our project.

b) Level sensor

level sensors are readily available. We can directly use tank level unit sensor. which is generally used in an tank level system. This sensor senses level and converts it in mili-volts.

c) Light sensor

Most common way to convert light intensity in to electrical form is by using LDR (Light dependent resistance).This special resistance having a property to give change in resistance with respect to change in light. This LDR can be use in combination with variable resistance to make a voltage divider circuit, whose output changes in volts with respect to change in light.

2) Instrumentation amplifier

Instrumentation amplifier is the circuit which amplifies the weak signal (i.e. mili-volt) from temperature sensor, along with the reducing noise signal. The signal received from IC LM35D is very weak i.e. in few mili-volts. And so it is necessary to amplify this signal by high impedance amplifier. It is also necessary to isolate transducer from preceding stage, for avoiding loading effect on transducer.

3) 8 channel A/D converter

After amplifying the signal by Instrumentation Amplifier, we convert it into digital form. So that Micro controller read this signal and converts into BCD form. For this purpose we use 8 channel A/D converter, IC ADC0808; which has 8bit resolution and internal oscillator circuit. The ADC 0808 is CMOS 8 bit successive approximation A/D converter. It’s some important features are

1) In built 8 channel multiplexer. 2) Differential analog voltage input. 3) No requirement of zero adjustment.

4) Clock generator

As ADC 0808 has no inbuilt clock oscillator so we require external clock generator circuit. For this purpose we use most commonly used clock choice IC 555 operated in astable multivibrating mode. Selection of value of resistance and capacitor is so that output clock frequency is about 32 KHz which is connected to CLK pin of IC ADC 0808.

5) Micro controller unit

Micro controller IC 89C51 is heart of our project. We select this micro controller IC for our project for following number of advantages

1) Internal 4K bytes of electrically erasable programmable read only memory for feeding program so that there is no need of external EPROM.

2) Four 8 bit i/p o/p ports, out of which we use one port to read ADC o/p, other ports are used to connect relays and display for operating devices.

3) Operating voltage of 4.0 to 5.5V D.C., which is easily available by using voltage regulator IC. 4) Internal 128 x 8 - bit RAM for temporary storage of data. In which we can feed took up table to turn ON/OFF relay. 5) Two 16 bit timers/counters are present for timing and counting purpose. 6) 2 external and 3 internal interrupts are available.

Micro controller reads the data available at o/p of A/D converter, stores it in memory and compares with the set point to turn ON or OFF the relay, depending on comparison.

12 MHz quartz ceramic crystal is connected between pins XTAL1 and XTAL2 of micro controller to produce machine cycle for fetch and execution of instruction. And at pin 9 (RST pin) we connect R.C n/w to provide reset pulse when power is turned On, so that program execution starts from memory location 0000H.

6) 16 X 2 Dot matrix liquid crystal display

To show parameters such as temp, light intensity and Level, we use alpha numeric display instead of 7 segment LCD display; because on 7 segment display reading and writing of alphanumeric such as X, Q, W, M is quite difficult; so we directly use alpha numeric display available in market. This display has two columns of 16 characters each i.e. we can write message up to 32 characters on it.

7) Relay

Relay is basically a switching device to turn on or turn off particular device. In our project we use electromagnetic type induction relay, operated at 5V DC. The functions of these relays are as follows

a) Temperature relay This relay turns on or off heating coil element so that surrounding temperature is maintained at that particular temperature.

b) Level relay

This relay can turn on or off motor-pump system so that relative level remains consistent.

c) Light relay

This relay can turn on or off surrounding electrical light bulbs so that light intensity is maintained constant in room.

8) Power supply

For our all ICs we require +5V DC,+12V DC and -12V DC supply which can be generated by step down transformer, full wave bridge rectifier, filter condenser and voltage regulator IC.

Chapter 3
 
Circuit Description
3.1 Circuit Diagrams
3.2 Circuit operation

Figure shows complete circuit diagram of our project ‘Microcontroller based Industrial Process Monitoring and Control System’. In this project we can monitor and control three parameters like Temperature, Light Intensity and Level of tank. For this purpose we use three sensors.
First for temperature, we select IC LM35D as temperature sensor, because output of this IC is directly in milivolts, so by amplifying this signal it is very easy to convert it in to Digital form by using A/D converter. If we use NTC or PTC sensor its o/p changes in resistance with respect to temperature so it is difficult to convert this resistance value in to equivalent voltage.

The next stage of our project is Instrumentation amplifier. The General requirement for instrumentation amplifier is as follows:-

1) It should have differential input. 2) It should have high input impedance & common mode rejection ratio. 3) The amplifier should be provided with simple gain adjustment. To achieve 1st requirement we use differential instrumentation amplifier op-amp. To achieve 2nd requirement we use IC 741 which have input impedance & CMRR. To achieve 3rd requirement we use two variable resistance VR1 for simple gain adjustment.

Instrumentation amplifier is the circuit which amplifies the weak signal (i.e. mili-volt) from temperature sensor along with the reducing noise signal. The signal received from temperature transducer is very weak i.e. in few milivolts it is necessary to amplify this signal by high impedance amplifier & isolate transducer from preceding stage, Thus avoiding loading effect on transducer.

The next stage after instrumentation amplifier is analog to digital converter. For this purpose we use 8 channel A/D converter IC ADC0808 because we want to interface three different sensors .The ADC 0808 is CMOS 8 bit successive approximation A/D converter. Its important features are

1) Differential analog voltage input. 
2) No requirement of zero adjustment. 
3) In built 8 - channel multiplexer.

The control ALE, Start conversion SC & End of conversion EOC are applied to micro controller IC 89S52. Port P0.4, P0.5, and P0.6. The start of conversion signal SC is to be applied to start conversion of A/D. After conversion complete we get feed back signal End of conversion (EOC). ALE is Address latch enable signal to select address line A0, A1, A2. From these three lines we select sensor connected to INT0 to INT7 .Out of these we use Three lines INT0 for temperature sensor, INT1 for light sensor and INT2 for Level sensor. From software written in micro controller we select A0, A1, A2 corresponding to 8 BCD signals and select each sensor by time division method. 

The clock frequency for ADC0808 is 32 KHz. The clock may be supplied from an external source by using IC 555 as in astable multi-vibrating mode. 

The corresponding digital values for analog signal are as follows:
ANALOG VOLTAGE DIGITAL VALUES

0 volt 00 H
1 volt 34 H
2 volt 6D H
3 volt 9A H
4 volt CE H
5 volt FF H

Secondly we use LDR as light sensor and carbon type moisture sensor.Light Dependant Resistance is used to detect change in light intensity. When light falls on this LDR, its resistance changes. It is connected between voltage divider network and output is given to ADC. In darkness its resistance is about 24k and at full light it is near about 800.So we get equivalent value in volt with respect to change in light .This voltage is applied to A/D converter and ADC convert it in to equivalent BCD.

For level purpose we connect level sensor of tank unit system. . This sensor has two terminals, one is connected to +5v D.C.and second terminal is connected to ADC through variable pot of 10k.When level of the tank is vary at that time voltage will be change ang this voltage will be given to ADC in binary form.
In this way we can convert physical quantity (i.e. temperature,light,level) in to digital equivalent. Micro controller IC 89S52 serves two tasks: first generates control signal at port P0 for A/D converter & reads equivalent digital data at (D0 to D7) at port P1 (P1.0 to P1.7). Thus digital data are temporarily stored in internal register of micro controller IC 89C51.

In our project we want to monitor and control parameters like temperature, light intensity and level. For this purpose we use 16x2 LCD display and relay for control action. The digital data received at port P1 is stored in internal register of micro controller & converted into 3 digits packed BCD by using software subroutine. These 3 digits packed BCD are stored in three different memory locations in micro controller’s internal RAM locations, from where it can be display & compare.

Switches 1, 2, 3, 4 are used to enter the set point for physical quantities (e.g. temperature, light,level). When we press these switches, micro controller detects them through software routine and increment or decrement set point values. When we press enter switch, this value stores in internal RAM location of micro controller, for that particular parameter (i.e. temperature, light, level).

Suppose we set 127 using increment and decrement keys and store in three different memory locations, then the microcontroller continuously compares it with I/p data from A/D converter (i.e. pack 3 digit BCD.) When all three digits are equal then it understands that set point is reached and turns OFF relay.

Relay is connected at P3.0, P3.1, and P3.2. The purpose of this relay is to turn ON or OFF specific task at set point (i.e. set OFF supply of heater in case of temperature control, Turn on light in case of light sensor and turn off motor-pump system in case of level).

3.3 Circuit analysis
3.3.1 Power Supply

Power supply is the first and the most important part of our project. For our project we require +5V,12V and -12V regulated power supply with maximum current rating of 500mA.
Following basic building blocks are required to generate regulated power supply.

1) Step down transformer 

Step down transformer is the first part of regulated power supply. To step down the mains 230V A.C. we require step down transformer. Following are the main characteristic of step down transformer.

1) Power transformers are usually designed to operate from source of low impedance at a single frequency.
2) It is required to construct with sufficient insulation of necessary dielectric strength.
3) Transformer ratings are expressed in volt–amp (VA). The volt-amp of each secondary winding or 
windings are added for the total secondary VA. To this load losses are added.
 4) Temperature rise of a transformer is decided on two well-known factors i.e. losses on transformer and heat dissipating or cooling facility provided in it.

2) Rectifier Unit

Rectifier unit is a circuit which converts A.C. into pulsating D.C. Generally semi-conducting diode is used as 
rectifying element due to its property of conducting current in one direction only. Generally there are two types of rectifier.

1) Half wave rectifier
2) Full wave rectifier.
In half wave rectifier only half cycle of mains A.C. is rectified so its efficiency is very poor. So we use full wave bridge type rectifier, in which four diodes are used. In each half cycle, two diodes conduct at a time and we get maximum efficiency at o/p.
Following are the main advantages and disadvantages of a full-wave bridge type rectifier ckt.

Advantages

1) The need of center tapped transformer is eliminated.
2) The o/p is twice than that of center tap circuit for the same secondary voltage.
3) The PIV rating of diode is half of the centers tap circuit.

Disadvantages
1) It requires four diodes.
 2) As during each half cycle of A.C. input, two diodes are conducting therefore voltage drop in internal resistance of rectifying unit will be twice as compared to center tap circuit.
3) Filter Circuit
Generally a rectifier is required to produce pure D.C. supply for using at various places in the electronic circuit. However, the o/p of rectifier has pulsating character i.e. if such a D.C. is applied to electronic circuit it will produce a hum i.e. it will contain A.C. and D.C. components. The A.C. components are undesirable and must be kept away from the load. To do so a filter circuit is used which removes (or filters out) the A.C. components reaching the load. Obviously a filter circuit is installed between rectifier and voltage regulator. In our project we use capacitor filter because of its low cost, small size and little weight and good characteristic. Capacitors are connected in parallel to the rectifier o/p because it passes A.C. but does not pass D.C. at all.
4) Voltage regulator
A voltage regulator is a circuit that supplies constant voltage regardless of change in load current. IC voltage regulators are versatile and relatively cheaper. The 7800 series consists of three terminal positive voltage regulator and the 7900 series consists of negative voltage regulator. These ICs are designed as fixed voltage regulator and with adequate heat sink, can deliver o/p current in excess of 1A. These devices do not require external component. This IC also has internal thermal overload protection and internal short circuit and current limiting protection. For our project we use 7805 and 7812,7912 voltage regulator ICs. Following is the circuit diagram of the power supply.
Rectifier Design
R.M.S. Secondary voltage at secondary of transformer is 12V.
So maximum voltage Vm across Secondary is
                                                                          = Ö2 x Vrms
                                                                          = Ö2 x 12
                                                                          = 16.97 V
D.C. O/p Voltage at rectifier O/p is

                                                                  Vdc = 2Vm/p
                                                                          = 2 x 16.97/p
                                                                          = 10.80 V
PIV rating of each diode is

PIV = 2 Vm.
= 2 x 16.97
= 34 V

& maximum forward current which flows from each diode is 500mA.
So from above parameter we select diode IN 4007 from diode selection manual.

Design of Filter Capacitor
Formula for calculating filter capacitor is,

C = 1/ 4Ö3 r f RL
r = ripple present at o/p of rectifier (Which is maximum 0.1 for full wave rectifier)
f = frequency of mains A.C.
RL = I/p impedance of voltage regulator IC.
C = 1/ 4Ö3 x 0.1 x 50 x 28
    = 1030 mf @ 1000 mf.

And voltage rating of filter capacitor is double of Vdc i.e. rectifier o/p which is 20V. So we choose 1000 mf / 25V filter capacitor.

IC 7805 (Voltage Regulator IC)
Available o/p D.C. Voltage = + 5V.
Line Regulation = 0.03
Load Regulation = 0.5
Vin maximum = 35 V
Ripple Rejection = 66-80 (db)


3.3.2 Clock circuit for ADC 0808
In clock generator circuit IC 555 is wired as an astable multivibrator with a center frequency of about 32 KHz. Output of 555 is in square wave at output pin 3.
For calculation of resistance, capacitor & o/p frequency of astable multivibrator using 555 the capacitor connected between pin 2,6 & GND periodically charges and discharges between 2VCC/3 and VCC/3 respectively.

During charging period 0< t < TC, the voltage across capacitor will given by

Vx = 2VCC/3 [1 – exp {- t / RA + RB} C1] + VCC /3

At time t = TC capacitor voltage Vx reaches to threshold level of 2 VCC/3,

so that 2/3 VCC = 2VCC/3 [ 1 – exp { - TC /(RA + RB)C1} ]
                          = VCC/3 Solving charging time Tc gives
TC = (RA + RB) C1 Ln 2
      = 0.693 (RA + RB) C1
During discharge period 0 < t < TD we have that

Vx = 2VCC /3 exp (-t1/ RBC1)

At time t1 = TD the voltage across the capacitor reaches the trigger level of VCC/3 50 we have that

Vx ( t = TD) VCC/3 = 2VCC/3 exp (-TD/ RBC1)

From this we obtain
TD = RB*C1* ln2
      = 0.693 RB*C1

Where,

TD & TC are charge & discharge Time so that total time T is
T = TD + TC
T = 0.693 (RA + 2RB) C1
So final equation for o/p frequency is

f0 = 1/T = 1/ 0.693 (RA + 2RB) C1 = 1.44 / (RA + 2RB) C1
Required frequency is 32 KHz.
We assume C1 = 0.01 uf
So 32 KHz = 1.44/ (RA + 2RB) C1
(RA + 2RB) = 1.44/ (32 x 103 x 0.01 x 10 -6 )
= 1.44/ (32 x 10-5 )
(RA + 2RB) = 4.5 k ohm
If we again assume
RA = 1.5 k ohm
So 2RB = 3 k ohm
So RB = 1.5 k ohm
By using above specifications we get the output frequency of 32 KHz, which is sufficient.
3.3.3 Relay Circuit
Specification of Relay
Operating voltage = +12V dc,
Coil resistance = 150ohm
Contact rating for 48Vdc = 5A
For 220Vac = 5A
According to ohms low, maximum current flowing through collector of transistor Q1, when relay is ON is-
Ic = Vcc/Rc
Ic = 12V/150
Ic = 80 mA
For safety margin of 100% so we choose a transistor which can switch at least 160mA again voltage rating of transistor i.e. Vce is greater than 12V; so we choose a transistor (Q1) SL 100 which has flowing specifications:-
Icmax. =500mA
Vce = 60v
       =150
Selection of resistance RB
As transistor operated in common emitter configuration from transistor equation = IC/IB.

So, IB = IC/
IB = 80mA/150
IB = 0.53 mA
I/p to base of transistor is Vcc1 = 12v
So applying Kirchoff’s voltage low to loop of base of transistor,
Vcc1 = IB RB + VBE
VBE of silicon transistor is 0.7v
RB = Vcc1-VBE/IB
= (5.0-0.7) / 0.22 mA
= 7.9Kohm
3.3.4 Instrumentation amplifier
To amplify the low-level output signal of the transducer so that it can drive the indicator or display is the major function of instrumentation amplifier.
The signal from temperature sensor LM35D is in the range of 0V to 1V. So we have to amplify this signal to 0V to 5V to convert in into the digital form. To amplify this signal we use IC 741 as non-inverting amplifier as shown in fig. 3.3.4.
The output voltage can be given as
If we select = VR1 = 4 k ohm
And = 1 k ohm
Then 5
3.4 Sensors
3.4.1 Light Dependent Resistor (LDR)
Electronic optosensors are devices that alter their electrical characteristics, in the presence of visible or invisible light. The best known devices of the types are the LDR (light dependent resistor), the photodiode, and the phototransistor. Let us start off by concentrating on the LDR & LDR circuitry.
LDR operation relies on the fact that the conductive resistance of a film of cadmium sulphide (CdS) varies with the intensity of light falling on the face of the film. This resistance is very high under dark conditions & low under bright conditions. Fig. 3.4.1 illustrates the basic construction of the LDR,
The device consists of a pair of metal film contacts separated by a smake-like track of cadmium sulphide film, designed to provide the maximum possible contact are with the two metal films. The structure is housed in a clear plastic or resin case, to provide free access to external light
Practical LDRs are available in a variety of sizes & package styles, the most popular size having a face diameter of roughly 10 mm., which has a resistance of about 900 R at a light intensity of 100 lx (typical of a well lit room) or about 30 R at an intensity of 8000 lx (typical of bright sunlight). The resistance rises to several mega ohms under dark conditions.
LDRs are sensitive, inexpensive & readily available devices. They have good power & voltage handling capabilities, similar to those of a conventional resistor. Their only significant defect is that they are fairly slow acting, taking tens or hundreds of milliseconds to respond to sudden change in light level. Useful practical LDR application includes light at dark activated switches & alarms, light -beam alarms, and reflective smoke alarms.
3.4.2 Temperature Sensor IC LM35D
Most commonly-used electrical temperature sensors are difficult to apply. For example, thermocouples have low output levels and require cold junction compensation. Thermistors are nonlinear. In addition, the outputs of these sensors are not linearly proportional to any temperature scale.
Fortunately, in 1983 two IC’s, the LM34 Precision Fahrenheit Temperature Sensor and the LM35 Precision Celsius Temperature Sensor, were introduced.
The LM34 and LM35 are easy-to-use temperature sensors with excellent linearity. These sensors can be used with minimal external circuitry for a wide variety of applications and do not require any elaborate scaling schemes nor offset voltage subtraction to reproduce the Fahrenheit and Celsius temperature scales respectively.
In our project we use the IC LM35D, which has precision Celsius scale. The temperature range of LM35D is from 0 °C to +100 °C. Scale factor of LM35D is + 10.0 mV/°C.
3.4.3 level Sensor
For the sensing of level we use tank level system sensor which having a float at the bottom level ang it can be moving with reapect to change in level.when level will be change at that time resistance of output terminal will be change, so we get different resistance at different level.

Chapter 4
Flowchart

Chapter 5
Applications

1) Pharmaceutical Industries
In Pharmaceutical Industries mostly it is required to manufacture some Drugs under restricted environmental conditions, like fix maximum and minimum values of parameters like Temperature, Light intensity, level of the water etc.
2) Green House for Plantation
In agriculture as well as in gardening & nursery business the plants are required to keep under special environmental conditions for fast growth and sometimes for researches.

3) Store Rooms of Industries
In some industries (e.g. Pharmaceutical, Food & Dairy Products etc.), the raw materials as well as the finished products are required to store under special environmental conditions.
Thus for all of above mentioned applications and for many other applications our project “MICROCONTROLLER BASED INDUSTRIAL PROCESS MONITORING AND CONTROL SYSTEM (Demo Unit)” can provide the best solution.

Conclusion
This project is an effective and efficient system designed and developed for regulating the parameters like Temperature, Light Intensity and Level to the optimum level. We use number of sensors connected in parallel so range can be increased and same project can be used for large industrial system.
Future Development
1) We can make whole system using solar power operated so there will be no need of external power supply and whole system will work on natural light.
2) We use number of sensors connected in parallel so that range is increase and same project can be used for large industrial system.
3) Instead of 8 bit A/D converter we can use 12bit or 16 bit (AD 574 IC) to increase resolution of circuit.
4) We can use PID type of control action instead of just on/off relay.
5) By modifying program we can also provide facility for entering set point in fraction.
6) We can further connect same project to PCs serial port through TXD and RXD line of micro controller but for that we require software in higher-level language, which will make mathematical calculations easy for set point comparison.
Appendix A
Assembly language code
“This is a program for project “MICROCONTROLLER BASED INDUSTRIAL PROCESS MONITORING AND CONTROL SYSTEM (Demo Unit)”
MICROCONTROLLER IC 89C51
P1.0 TO P1.7 --- D0 TO D7 OF A/D CONVERTER IC 0808
P0.3---ALE (27), P0.4---ECO (7), P0.5---SC (6) CONTROL PIN OF ADC 0808 P0.0--A0, P0.1---A1 & P0.2---A2 OF IC 0808
P0.7--EN (6), P3.6--R/W (5), P3.7--RS (4) OF LCD DISPLAY
P2.0 TO 2.7 D0 TO D7 (7 TO 14) OF LCD DISPLAY
COM EQU 05CH
DAT EQU 05DH
EOT EQU 05EH
ETA EQU 05FH
TEMP EQU 60H
ADDRESS EQU 70H
VALUE EQU 40H
ORG 0000H
MOV P3,#0F8H
MOV P1,#0FFH
MOV P0,#0FFH
MOV R2,#0FFH
MOV R1,#TEMP
MOV R0,#ADDRESS
MOV @R0,#85H
INC R0
MOV @R0,#8DH
INC R0
MOV @R0,#0CBH
MOV R0,#VALUE
MOV R3,#0CBH
MOV DPL,#00H
MOV DPH,#07H
CLR 21H
ACALL MESSAGE
MOV R4,#02H
HERE: JNB P3.3,MONETOR1
JMP HERE
MONETOR: MOV DPL,#00H
MOV DPH,R4
MOV R3,#0CBH
ACALL MESSAGE
RET
MONETOR1: ACALL MONETOR
LOOP1: MOV A,R3
ACALL COMMAND
SETB P3.4
SETB P3.5
SETB P0.6
CALL DELAY
L1: JNB P3.4,INCR
JNB P3.5,LOOP2
JNB P0.6,LOOP3
JB 21H,OUT
JMP L1
LOOP2: MOV A,R5
MOV @R1,A
MOV A,R2
MOV @R0,A
INC R3
INC R1
INC R0
MOV R2,#0FFH
JMP LOOP1
LOOP3: CALL LOOP3A
JMP MONETOR1
LOOP3A: INC R4
CJNE R4,#05,AHEAD
SETB 21H
AHEAD: CALL DELAY
RET
INCR: MOV DPTR,#TABLE
INC R2
MOV A,R2
MOVC A,@A+DPTR
INC DPTR
CJNE A,#ETA,DIS
MOV DPTR,#TABLE
MOV R2,#0FFH
JMP LOOP1
DIS: MOV R5,A
ACALL DISPLAY
CALL DELAY
JMP LOOP1
DISPLAY: ACALL READY
MOV P2,A
SETB P3.7
CLR P3.6
SETB P0.7
CLR P0.7
RET
COMMAND: ACALL READY
MOV P2,A
CLR P3.7
CLR P3.6
SETB P0.7
CLR P0.7
RET
OUT: MOV R1,#VALUE
SETB P3.3
MOV R4,#01H
MOV R6,#0C0H
MOV R0,#ADDRESS
CLR 21H
OUT1: SETB P3.3
MOV A,@R0
CALL COMMAND
MOV P0,R6
SETB P0.4
SETB P0.3
CLR P0.3
SETB P0.5
CLR P0.5
AD1: JB P0.4,AD1
CALL DELAY
MOV A,P1
ACALL CHECK
INC R6
INC R0
CJNE R6,#0C3H,OUT1
MOV R6,#0C0H
MOV R0,#ADDRESS
MOV R1,#VALUE
JMP OUT1
CHECK: MOV 50H,A
MOV A,@R1
MOV B,#100
MUL AB
MOV 51H,A
INC R1
MOV A,@R1
MOV B,#10
MUL AB
ADD A,51H
MOV 51H,A
INC R1
MOV A,@R1
ADD A,51H
MOV 51H,A
INC R1
CLR C
SUBB A,50H
JNC SETBIT
JMP CLEAR
CHE1: MOV A,50H
MOV B,#100
DIV AB
ACALL CONVERT
MOV A,B
MOV B,#10
DIV AB
ACALL CONVERT
MOV A,B
ACALL CONVERT
JNB P3.3,STATUS
RE3: RET
SETBIT: MOV A,R6
CJNE A,#0C0H,NEXT
SETB P3.0
JMP CHE1
NEXT: MOV A,R6
CJNE A,#0C1H,NEXT1
SETB P3.1
JMP CHE1
NEXT1: MOV A,R6
CJNE A, #0C2H,NEXT2
SETB P3.2
NEXT2: JMP CHE1
CLEAR: MOV A,R6
CJNE A,#0C0H,NEX
CLR P3.0
JMP CHE1
NEX: MOV A,R6
CJNE A,#0C1H,NEX1
CLR P3.1
JMP CHE1
NEX1: MOV A,R6
CJNE A,#0C2H,NEX2
CLR P3.2
NEX2: JMP CHE1
CONVERT: MOV DPTR,#TABLE
MOVC A,@A+DPTR
ACALL DISPLAY
RET
OUTA: LJMP OUT
STATUS: MOV R1,#TEMP
MOV R4,#01H
STA1: JB 21H,OUTA
CALL LOOP3A
ACALL MONETOR
MOV A,@R1
ACALL DISPLAY
INC R1
MOV A,@R1
ACALL DISPLAY
INC R1
MOV A,@R1
ACALL DISPLAY
INC R1
SETB P3.3
CALL DELAY
S2: JNB P3.3,STA1
JMP S2
MESSAGE: LCALL READY
CLR A
MOVC A,@A+DPTR
INC DPTR
CJNE A,#EOT,COMD
RET
COMD: CJNE A,#COM,DATAA
CLR P3.7
SJMP MESSAGE
DATAA: CJNE A,#DAT,SENDIT
SETB P3.7
SJMP MESSAGE
SENDIT: MOV P2,A
CLR P3.6
SETB P0.7
CLR P0.7
SJMP MESSAGE
READY: MOV R7,P3
CLR P0.7
MOV P2,#0FFH
CLR P3.7
SETB P3.6
WAIT: CLR P0.7
SETB P0.7
JB P2.7,WAIT
CLR P0.7
MOV P3,R7
RET
DELAY: MOV 1Ah,#0FFH
LP2: MOV 1Bh,#0C8H
LP1: NOP
NOP
DJNZ 1Bh,LP1
NOP
NOP
DJNZ 1Ah,LP2
RET
ORG 0200H
DB COM,3CH,06H,0EH,01H,80H,DAT,'ENTER SET-POINT ',COM,0C0H,DAT,'FOR TEMP.= ',EOT
ORG 0300H
DB COM,3CH,06H,0EH,01H,80H,DAT,'ENTER SET-POINT ',COM,0C0H,DAT,'FOR LIGH.= ',EOT
ORG 0400H
DB COM,3CH,06H,0EH,01H,80H,DAT,'ENTER SET-POINT ',COM,0C0H,DAT,'FOR LEV.= ',EOT
ORG 0500H
DB COM,3CH,06H,0CH,01H,80H,DAT,'TEMP= LIG= ',COM,0C0H,DAT,' LEV= ',EOT
ORG 0700H
DB COM,3CH,06H,0CH,01H,80H,DAT,'PROJECT OF INDUST.',COM,0C0H,DAT,'MONITORING & CON.',EOT
TABLE: DB '0','1','2','3','4','5','6','7','8','9',ETA
END


PCB Layout and component list
B.1 PCB Layout
B.2 Component list
ICs
IC1 - IC NE555 Timer IC - 8 pin DIP package.
IC2 - IC LM747 Op-amp - 8 pin DIP package.
IC3 - IC ADC0808 Analog to Digital converter - 28 Pin DIP package.
IC4 - IC 89C51 Microcontroller - 40 pin DIP package.
Display
16x2 Dot matrix LCD display.
Crystal
X1- 12MHz Quartz crystal oscillator.
Capacitors
C1, C2, Cr - 0.01µf Ceramic capacitor.
C3, C4 – 1000µf/25V Electrolytic capacitors.
Ca, Cb - 22pf Ceramic capacitor.
Diodes
D1, D2, D3, D4, D5, D6, D7– 1N4007 Diodes.
Resistors
R1 - 1KOhm
R2 - 10KOhm
R3, R4 - 680Ohm
R5, R6, R7 - 7.9kOhm
Ra, Rb - 1.5kOhm
VR1, VR2, VR3 – Variable resister of 10kOhm
Transistors
T1, T2, T3 - SL100
Switches
S1, S2, S3, S4, S5 - Push to ON Switch.
Transformer
Transformer - 230V/12-0-12V, 1A, 50Hz, 1-phase Step down transformer.
Trasformer- 230/0-5V,1A,50Hz,1-phaase step down transformer
Relays
RL1, RL2, RL3 - Single change over, 5v operated, Electromagnetic relay.
Sensors
Temperature sensor – IC LM35D
Light sensor – LDR
Tank level Unit

No comments:

Post a Comment