RFID Based Attendance System

47 downloads 0 Views 2MB Size Report
Automatic Sorting, Counting and Bottle Filling System. UET Taxila, Chakwal Campus. Page 2. ABSTRACT. This project is aimed at automating the sorting and ...
AUTOMATIC SORTING, COUNTING AND BOTTLE FILLING SYSTEM

SESSION 2008-2012

Supervisor ENGR.KHURRAM SALEEM

Submitted By

SYED ZEESHAN HAIDER

08-MCT 18

HASSAN ELAHI

08-MCT-63

WAHEED UR REHMAN

08-MCT-67

ZEESHAN AHMED AWAN

08-MCT-70

DEPARTMENT OF MECHATRONICS ENGINEERING UNIVERSITY OF ENGINEERING AND TECHNOLOGY TAXILA (SUB CAMPUS CHAKWAL)

July 2012

Automatic Sorting, Counting and Bottle Filling System

ABSTRACT

This project is aimed at automating the sorting and bottle filling. This project will automatically sort bottle according to their size by using IR sensors. Then it sorts the bottle on the designated portion of conveyor belt and passes it to the Solenoid Operated Valves to fill the bottles. The overall system is liberated from human intervention. The system is comprehensive and efficient, thus can help in automating the sorting and bottle filling.

UET Taxila, Chakwal Campus

Page 2

Automatic Sorting, Counting and Bottle Filling System

UNDERTAKING

We certify that research work titled “AUTOMATIC SORTING & BOTTLE FILLING” is our own work. The work has not, in whole or in part, been presented elsewhere for assessment. Where material has been used from other sources it has been properly acknowledged/ referred. _________________ SYED ZEESHAN HAIDER (08-MCT-18) _________________ HASSAN ELAHI (08-MCT-63) _________________ WAHEED-UR-REHMAN (08-MCT-67) __________________ ZEESHAN AHMED AWAN (08-MCT-70)

UET Taxila, Chakwal Campus

Page 3

Automatic Sorting, Counting and Bottle Filling System

ACKNOWLEDGEMENTS

Firstly, we thank Almighty Allah for all the blessings and help in the completion of this project. Secondly, we would like to express our gratitude to Engr. Khurram Saleem, our supervisor, for all the help that he extended to us during the course of this project. Thirdly, we are really gratified to the support given to us by our families.

UET Taxila, Chakwal Campus

Page 4

Automatic Sorting, Counting and Bottle Filling System

Table of Contents ABSTRACT UNDERTAKING ACKNOWLEDGEMENTS CHAPTER 1: INTRODUCTION 1.1 Introduction 1.2 Objectives 1.3 Discription Chapter 2: LITERATURE REVIEW 2.1 History 2.2 Conveyor belt 2.3 Sorting

2.4 Bottle filling Chapter 3: MECHANICAL COMPONENTS 3.1 Bearing 3.2 Wooden shaft 3.3 Wooden rollers 3.4 Pulley Chapter 4: ELECTRICAL COMPONENTS UET Taxila, Chakwal Campus

Page 5

Automatic Sorting, Counting and Bottle Filling System

4.1 Induction motor 4.1.1 Principle 4.1.2 Operation 4.1.3 Synchronous speed 4.1.4 Slip 4.2 Solenoid operated valve 4.3 Brushless Dc motor 4.3.1 Advantages 4.3.2 Disadvantages Chapter 5: ELECTRONIC COMPONENTS 5.1 Microcontroller 89C51 5.2 LCD (20x4) 5.3 ULN 2003 5.4 MCT 2e 5.5 Relay 5.6 IR sensor 5.7 Resistor UET Taxila, Chakwal Campus

Page 6

Automatic Sorting, Counting and Bottle Filling System

5.8 Capacitor Chapter 6: Structure of Project 6.1 Dimensions of conveyor belt 6.2 Dimensions of Wooden Roller 6.3 Diameter of pulley 6.4 Diameter of bearings 6.5 Dimension of shaft 6.6 Dimension of structure 6.7 Types of wood Chapter 7: IMPLEMENTATION AND CONTROL 7.1 Circuit diagram 7.1.1 Simulated circuit diagram 7.1.2 working of circuit Chapter:8 Applications and advantages 8.1 Application of sorting through conveyor belt 8.1.1 Advantages 8.2 Applications of liquid filling UET Taxila, Chakwal Campus

Page 7

Automatic Sorting, Counting and Bottle Filling System

Chapter 9: Conclusion and future work Conclusion References Appendix A Glossary

UET Taxila, Chakwal Campus

Page 8

Automatic Sorting, Counting and Bottle Filling System

List of Figures Figure 1.1

Automatic sorting and bottle filling machine

Figure 2.1

Conveyor belt

Figure 2.2

Sorting

Figure 2.3

Bottle filling

Figure 3.1

Bearing

Figure 3.2

Wooden roller

Figure 3.4

Pulley

Figure 4.1

Induction motor

Figure 4.2

Solenoid valve

Figure 4.3

Brushless Dc motor

Figure 5.1

microcontroller

Figure 5.2

LCD 20x4

Figure 5.3

ULN 2003 logic diagram

Figure 5.4

MCT 2e

Figure 5.5

Relay

Figure 7.1

Measurement system

Figure 7.2

Feedback system

Figure 7.3

Circuit diagram

UET Taxila, Chakwal Campus

Page 9

Automatic Sorting, Counting and Bottle Filling System Figure 7.3.1

Circuit diagram of project

Figure 7.3.2

Simulated circuit diagram

UET Taxila, Chakwal Campus

Page 10

Automatic Sorting, Counting and Bottle Filling System

Chapter 1: INTRODUCTION

1.1 Introduction Industrial Automation plays an increasingly important part in the global economy and also in daily experience. At present, for companies, the purpose of automation has shifted from growing productivity and reducing costs to broader issues. This work takes the idea of automatic sorting and bottle filling. The control system uses microcontroller. Sorting of bottles is done on the conveyer belt via IR sensors and then these bottles are filled by actuating the solenoid valves. The conveyors are used in many automated industries for moving parts from one place to another. The second concern is the bottle filling. Once the bottle is sorted, conveyer belt transfers it under the water tank for filling.

UET Taxila, Chakwal Campus

Page 11

Automatic Sorting, Counting and Bottle Filling System

Figure 1.1 automatic sorting and bottle filling machine

1.2 Objectives The main objectives of our project are: •

Sorting of bottles on the basis of their respective sizes



Filling of bottles using SOV

1.3 Description In automated factories production rate is very high, so sorting and filling of bottles need to run at fast speed. To separate the bottle on the basis of their sizes, shapes or height sorting system is applied.

UET Taxila, Chakwal Campus

Page 12

Automatic Sorting, Counting and Bottle Filling System After that these bottles are filled up to some specific level. For that purpose bottle filling system is required. This type of system provide following benefits: 1. Stability and safety 2. Easy to operate and maintain 3. Factory price 4. Low running cost

In order to automate a process we need a control system .The control system is implemented through some physical device, it is usually based on mathematical logic to get desired result. We have used AT89C51 to implement the control in our project.

UET Taxila, Chakwal Campus

Page 13

Automatic Sorting, Counting and Bottle Filling System

Chapter 2: LITERATURE REVIEW

2.1 History Conveyor belts were used since the 19th century. In 1892, Thomas Robins began a series of inventions which led to the development of a conveyor belt used for carrying coal, ores and

other

products. In

1901, Sandvik invented

and

started

the

production

of steel conveyor belts. In 1905 Richard Sutcliffe invented the first conveyor belts for use in coal mines which revolutionized the mining industry. In 1913, Henry Ford introduced conveyor-belt assembly lines at Ford Motor Company's Highland Park, Michigan factory. In 1972, the French society REI created in New Caledonia the then longest straight-belt conveyor in the world , at a length of 13.8 km. Hyacynthe Marcel Bocchetti was the concept designer. In 1957, the B. F. Goodrich Company patented a conveyor belt that it went on to produce as the Turnover Conveyor Belt System. Incorporating a half-twist, it had the advantage over conventional belts of a longer life because it could expose all of its surface area to wear and tear. Mobius strip belts are no longer manufactured because untwisted modern belts can be made more durable by constructing them from several layers of different materials.

UET Taxila, Chakwal Campus

Page 14

Automatic Sorting, Counting and Bottle Filling System In 1963-64, First Indian Small Scale Industrial Unit with Japanese Plant for Rubber Belts for Conveyor / Elevator / Transmission was installed near National Capital Territory of Delhi and its Mr Belts Conveyor Belting has been widely used in Steel, Cement, Fertilizer, Thermal Power, Sponge Iron Plants and Coal / Mineral establishments / Mines, Port Trusts and similar material handling applications of Industry for the last over four decades;

2.2 Conveyor Belt A conveyor belt (or belt conveyor) consists of two or more pulleys, with a continuous loop of material - the conveyor belt - that rotates about them. One or both of the pulleys are powered, moving the belt and the material on the belt forward. The powered pulley is called the drive pulley while the unpowered pulley is called the idler. There are two main industrial classes of belt conveyors; Those in general material handling such as those moving boxes along inside a factory and bulk material handling such as those used to transport industrial and agricultural materials, such as grain, coal, ores, etc. generally in outdoor locations. Generally companies providing general material handling type belt conveyors do not provide the conveyors for bulk material handling. In addition there are a number of commercial applications of belt conveyors such as those in grocery stores.

UET Taxila, Chakwal Campus

Page 15

Automatic Sorting, Counting and Bottle Filling System The belt consists of one or more layers of material. They can be made out of rubber. Many belts in general material handling have two layers. An under layer of material to provide linear strength and shape called a carcass and an over layer called the cover. The carcass is often a cotton or plastic web or mesh. The cover is often various rubber or plastic compounds specified by use of the belt. Covers can be made from more exotic materials for unusual applications such as silicone for heat or gum rubber when traction is essential.

Figure 2.1 Conveyor

2.3 Sorting UET Taxila, Chakwal Campus

Page 16

Automatic Sorting, Counting and Bottle Filling System Sorting is any process of arranging items in some sequence and/or in different sets, and accordingly, it has two common, yet distinct meanings: 1. ordering: arranging items of the same kind, class, nature, etc. in some ordered sequence, 2. categorizing: grouping and labeling items with similar properties together (by sorts) Various sorting tasks are essential in industrial processes. For example, during the extraction of gold from ore, a device called a shaker table uses gravity, vibration, and flow to separate gold from lighter materials in the ore (sorting by size and weight). Sorting is also a naturally occurring process that results in the concentration of ore or sediment. Sorting results from the application of some criterion or differential stressor to a mass to separate it into its components based on some variable quality. Materials that are different, but only slightly so such as the isotopes of uranium, are very difficult to separate.

Fig 2.2: Sorting UET Taxila, Chakwal Campus

Page 17

Automatic Sorting, Counting and Bottle Filling System

Bottle filling: The second part of this project is to design a microcontroller based automatic bottle filling system. When the IR sensor detects the bottle the conveyor belt stops at the moment. At the same time signal from the microcontroller actuates the solenoid valve, and the filling starts. The time required to raise the bottle few seconds,

Figure 2.3: Bottle filling

UET Taxila, Chakwal Campus

Page 18

Automatic Sorting, Counting and Bottle Filling System

CHAPTER 3: Mechanical components

3.1 Bearings A bearing is any of various machine elements that constrain the relative motion between two or more parts to only the desired type of motion. This is typically to allow and promote free rotation around fixes axis or free linear movement; it may also be to prevent any motion, such as by controlling the vectors of normal forces. Bearings may be classified broadly according to the motions they allow and according to their principle of operation, as well as by the directions of applied loads they can handle. A ball bearing is a type of rolling-element bearing that uses balls to maintain the separation between the bearing races. The purpose of a ball bearing is to reduce rotational friction and support radial and axial loads. It achieves this by using at least two races to contain the balls and transmit the loads through the balls. In most applications, one race is stationary and the other is attached to the rotating assembly (e.g., a hub or shaft). As one of the bearing races rotates it causes the balls to rotate as well. Because the balls are rolling they have a much lower coefficient of friction than if two flat surfaces were sliding against each other.

UET Taxila, Chakwal Campus

Page 19

Automatic Sorting, Counting and Bottle Filling System

Figure 3.1: Bearings Ball bearings tend to have lower load capacity for their size than other kinds of rollingelement bearings due to the smaller contact area between the balls and races. However, they can tolerate some misalignment of the inner and outer races.

3.2 Wooden rollers We used two wooden rollers in our project, clamped on the structure. They allow conveyor belt to roll on, by providing sufficient amount of friction between the surface contacts. There are two shafts at both end of the rollers. The diameter of the rollers is 4.5 inch each. UET Taxila, Chakwal Campus

Page 20

Automatic Sorting, Counting and Bottle Filling System

Figure 3.2: Wooden roller

3.3 Wooden shaft There are two shafts at the ends of each roller. Out of four shaft one shaft is connected to the motor via pulley. The motor rotates the shaft and hence conveyor belt starts moving. The diameter of each shaft is 2 inch.

3.4 Pulley A pulley is a wheel on an axle that is designed to support movement of a cable or belt along its circumference. Pulleys are used in a variety of ways to lift loads, apply forces, and to transmit power. A pulley is also called a sheave or a drum and may have a groove between two flanges around its circumference. The drive element of a pulley system can be a rope, cable, belt, or chain that runs over the pulley inside the groove.

UET Taxila, Chakwal Campus

Page 21

Automatic Sorting, Counting and Bottle Filling System Hero of Alexandria identified the pulley as one of six simple machines used to lift weights. Pulleys are assembled to form a block and tackle in order to provide mechanical advantage to apply large forces. Pulleys are also assembled as part of belt and chain drives in order to transmit power from one rotating shaft to another.

Figure 3.4 Pulley

UET Taxila, Chakwal Campus

Page 22

Automatic Sorting, Counting and Bottle Filling System

Chapter 4: Electrical components

4.1 Induction Motor An induction or asynchronous motor is a type of AC motor where power is supplied to the rotor by means of electromagnetic induction, rather than a commutator or slip rings as in other types of motor. These motors are widely used in industrial drives. The induction motor in our project is used to drive the rollers and conveyor belt. The motor converts electrical energy into mechanical energy.

Figure 4.1 Induction motor

UET Taxila, Chakwal Campus

Page 23

Automatic Sorting, Counting and Bottle Filling System

4.1.1 Principle Induction principle, in other words it depends on Faraday's law of induction (i.e. when a conductor moves in a magnetic field, it gets some voltage (induced voltage)

4.1.2 Operation In both induction and synchronous motors, the stator is powered with alternating current (poly phase current in large machines) and designed to create a rotating magnetic field which rotates in time with the AC oscillations. In a synchronous motor, the rotor turns at the same rate as the stator field. By contrast, in an induction motor the rotor rotates at a slower speed than the stator field. Therefore the magnetic field through the rotor is changing (rotating). The rotor has windings in the form of closed loops of wire. The rotating magnetic flux induces currents in the windings of the rotor as in a transformer. These currents in turn create magnetic fields in the rotor, that interact with (push against) the stator field. Due to Lenz's law, the direction of the magnetic field created will be such as to oppose the change in current through the windings. The cause of induced current in the rotor is the rotating stator magnetic field, so to oppose this the rotor will start to rotate in the direction of the rotating stator magnetic field to make the relative speed between rotor and rotating stator magnetic field zero.

UET Taxila, Chakwal Campus

Page 24

Automatic Sorting, Counting and Bottle Filling System For these currents to be induced, the speed of the physical rotor must be lower than that of the stator's rotating magnetic field (

), or the magnetic field would not be moving

relative to the rotor conductors and no currents would be induced. As the speed of the rotor drops below synchronous speed, the rotation rate of the magnetic field in the rotor increases, inducing more current in the windings and creating more torque. The ratio between the rotation rate of the magnetic field as seen by the rotor (slip speed) and the rotation rate of the stator's rotating field is called "slip". Under load, the speed drops and the slip increases enough to create sufficient torque to turn the load. For this reason, induction motors are sometimes referred to as asynchronous motors.

4.1.3 Synchronous speed The synchronous speed of an AC motor is the rotation rate of the rotating magnetic field created by the stator. It is always an integer fraction of the supply frequency. The synchronous speed ns in revolutions per minute (RPM) is given by:

Where, f is the frequency of the AC supply current in Hz and p is the number of Magnetic pole pairs per phase. When using total number of poles, use 120 as constant instead of 60. For example, a small 3-phase motor typically has six magnetic poles organized as three opposing pairs 120° apart, each powered by one phase of the supply current. So there is one pair of poles per phase, which means p = 1, and for a line frequency of 50 Hz the synchronous speed is 3000 RPM. UET Taxila, Chakwal Campus

Page 25

Automatic Sorting, Counting and Bottle Filling System

4.1.4 Slip Slip s is the rotation rate of the magnetic field, relative to the rotor, divided by the absolute rotation rate of the stator magnetic field

where

is the rotor rotation speed in rpm. It is zero at synchronous speed and 1

(100%) when the rotor is stationary. The slip determines the motor's torque. Since the short-circuited rotor windings have small resistance, a small slip induces a large current in the rotor and produces large torque. At full rated load, typical values of slip are 4-6% for small motors and 1.5-2% for large motors, so induction motors have good speed regulation and are considered constant-speed motors.

4.2 Solenoid operated valve A solenoid valve is

an electromechanically operated valve.

The

valve

is

controlled by an electric current through a solenoid: A solenoid valve has two main parts: the solenoid and the valve. The solenoid converts electrical energy into mechanical energy which, in turn, opens or closes the valve mechanically.

UET Taxila, Chakwal Campus

Page 26

Automatic Sorting, Counting and Bottle Filling System

Figure 4.2: Solenoid valve

4.3 Brushless DC motor Brushless DC motors (BLDC motors, BL motors) also known as electronically commutated motors (ECMs, EC motors) are synchronous motors which are powered by a DC electric source via an integrated inverter, which produces an AC electric signal to drive the motor; additional sensors and electronics control the inverter output. A brushless DC motor is electric engine where the stator is a classic 3 phase stator and the rotor has surface mounted permanent magnets. It is equivalent to a reversed DC commutator motor, in which the magnet rotates while the conductors remain stationary. BLDC motor has no commutator and brushes, it requires electronic control for operation. They often have external position sensors used by control unit, but sensorless control is also possible. UET Taxila, Chakwal Campus

Page 27

Automatic Sorting, Counting and Bottle Filling System BLDC motors are really AC motors, it is the controller implementation that makes them DC. Most BLDC motors are 3 phase motors, so they have poles that are sets of three (e.g. 3 poles, 6 poles, 9 poles, 12 poles, etc...). You can connect a BLDC motor to a three phase AC current and it should work fine, just as you can connect them to a Controller which uses DC. There are generally two methods of winding BLCD motors, Delta and Wye:

Figure 4.3: Brushless Dc motor

The trade-offs are as follows:

Delta windings provide (compared to "Wye" windings): UET Taxila, Chakwal Campus

Page 28

Automatic Sorting, Counting and Bottle Filling System •

Higher RPMs



Lower torque at low RPMs



Lower efficiency (but still much higher than normal motors)

Wye windings provide (compared to "Delta" windings):



Lower RPMs



Higher torque at low RPMs



Higher efficiency



More accurate positioning

As we can already see, it would make sense that a CD-Rom motor is a Delta configuration, as high speed is more important than low speed torque (a plastic disk is not that heavy, so it does not need a lot of energy to accelerate). Likewise, it is most likely that BLDC motors used for things like fans are probably of the "Wye" configuration, as pushing air at slower RPMs can contribute to quieter operation. A quick way of getting a rough idea of what type of winding you have is to look at the number of connectors you motor has. Delta configurations usually have 3 connectors, while "Wye" 4. Note that this is just a rough estimate, you can get either configuration with 3 or 4 wires, but it is still useful as quick initial identificataion (further observation using a multimeter can confirm).

UET Taxila, Chakwal Campus

Page 29

Automatic Sorting, Counting and Bottle Filling System As for controlling them, most digital controllers will happily work with both, but some cheap controllers will only work with the "Wye" configuration (and of those, only the 4 wire version), as they need the centre point to function.

Advantages o

Magnetic coupler like isolation

o

No gearbox, speed controlled by electronic unit

o

Good size/power ratio

o

Water cooling

Disadvantages o

Modifying CD-ROM/floppy motors can be tricky

o

Need dedicated BLDC controller

UET Taxila, Chakwal Campus

Page 30

Automatic Sorting, Counting and Bottle Filling System

Chapter 5: ELECTRONICS COMPONENETS

5.1 Microcontroller (89C51) AT89C51 is an 8-bit microcontroller and belongs to Atmel's 8051 family. ATMEL 89C51 has 4KB of Flash programmable and erasable read only memory (PEROM) and 128 bytes of RAM. It can be erased and program to a maximum of 1000 times. In 40 pin AT89C51, there are four ports designated as P1, P2, P3 and P0. All these ports are 8-bit bi-directional ports, i.e., they can be used as both input and output ports. Except P0 which needs external pull-ups, rest of the ports have internal pull-ups. When 1s are written to these port pins, they are pulled high by the internal pull-ups and can be used as inputs. These ports are also bit addressable and so their bits can also be accessed individually. Port P0 and P2 are also used to provide low byte and high byte addresses, respectively, when connected to an external memory. Port 3 has multiplexed pins for special functions like serial communication, hardware interrupts, timer inputs and read/write operation from external memory. AT89C51 has an inbuilt UART for serial communication. It can be programmed to operate at different baud rates. Including two timers & hardware interrupts, it has a total of six interrupts.

UET Taxila, Chakwal Campus

Page 31

Automatic Sorting, Counting and Bottle Filling System

Figure 5.1: Microcontroller

5.2 LCD A liquid crystal display (LCD) is a flat panel display, electronic visual display, or video display that uses the light modulating properties of liquid crystals (LCs). LCs do not emit light directly. LCD displays are available to display arbitrary images (as in a general-purpose computer

UET Taxila, Chakwal Campus

Page 32

Automatic Sorting, Counting and Bottle Filling System display) or fixed images which can be displayed or hidden, such as preset words, digits, seven segment displays, etc., as in a digital clock. They use the same basic technology, except that arbitrary images are made up of a large number of small pixels, while other displays have large elements

Figure 5.2: LCD

UET Taxila, Chakwal Campus

Page 33

Automatic Sorting, Counting and Bottle Filling System Very High Quality Yellow/Green 20x4 High-Density Character LCD with LED Backlight. This LCD is only slightly larger than a typical 16x2 module. The compact size of this LCD fits nicely on the development boards' LCD pin connector and greatly expands a user's ability to display more data using the same code libraries

5.3 ULN 2003 The ULN2003 is a monolithic high voltage and high current Darlington transistor arrays. It consists of seven NPN darling-ton pairs that feature high-voltage outputs with common-cathode clamp diode for switching inductive loads. The collector-current rating of a single darling-ton pair is 500mA. The darling-ton pairs may be parralleled for higher current capability. Applications include relay drivers, hammer drivers, lamp drivers, display drivers (LED gas discharge), line drivers, and logic buffers. The ULN2003 has a 2.7kilo ohm series base resistor for each darling-ton pair for operation directly with TTL or 5V CMOS devices.

UET Taxila, Chakwal Campus

Page 34

Automatic Sorting, Counting and Bottle Filling System

Figure 5.3: ULN 2003 logic diagram

5.4 MCT 2e •

Gallium Arsenide Diode Infrared Source Optically Coupled to a Silicon np-n Photo transistor.



High Direct-Current Transfer Ratio. Base Lead Provided for Conventional Transistor Biasing



High-Voltage Electrical Isolation



1.5-kV, or 3.55-kV Rating

UET Taxila, Chakwal Campus

Page 35

Automatic Sorting, Counting and Bottle Filling System

Figure 5.4: MCT 2e

5.5 Relay A relay is an electrically operated switch. Many relays use an electromagnet to operate a switching mechanism mechanically, but other operating principles are also used. Relays are used where it is necessary to control a circuit by a low-power signal (with complete electrical isolation between control and controlled circuits), or where several circuits must be controlled by one signal.

UET Taxila, Chakwal Campus

Page 36

Automatic Sorting, Counting and Bottle Filling System

When an electric current is passed through the coil it generates a magnetic field that activates the armature, and the consequent movement of the movable contact (s) either makes or breaks (depending upon construction) a connection with a fixed contact. If the set of contacts was closed when the relay was de-energized, then the movement opens the contacts and breaks the connection, and vice versa if the contacts were open. When the current to the coil is switched off, the armature is returned by a force, approximately half as strong as the magnetic force, to its relaxed position. Usually this force is provided by a spring, but gravity is also used commonly in industrial motor starters. Most relays are manufactured to operate quickly. In a low-voltage application this reduces noise; in a high voltage or current application it reduces arcing.

Figure 5.5: Relay 5.6 IR sensor When IR rays gets emitted from LED, it moves in the direction it is angled. When any obstacle interferes in the path, the IR rays get cut and it produces secondary wavelets which propagates mostly in return direction or in a direction opposite to that of the primary waves, which produces the net result like reflection of IR rays. UET Taxila, Chakwal Campus

Page 37

Automatic Sorting, Counting and Bottle Filling System Infrared photo receiver is a two terminal PN junction device, which operates in a reverse bias. It has a small transparent window, which allows light to strike the PN junction. A photodiode is a type of photo detector capable of converting light into either current or voltage, depending upon the mode of operation. Most photodiodes will look similar to a light emitting diode. They will have two leads, or wires, coming from the bottom. The shorter end of the two is the cathode, while the longer end is the anode.

5.7 Resistor A resistor is a passive two-terminal electrical component that implements electrical resistance as a circuit element. The current through a resistor is in direct proportion to the voltage across the resistor's terminals. Thus, the ratio of the voltage applied across a resistor's terminals to the intensity of current through the circuit is called resistance. This relation is represented by Ohm's law:

Where I, is the current through the conductor in units of amperes, V is the potential difference measured across the conductor in units of volts, and R is the resistance of the conductor in units of ohms. More specifically, Ohm's law states that the R in this relation is constant, independent of the current. Resistors are common elements of electrical networks and electronic circuits and are ubiquitous in electronic equipment. Practical resistors can be made of various compounds and films, as well as resistance wire (wire made of a high-resistivity alloy, such as nickel-chrome). Resistors are also implemented

UET Taxila, Chakwal Campus

Page 38

Automatic Sorting, Counting and Bottle Filling System within integrated circuits, particularly analog devices, and can also be integrated into hybrid and printed circuits.

5.8 Capacitor A capacitor (originally known as condenser) is a passive two-terminal electrical component used to store energy in an electric field. The forms of practical capacitors vary widely, but all contain at least two electrical conductors separated by a dielectric (insulator); for example, one common construction consists of metal foils separated by a thin layer of insulating film. Capacitors are widely used as parts of electrical circuits in many common electrical devices. When there is a potential difference (voltage) across the conductors, a static electric field develops across the dielectric, causing positive charge to collect on one plate and negative charge on the other plate. Energy is stored in the electrostatic field. An ideal capacitor is characterized by a single constant value, capacitance, measured in farads. This is the ratio of the electric charge on each conductor to the potential difference between them. The capacitance is greatest when there is a narrow separation between large areas of conductor, hence capacitor conductors are often called "plates," referring to an early means of construction. In practice, the dielectric between the plates passes a small amount of leakage current and also has an electric field strength limit, resulting in a breakdown voltage, while the conductors and leads introduce an undesired inductance and resistance.

UET Taxila, Chakwal Campus

Page 39

Automatic Sorting, Counting and Bottle Filling System Capacitors are widely used in electronic circuits for blocking direct current while allowing alternating current to pass, in filter networks, for smoothing the output of power supplies in the resonant circuits that tune radios to particular frequencies, in electric power transmission systems for stabilizing voltage and power flow, and for many other purposes.

5.9 Led A light-emitting diode (LED) is a semiconductor light source. LEDs are used as indicator lamps in many devices and are increasingly used for other lighting. Introduced as a practical electronic component in 1962, early LEDs emitted low-intensity red light, but modern versions are available across the visible, ultraviolet, and infrared wavelengths, with very high

brightness. When a light-emitting diode is forward-biased (switched

on), electrons are able to recombine with electron holes within the device, releasing energy in the form of photons. This effect is called electroluminescence and the color of the light (corresponding to the energy of the photon) is determined by the energy gap of the semiconductor. LEDs are often small in area (less than 1 mm2), and integrated optical components

may

be

used

to

shape

its

radiation

pattern. LEDs

present

many advantages over incandescent light sources including lower energy consumption, longer lifetime, improved robustness, smaller size, and faster switching. LEDs powerful enough for room lighting are relatively expensive and require more precise current and heat management than compact fluorescent lamp sources of comparable output.

UET Taxila, Chakwal Campus

Page 40

Automatic Sorting, Counting and Bottle Filling System

Chapter 6: STRUCTURE (hardware) OF PROJECT

6.1 Dimension of conveyor belt Length == 12 feet Width == 21 inch

6.2 Dimension of wooden roller Length == 28 inch Diameter of roller == 4 inch

6.3 Diameter of pulleys Pulley 1 == 24 inch Pulley 2 == 12 inch Pulley 3 == 2 inch Pulley 4 == 2 inch

UET Taxila, Chakwal Campus

Page 41

Automatic Sorting, Counting and Bottle Filling System

6.4 Diameter of bearings There are four bearings used in our project, each having diameter 1.5 inch.

6.5 Diameter of shaft There are four shafts at the end of rollers. Each shaft has diameter equal to 1.5 inch.

6.6 Dimension of structure Length == 6 feet Width: Upper border == 26 inch Lower border == 29 inch Height == 18 inch

6.7 Types of wood •

Shesham



cheerh

UET Taxila, Chakwal Campus

Page 42

Automatic Sorting, Counting and Bottle Filling System

Chapter 7: IMPLEMENTATION AND CONTROL

In order to automate a process, first of all we need some sort of control system and also a physical device to implement that control system. Actually, control system is mathematical logic through which we can get results whatever we desired. It provides ON/OFF, proportional control, PID control but to implement this method, a physical device such as microcontroller or PLC etc is required. Following are the basic components of an automated system 1. Sensor 2. Signal conditioning 3. Control unit 4. Actuator 5. Feedback

1) SENSOR A sensor (also called detector) is a converter that measures a physical quantity and converts it into a signal which can be read by an observer or by an (today mostly electronic) instrument.

UET Taxila, Chakwal Campus

Page 43

Automatic Sorting, Counting and Bottle Filling System For example, a mercury-in-glass thermometer converts the measured temperature into expansion and contraction of a liquid which can be read on a calibrated glass tube. A thermocouple converts temperature to an output voltage which can be read by a voltmeter. For accuracy, most sensors are calibrated against known standards. Sensors are used in everyday objects such as touch-sensitive elevator buttons (tactile sensor) and lamps which dim or brighten by touching the base. There are also innumerable applications for sensors of which most people are never aware. Applications include cars, machines, aerospace, medicine, manufacturing and robotics. A sensor is a device which receives and responds to a signal. A sensor's sensitivity indicates how much the sensor's output changes when the measured quantity changes.

2) Signal conditioning In electronics, signal conditioning means manipulating an analog signal in such a way that it meets the requirements of the next stage for further processing. Most common use is in analog -to-digital converters. In control engineering applications, it is common to have a sensing stage (which consists of a sensor), a signal conditioning stage (where usually amplification of the signal is done) and a processing stage (normally carried out by an ADC and a microcontroller). Operational amplifiers (op-amps) are commonly employed to carry out the amplification of the signal in the signal conditioning stage.

UET Taxila, Chakwal Campus

Page 44

Automatic Sorting, Counting and Bottle Filling System Signal inputs accepted by signal conditioners include DC voltage and current, AC voltage and

current, frequency and electric

be accelerometer, thermocouple, thermistor,

charge.

Sensor

inputs

can

resistance thermometer, strain gauge or

bridge, and LVDT or RVDT. Specialized inputs include encoder, counter or tachometer, timer or clock, relay or switch, and other specialized inputs. Outputs for signal conditioning equipment can be voltage, current, frequency, timer or counter, relay, resistance or potentiometer, and other specialized output. Signal conditioning can include amplification, filtering, converting, range matching, isolation and any other processes required to make sensor output suitable for processing after conditioning.

3) Control unit In a general sense a control unit (CU) is a central (or sometimes distributed but clearly distinguishable) part of a mechanism that controls its operation, for example in a computer or a motor vehicle. The control unit coordinates the components of a computer system. It fetches the code of all of the instructions in the program. It directs the operation of the other units by providing timing and control signals. All computer resources are managed by the CU. It directs the flow of data between the Central Processing Unit (CPU) and the other devices.

UET Taxila, Chakwal Campus

Page 45

Automatic Sorting, Counting and Bottle Filling System The control unit was historically defined as one distinct part of the 1946 reference model of Von Neumann architecture. In modern computer designs, the control unit is typically an internal part of the CPU with its overall role and operation unchanged. The control unit is the circuitry that controls the flow of data through the processor.

4) Actuator An actuator is a type of motor for moving or controlling a mechanism or system. It is operated by a source of energy, usually in the form of an electric current, hydraulic fluid pressure or pneumatic pressure, and converts that energy into some kind of motion. An actuator is the mechanism by which an agent acts upon an environment. The agent can be either an artificial intelligence agent or any other autonomous being (human, other animal, etc.

5) Feedback Feedback is a process in which information about the past or the present influences the same phenomenon in the present or future. As part of a chain of cause-and-effect that forms a circuit or loop, the event is said to feed back into itself.

UET Taxila, Chakwal Campus

Page 46

Automatic Sorting, Counting and Bottle Filling System

Figure 7.1: MEASUREMENT SYSTEM

Figure 7.2: Feedback system

UET Taxila, Chakwal Campus

Page 47

Automatic Sorting, Counting and Bottle Filling System

Similarities between our project and the above feedback system are as follows: Controller

==

Microcontroller 89C51

Sensor

==

IR sensor

Actuator

==

Dc motor Push mechanism

Signal conditioning ==

Transistor darling-ton pair IC ( ULN 2003)

7.1 Circuit diagram of project

Figure 7.3 Circuit diagram UET Taxila, Chakwal Campus

Page 48

Automatic Sorting, Counting and Bottle Filling System

Figure 7.3.1: Circuit diagram of project

UET Taxila, Chakwal Campus

Page 49

Automatic Sorting, Counting and Bottle Filling System

7.1.1 Simulated circuit diagram

Figure 7.3.2: simulated circuit diagram

UET Taxila, Chakwal Campus

Page 50

Automatic Sorting, Counting and Bottle Filling System

7.1.2 Working of the circuit The IR sensors are clamped at specific height to detect the bottles according to their heights. When the sensor detects the bottle, it gives signal to the controller. Controller drives the dc motor for push mechanism, in this way sorting of bottle is done. In second stage, after sorting, when the bottle reaches near to the water reservoir. IR sensor detects bottle again it generates the logic 1. The controller receives that signal, and at the same time it performs two functions by switching two relays. The first relay stops the motor which is driving the conveyor belt. Secondly, solenoid valve is actuated via second relay.

UET Taxila, Chakwal Campus

Page 51

Automatic Sorting, Counting and Bottle Filling System

Chapter 8: APPLICATIONS AND ADVANTAGES

In previous chapters we have discussed about the project. Now it’s turn to come to know about the applications and advantages of this project. Due to these applications which we shall discuss in this chapter, we preferred to choose this idea. The main aims of our project were automatic sorting and liquid filling.

8.1 Applications of automatic sorting

Automated sorting systems will feature computerized controls that will allow materials to be sorted without human control or interaction. This is suitable for high-volume jobs that would require high levels of manpower otherwise. Automated systems tend to be more expensive than manual systems, and operators of these machines will usually need to undergo significant training before the system can be used effectively. Manual systems tend to be less expensive and far easier to use; they are also more easily serviceable, whereas automated systems may require lengthy troubleshooting and diagnostics.

UET Taxila, Chakwal Campus

Page 52

Automatic Sorting, Counting and Bottle Filling System

Following are the application of automatic sorting:

1) Parts handling •

Conveying product from machine to packaging area or bowl feeders



Conveying process waste and scrap products to granulator



Separation of sprues in injection moulding process (closed loop)



Soft Drop conveying systems for PET performs to eliminate damage



Parts distribution for multiple box filling - The Duck is designed to convey parts from a conveyor into boxes. Programmable to dispense precise number of parts into each box.



Parts Conveyors linking with pick and place robots, including interface and guarding



Multiple machine conveying systems for central packaging via PLC control

2) Pharmaceutical, food beverage Pharmaceutical industries like Glaxo and Abbot Pakistan make variety of products. These products are transported through conveyor belt. They are sorted out according to their similarities. Automating sorting can be applied in the food and consumer goods producing industries like Nestle and uniliver because they have variety of products.

UET Taxila, Chakwal Campus

Page 53

Automatic Sorting, Counting and Bottle Filling System

3) Separation of defective parts Automatic sorting is also useful in separating defective parts. In Balochistan glass industry where production of glasses takes place, defective pieces are sorted out. Later on, these defective pieces are reproduced.

4) Separation of boxes In packages industry Lahore, variety of boxes are produced, which are further used for packing for example milk pack. The boxes are separated from one another on the basis of their size.

5) Ceramic and tiles In Master tiles, in which heavy boxes are produced with high accuracy and speed. It is the best application of automatic sorting.

8.1.1 Advantages of conveyor •

Reduce labor by automation



Enables central packaging of product



Eliminates manual sorting of mouldings and sprues



Reduces possibility of surface damage to product UET Taxila, Chakwal Campus

Page 54

Automatic Sorting, Counting and Bottle Filling System •

Promotes good 'housekeeping



Belt conveyors are capable of handling a wide range of bulk materials from very fine to large lump sizes. Very fine materials such as portland cement are loaded at terminals using belt conveyors. Large lump size materials such as coal are transported from mines using belt conveyors.



Belt conveyors require less horsepower to operate than other types of conveyors. Bulk materials are carried on top of the belt and remain static, therefore requiring much less energy to move.



Conveyor belts are mechanical apparatuses that contain a continuous moving belt that is used to transport materials, packages and people from one point to another. The belt operates by forming a continuous loop on rollers or metal sliders. Power is provided by motors operating at constant or variable speed.

8.2 Applications of liquid filling E-PAK Machinery, Inc. offers a wide variety of liquid filling machine technologies capable of filling viscous and non-viscous liquids as well as foamy products with a high degree of accuracy and many options to choose from. Our filling systems are fully capable of meeting the needs of food grade, sanitary, pharmaceutical, hazardous, and corrosive environments. We pride ourselves on providing the product your business needs, from big aseptic beverage or drum filling machines to filling machines that can handle containers as small as a cup, tube, vial, or ampoule.

UET Taxila, Chakwal Campus

Page 55

Automatic Sorting, Counting and Bottle Filling System 1.

Automatic capsule filling machine. This machine is designed and further improved on the base of original full auto capsule filling machine from home and aboard.

Type: Filling Machine 2.

Milk filling

UET Taxila, Chakwal Campus

Page 56

Automatic Sorting, Counting and Bottle Filling System

Chapter 9: CONCLUSION AND FUTURE WORK

Our objectives of making this project are: •

to increase productivity and



provide safe material handling operations,



reduce cost and



manpower

We did sorting on the basis of height of the bottles. However, sorting can be improved through image processing. In image processing bottle can be sorted on the basis of colors and shapes. The second part of our project was bottle filling, for which we used solenoid operated valve. We did programming in such a way that it actuated the valve for a few seconds. The operation of filling of bottles can be improved by using level sensor. For further improvement of material handling operations Scara Robot can be used. The robot is very helpful in picking and placing of bottles. But in this project we manually place the bottles on the conveyor.

UET Taxila, Chakwal Campus

Page 57

Automatic Sorting, Counting and Bottle Filling System

References http://en.wikipedia.org/wiki/Conveyor_belt http://en.wikipedia.org/wiki/Sorting http://en.wikipedia.org/wiki/Bearing_(mechanical) http://en.wikipedia.org/wiki/Pulley http://en.wikipedia.org/wiki/Induction_motor http://www.ziva-vatra.com/index.php?aid=26&id=RWxlY3Ryb25pY3M= http://www.engineersgarage.com/electronic-components/at89c51-microcontrollerdatasheet http://en.wikipedia.org/wiki/Liquid_crystal_display 2003http://www.datasheetcatalog.org/datasheets/120/489337_DS.pdf http://www.datasheetcatalog.org/datasheets/90/424848_DS.pdf http://en.wikipedia.org/wiki/Relay

UET Taxila, Chakwal Campus

Page 58

Automatic Sorting, Counting and Bottle Filling System

GLOSSARY Sensor A device that measures a physical quantity and converts it into a signal which can be read by an observer or by an instrument

Sorting Sorting is any process of arranging items in some sequence and/or in different sets.

Transistor (BJT’s) Three terminal electronic device constructed of doped semiconductor material and may be used in amplifying or switching applications

Electromagnetic induction The phenomenon in which emf is induced in a conductor, when it is moving through the magnetic field.

Electromotive force (emf) It tends to cause current to flow.

UET Taxila, Chakwal Campus

Page 59

Automatic Sorting, Counting and Bottle Filling System

Appendix Program code

ORG 0H CLR P2.6 CLR P2.3 CLR P2.4

MOV A,#38H ACALL COMNWRT ACALL DELAY MOV A,#0CH ;;;DISPLAY ON CURSOR OF BUT IF WE USE 0E THEN DISPLAY WILL BE ON BUT CURSOR WILL ALSO BE ON ACALL COMNWRT ACALL DELAY MOV A,#01 ACALL COMNWRT UET Taxila, Chakwal Campus

Page 60

Automatic Sorting, Counting and Bottle Filling System

ACALL DELAY MOV A,#06H ACALL COMNWRT ACALL DELAY MOV A,#80H ACALL COMNWRT ACALL DELAY

MOV A,#'A' ACALL DATAWRT ACALL DELAY MOV A,#'U' ACALL DATAWRT ACALL DELAY

MOV A,#'T' ACALL DATAWRT UET Taxila, Chakwal Campus

Page 61

Automatic Sorting, Counting and Bottle Filling System

ACALL DELAY

MOV A,#'M' ACALL DATAWRT ACALL DELAY ;give LCD some time

MOV A,#'A' ;cursor at line 1, pos. 5 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'T' ;cursor at line 1, pos. 6 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'I' ;cursor at line 1, pos. 7 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time UET Taxila, Chakwal Campus

Page 62

Automatic Sorting, Counting and Bottle Filling System

MOV A,#'C' ;cursor at line 1, pos. 8 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#' ' ;cursor at line 1, pos. 9 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'S' ;cursor at line 1, pos. 10 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'O' ;cursor at line 1, pos. 11 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

UET Taxila, Chakwal Campus

Page 63

Automatic Sorting, Counting and Bottle Filling System

MOV A,#'R' ;cursor at line 1, pos. 12 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'T' ;cursor at line 1, pos. 12 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'I' ;cursor at line 1, pos. 13 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'N' ;cursor at line 1, pos. 14 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'G' ;cursor at line 1, pos. 15 UET Taxila, Chakwal Campus

Page 64

Automatic Sorting, Counting and Bottle Filling System

ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#0C0H ACALL COMNWRT ACALL DELAY

MOV A,#'&' ;cursor at line 2, pos. 1 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time MOV A,#' ' ;cursor at line 2, pos. 2 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'B' ;cursor at line 2, pos. 3 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time UET Taxila, Chakwal Campus

Page 65

Automatic Sorting, Counting and Bottle Filling System

MOV A,#'O' ;cursor at line 2, pos. 4 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'T' ;cursor at line 2, pos. 5 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'T' ;cursor at line 2, pos. 6 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'L' ;cursor at line 2, pos. 7 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

UET Taxila, Chakwal Campus

Page 66

Automatic Sorting, Counting and Bottle Filling System

MOV A,#'E' ;cursor at line 2, pos. 8 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#' ' ;cursor at line 2, pos. 9 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'F' ;cursor at line 2, pos. 10 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'I' ;cursor at line 2, pos. 11 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'L' ;cursor at line 2, pos. 12 UET Taxila, Chakwal Campus

Page 67

Automatic Sorting, Counting and Bottle Filling System

ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'L' ;cursor at line 2, pos. 13 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'L' ;cursor at line 2, pos. 14 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'I' ;cursor at line 2, pos. 15 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'N' ;cursor at line 2, pos. 16 ACALL DATAWRT ;call DATA subroutine UET Taxila, Chakwal Campus

Page 68

Automatic Sorting, Counting and Bottle Filling System

ACALL DELAY ;give LCD some time

MOV A,#'G' ;cursor at line 2, pos. 17 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#94H ACALL COMNWRT ACALL DELAY

MOV A,#'2' ;cursor at line 3, pos. 1 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time MOV A,#' ' ;cursor at line 3, pos. 2 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time UET Taxila, Chakwal Campus

Page 69

Automatic Sorting, Counting and Bottle Filling System

MOV A,#'L' ;cursor at line 3, pos. 3 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'I' ;cursor at line 3, pos. 4 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'T' ;cursor at line 3, pos. 5 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'R' ;cursor at line 3, pos. 6 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

UET Taxila, Chakwal Campus

Page 70

Automatic Sorting, Counting and Bottle Filling System

MOV A,#'E' ;cursor at line 3, pos. 7 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#' ' ;cursor at line 3, pos. 8 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'B' ;cursor at line 3, pos. 9 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'O' ;cursor at line 3, pos. 10 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time UET Taxila, Chakwal Campus

Page 71

Automatic Sorting, Counting and Bottle Filling System

MOV A,#'T' ;cursor at line 3, pos. 11 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'T' ;cursor at line 3, pos. 12 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'L' ;cursor at line 3, pos. 13 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'E' ;cursor at line 3, pos. 14 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

UET Taxila, Chakwal Campus

Page 72

Automatic Sorting, Counting and Bottle Filling System

MOV A,#' ' ;cursor at line 3, pos. 15 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'=' ;cursor at line 3, pos. 16 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#' ' ;cursor at line 3, pos. 17 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#0D4H ;cursor at line 4, pos. 1 ACALL COMNWRT ;call command subroutine ACALL DELAY ;give LCD some time

UET Taxila, Chakwal Campus

Page 73

Automatic Sorting, Counting and Bottle Filling System

MOV A,#'1' ;cursor at line 4, pos. 1 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time MOV A,#' ' ;cursor at line 4, pos. 2 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'L' ;cursor at line 4, pos. 3 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'I' ;cursor at line 4, pos. 4 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'T' ;cursor at line 4, pos. 5 ACALL DATAWRT ;call DATA subroutine UET Taxila, Chakwal Campus

Page 74

Automatic Sorting, Counting and Bottle Filling System

ACALL DELAY ;give LCD some time

MOV A,#'R' ;cursor at line 4, pos. 6 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'E' ;cursor at line 4, pos. 7 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#' ' ;cursor at line 4, pos. 8 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'B' ;cursor at line 4, pos. 9 UET Taxila, Chakwal Campus

Page 75

Automatic Sorting, Counting and Bottle Filling System

ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'O' ;cursor at line 4, pos. 10 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'T' ;cursor at line 4, pos. 11 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'T' ;cursor at line 4, pos. 12 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'L' ;cursor at line 4, pos. 13 ACALL DATAWRT ;call DATA subroutine UET Taxila, Chakwal Campus

Page 76

Automatic Sorting, Counting and Bottle Filling System

ACALL DELAY ;give LCD some time

MOV A,#'E' ;cursor at line 4, pos. 14 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#' ' ;cursor at line 4, pos. 15 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#'=' ;cursor at line 4, pos. 16 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time

MOV A,#' ' ;cursor at line 4, pos. 17 ACALL DATAWRT ;call DATA subroutine ACALL DELAY ;give LCD some time UET Taxila, Chakwal Campus

Page 77

Automatic Sorting, Counting and Bottle Filling System

MOV TMOD, #01100110B SETB P0.1 SETB P0.2 SETB P3.4 ;;COUNTER0 SETB P3.5 ;;COUNTER1 MOV TH0, #0FFH MOV TH1, #0FFH

AGAIN: UET Taxila, Chakwal Campus

Page 78

Automatic Sorting, Counting and Bottle Filling System

SETB TR0 SETB TR1

BACK: JB P0.1,TWO_LITER_BOT ; ;KEEP MONITORING VALVE TWO CLR P2.3 JB P0.2,ONE_LITER_BOT ;KEEP MONITORING VALVE ONE CLR P2.4 JB P0.3,CDROM CLR P2.6 MOV A, TL0 ACALL CONV ACALL DISPLAY JB TF0,WAHEED MOV A, TL1 UET Taxila, Chakwal Campus

Page 79

Automatic Sorting, Counting and Bottle Filling System

ACALL CONV ACALL DISPLAY1

JNB TF1,BACK CLR TR1 CLR TF1 MOV TL1,#00H SJMP AGAIN

WAHEED:

CLR TR0 CLR TF0 MOV TL0,#00H SJMP AGAIN

CONV: UET Taxila, Chakwal Campus

Page 80

Automatic Sorting, Counting and Bottle Filling System

MOV B,#10 DIV AB MOV R2,B MOV B,#10 DIV AB ORL A,#30H MOV R4, A MOV A,B ORL A,#30H MOV R3,A MOV A,R2 ORL A,#30H MOV R2,A RET

DISPLAY1: UET Taxila, Chakwal Campus

Page 81

Automatic Sorting, Counting and Bottle Filling System

MOV A,#0E5H ACALL COMNWRT ;call command subroutine ACALL DELAY ;give LCD some time MOV A,R4 ACALL DATAWRT ACALL DELAY MOV A,R3 ACALL DATAWRT ACALL DELAY

MOV A,R2 ACALL DATAWRT ACALL DELAY

RET TWO_LITER_BOT: UET Taxila, Chakwal Campus

Page 82

Automatic Sorting, Counting and Bottle Filling System

ACALL DELAY5 CLR P2.5 ACALL DELAY SETB P2.3 ;OPEN VALVE OF 2 LITRE BOTTLE ACALL DELAY1

SETB P2.5

CLR P2.3 SETB P2.6 ACALL DELAY2 CLR P2.6 LJMP BACK

ONE_LITER_BOT: ACALL DELAY3 CLR P2.5 UET Taxila, Chakwal Campus

Page 83

Automatic Sorting, Counting and Bottle Filling System

ACALL DELAY SETB P2.4 ;OPEN VALVE OF 1 LITRE BOTTLE ACALL DELAY4 SETB P2.5 CLR P2.4 LJMP BACK

CDROM: SETB P2.6 ACALL DELAY2 CLR P2.6 LJMP BACK

DISPLAY:

MOV A,#0A5H ACALL COMNWRT UET Taxila, Chakwal Campus

Page 84

Automatic Sorting, Counting and Bottle Filling System

ACALL DELAY MOV A,R4 ACALL DATAWRT ACALL DELAY MOV A,R3 ACALL DATAWRT ACALL DELAY

MOV A,R2 ACALL DATAWRT ACALL DELAY

RET

COMNWRT: MOV P1,A ;copy reg A to port 1 CLR P2.0 ;RS=0 for command UET Taxila, Chakwal Campus

Page 85

Automatic Sorting, Counting and Bottle Filling System

CLR P2.1 ;R/W=0 for write SETB P2.2 ;E=1 for high pulse ACALL DELAY ;give LCD some time CLR P2.2 ;E=0 for H-to-L pulse RET DATAWRT: ;write data to LCD MOV P1,A ;copy reg A to port 1 SETB P2.0 ;RS=1 for data CLR P2.1 ;R/W=0 for write SETB P2.2 ;E=1 for high pulse ACALL DELAY ;give LCD some time CLR P2.2 ;E=0 for H-to-L pulse RET DELAY: MOV R6,#20 ;250 or higher for fast CPUs HERE2: MOV R7,#200 ;R4 = 255 HERE: DJNZ R7,HERE ;stay until R4 becomes 0 DJNZ R6,HERE2 UET Taxila, Chakwal Campus

Page 86

Automatic Sorting, Counting and Bottle Filling System

RET DELAY1: MOV R1,#6 HERE6:MOV R2,#25 HERE5:MOV R3,#250 HERE4:MOV R4,#250 HERE3:DJNZ R4,HERE3 DJNZ R3,HERE4 DJNZ R2,HERE5 DJNZ R1,HERE6 RET

DELAY2: MOV R5,#100 W:MOV R6,#210 ;250 or higher for fast CPUs W1: MOV R7,#100 ;R4 = 255 W2: DJNZ R7,W2 ;stay until R4 becomes 0 UET Taxila, Chakwal Campus

Page 87

Automatic Sorting, Counting and Bottle Filling System

DJNZ R6,W1 DJNZ R5,W RET DELAY3: MOV R5,#4 IRFAN:MOV R6,#255 ;255 or higher for fast CPUs IRFAN1: MOV R7,#255 ;R7 = 255 IRFAN2: DJNZ R7,IRFAN2 ;stay until R7 becomes 0 DJNZ R6,IRFAN1 DJNZ R5,IRFAN RET

DELAY4: MOV R1,#8 SALEEM6:MOV R2,#10 SALEEM5:MOV R3,#250 SALEEM4:MOV R4,#250 UET Taxila, Chakwal Campus

Page 88

Automatic Sorting, Counting and Bottle Filling System

SALEEM3:DJNZ R4,SALEEM3 DJNZ R3,SALEEM4 DJNZ R2,SALEEM5 DJNZ R1,SALEEM6 RET

DELAY5: MOV R5,#17 LAIQ:MOV R6,#255 ;255 or higher for fast CPUs LAIQ1: MOV R7,#255 ;R7 = 255 LAIQ2: DJNZ R7,LAIQ2 ;stay until R7 becomes 0 DJNZ R6,LAIQ1 DJNZ R5,LAIQ RET END

UET Taxila, Chakwal Campus

Page 89