You are on page 1of 51

A PROJECT REPORT ON

AUTOMATIC BOTTLE FILLING SYSTEM USING


MICROCONTROLLER

Submitted in Partial Fulfillment of Requirements for Award of the


Degree of Bachelor of Physics in Department of Physics
Bahauddin Zakariya University, Multan

By

Muhammad Bilal Habib BS-M-P-15-22


Ghulam Meeladi BS-M-P-15-32
Muhammad Mohsin BS-M-P-15-35
Muhammad Shahid Iqbal BS-M-P-15-26
Muhammad Bilal Mughal BS-M-P-15-52
Session (2015-2019)

Under the Esteemed Guidance of

PROF. DR. JAVED AHMAD


DR. NOMAN USMANI

DEPARTMENT OF PHYSICS
BAHAUDDIN ZAKARIYA UNIVERSITY,
MULTAN
CERTIFICATE

This is to certify that the thesis entitled “Automatic Bottle Filling System Using
Microcontroller” is being submitted by
Muhammad Bilal Habib BS-M-P-15-22
Ghulam Meeladi BS-M-P-15-32
Muhammad Mohsin BS-M-P-15-35
Muhammad Shahid Iqbal BS-M-P-15-26
Muhammad Bilal Mughal BS-M-P-15-52
In partial fulfillment of requirements for award of the degree of Bachelor of Physics in
Department of Physics Bahauddin Zakariya University Multan is a record of bonafide work
carried out by them at department of physics.
The result embodied in this project report have not been submitted in any other university or
institute for award of any degree or diploma.

Project Guide Head of department


Dr. Nauman Usmani Prof. Dr. Javed Ahmad
ACKNOWLEDGEMENT

Firstly, we thank Almighty Allah for all the blessings and help in the completion of this project.
We take great pleasure to express our deep sense of gratitude to our project guide Dr.Nauman
Usmani, Assistant Professor, for his valuable guidance during the course of our project work.

We would like to thank Prof.Dr. Javed Ahmad, Head of department of physics for his
encouragement.

We would like to express our heat-felt thanks to Mr. Maqsood, for providing all the facilities for
our project.

Our utmost thanks to all the faculty members and non teaching staff of department of physics for
their support throughout our project work.

Our Family members and friends receive our deepest gratitude and love for their support
throughout the academic year.

Muhammad Bilal Habib BS-M-P-15-22


Ghulam Meeladi BS-M-P-15-32
Muhammad Mohsin BS-M-P-15-35
Muhammad Shahid Iqbal BS-M-P-15-26
Muhammad Bilal Mughal BS-M-P-15-52
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.4 Bottle filling
Chapter 3: MECHANICAL COMPONENTS

UET Taxila, Chakwal Campus


Page 6

Chapter 5: ELECTRONIC COMPONENTS


5.1 Microcontroller pic 16F877
5.2 LCD (20x4)
5.5 Relay
5.6 IR sensor
5.7 Resistor
Automatic Sorting, Counting and Bottle Filling System
UET Taxila, Chakwal Campus
Page 7

5.8 Capacitor
Chapter 6: Structure of Project
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.1 Advantages
8.2 Applications of liquid filling
Automatic Sorting, Counting and Bottle Filling System
UET Taxila, Chakwal Campus
Page 8

Chapter 9: Conclusion and future work


Conclusion
References
Appendix A
Glossary

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.
Block Diagram:

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.

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.
Advantages of relays

Relays can switch AC and DC, transistors can only switch DC.

Relays can switch higher voltages than standard transistors.

Relays are often a better choice for switching large currents (> 5A).

Relays can switch many contacts at once.

Disadvantages of relays

Relays are bulkier than transistors for switching small currents.

Relays cannot switch rapidly (except reed relays), transistors can switch many times per
second.

Relays use more power due to the current flowing through their coil.

Relays require more current than many ICs can provide, so a low power transistor may be
needed to switch the current for the relay's coil.

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. 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.
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 within integrated circuits, particularly
analog devices, and can also be integrated into hybrid and printed circuits.

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.

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.

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.

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.

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 micro controller). Operational
amplifiers (op-amps) are commonly employed to carry out the amplification of the signal in the
signal conditioning stage.

Signal inputs accepted by signal conditioners include DC voltage and current, AC voltage
and current, frequency and electric charge. Sensor inputs can be accelerometer, thermocouple,
thermistor, 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.

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.

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.
Components used:

 Microcontroller AT89C51
 Resistor
 Capacitor
 DC power supply
 LED
 Switch
 Transistor
 Buzzer
 Relay
 Voltage Regulator
 LCD Display
 Socket
 Diode
 • Internal short circuit current limiting
 • Output transistor safe-area compensation
 • Output voltage offered in 2% and 4% tolerance
 • Available I n surface mount D2PAK and standard 3-lead transistor packages
 • Previous commercial temperature range has been extended to a junction temperature
range of -40 degree C to +125 degree C.

 Main Controlling Bored:



 PIC 16F877
 PIC 16F877 is one of the most advanced microcontroller from Microchip. This controller
is widely used for experimental and modern applications because of its low price, wide
range of applications, high quality, and ease of availability. It is ideal for applications
such as machine control applications, measurement devices, study purpose, and so on.
The PIC 16F877 features all the components which modern microcontrollers normally
have. The figure of a PIC16F877 chip is shown below.


 Features of PIC16F877
 The PIC16FXX series has more advanced and developed features when compared to its
previous series. The important features of PIC16F877 series is given below.
 General Features
 o High performance RISC CPU.
 o ONLY 35 simple word instructions.
 o All single cycle instructions except for program branches which are two cycles.
 o Operating speed: clock input (200MHz), instruction cycle (200nS).
 o Up to 368×8bit of RAM (data memory), 256×8 of EEPROM (data memory), 8k×14 of
flash memory.
 o Pin out compatible to PIC 16C74B, PIC 16C76, PIC 16C77.
 o Eight level deep hardware stack.
 o Interrupt capability (up to 14 sources).
 o Different types of addressing modes (direct, Indirect, relative addressing modes).
 o Power on Reset (POR).
 o Power-Up Timer (PWRT) and oscillator start-up timer.
 o Low power- high speed CMOS flash/EEPROM.
 o Fully static design.
 o Wide operating voltage range (2.0 – 5.56)volts.
 o High sink/source current (25mA).
 o Commercial, industrial and extended temperature ranges.
 o Low power consumption (<0.6mA typical @3v-4MHz, 20µA typical @3v-32MHz
and <1 A typical standby).
 Peripheral Features
 o Timer 0: 8 bit timer/counter with pre-scalar.
 o Timer 1:16 bit timer/counter with pre-scalar.
 o Timer 2: 8 bit timer/counter with 8 bit period registers with pre-scalar and post-scalar.
 o Two Capture (16bit/12.5nS), Compare (16 bit/200nS), Pulse Width Modules (10bit).
 o 10bit multi-channel A/D converter
 o Synchronous Serial Port (SSP) with SPI (master code) and I2C (master/slave).
 o Universal Synchronous Asynchronous Receiver Transmitter (USART) with 9 bit
address detection.
 o Parallel Slave Port (PSP) 8 bit wide with external RD, WR and CS controls
(40/46pin).
 o Brown Out circuitry for Brown-Out Reset (BOR).
 Key Features
 o Maximum operating frequency is 20MHz.
 o Flash program memory (14 bit words), 8KB.
 o Data memory (bytes) is 368.
 o EEPROM data memory (bytes) is 256.
 o 5 input/output ports.
 o 3 timers.
 o 2 CCP modules.
 o 2 serial communication ports (MSSP, USART).
 o PSP parallel communication port
 o 10bit A/D module (8 channels)
 Analog Features
 o 10bit, up to 8 channel A/D converter.
 o Brown Out Reset function.
 o Analog comparator module.
 Special Features
 o 100000 times erase/write cycle enhanced memory.
 o 1000000 times erase/write cycle data EEPROM memory.
 o Self programmable under software control.
 o In-circuit serial programming and in-circuit debugging capability.
 o Single 5V,DC supply for circuit serial programming
 o WDT with its own RC oscillator for reliable operation.
 o Programmable code protection.
 o Power saving sleep modes.
 o Selectable oscillator options.
 Pin Diagrams
 PIC16F877 chip is available in different types of packages. According to the type of
applications and usage, these packages are differentiated. The pin diagrams of a
PIC16F877 chip in different packages are shown in the figure below.

 Input/output ports
 PIC16F877 has 5 basic input/output ports. They are usually denoted by PORT A (R A),
PORT B (RB), PORT C (RC), PORT D (RD), and PORT E (RE). These ports are used
for input/ output interfacing. In this controller, “PORT A” is only 6 bits wide (RA-0 to
RA-7), ”PORT B” , “PORT C”,”PORT D” are only 8 bits wide (RB-0 to RB-7,RC-0 to
RC-7,RD-0 to RD-7), ”PORT E” has only 3 bit wide (RE-0 to RE-7).


 All these ports are bi-directional. The direction of the port is controlled by using TRIS(X)
registers (TRIS A used to set the direction of PORT-A, TRIS B used to set the direction
for PORT-B, etc.). Setting a TRIS(X) bit ‘1’ will set the corresponding PORT(X) bit as
input. Clearing a TRIS(X) bit ‘0’ will set the corresponding PORT(X) bit as output.
 (If we want to set PORT A as an input, just set TRIS(A) bit to logical ‘1’ and want to set
PORT B as an output, just set the PORT B bits to logical ‘0’.)
 o Analog input port (AN0 TO AN7) : these ports are used for interfacing analog inputs.
 o TX and RX: These are the USART transmission and reception ports.
 o SCK: these pins are used for giving synchronous serial clock input.
 o SCL: these pins act as an output for both SPI and I2C modes.
 o DT: these are synchronous data terminals.
 o CK: synchronous clock input.
 o SD0: SPI data output (SPI Mode).
 o SD1: SPI Data input (SPI mode).
 o SDA: data input/output in I2C Mode.
 o CCP1 and CCP2: these are capture/compare/PWM modules.
 o OSC1: oscillator input/external clock.
 o OSC2: oscillator output/clock out.
 o MCLR: master clear pin (Active low reset).
 o Vpp: programming voltage input.
 o THV: High voltage test mode controlling.
 o Vref (+/-): reference voltage.
 o SS: Slave select for the synchronous serial port.
 o T0CK1: clock input to TIMER 0.
 o T1OSO: Timer 1 oscillator output.
 o T1OS1: Timer 1 oscillator input.
 o T1CK1: clock input to Timer 1.
 o PGD: Serial programming data.
 o PGC: serial programming clock.
 o PGM: Low Voltage Programming input.
 o INT: external interrupt.
 o RD: Read control for parallel slave port.
 o CS: Select control for parallel slave.
 o PSP0 to PSP7: Parallel slave port.
 o VDD: positive supply for logic and input pins.
 o VSS: Ground reference for logic and input/output pins.
 Take a look at the specifications of the PIC 16F87X Series.



 CRYSTAL OSCILLATOR:
 It is often required to produce a signal whose frequency or pulse rate is very stable and
exactly known. This is important in any application where anything to do with time or
exact measurement is crucial. It is relatively simple to make an oscillator that produces
some sort of a signal, but another matter to produce one of relatively precise frequency
and stability. An ordinary quartz watch must have an oscillator accurate to better than a
few parts per million. One part per million will result in an error of slightly less than one
half second a day, which would be about 3 minutes a year. This might not sound like
much, but an error of 10 parts per
million would result in an error of about a half an hour per year. A clock such as this
would need resetting about once a month, and more often if you are the punctual type.
 Fig Crystal oscillator


 A crystal oscillator is an electronic circuit that uses the mechanical resonance of a
vibrating crystal of piezoelectric material to create an electrical signal with a very precise
frequency. This frequency is commonly used to keep track of time (as in quartz
wristwatches), to provide a stable clock signal for digitalintegrated circuits, and to
stabilize frequencies for radio transmitters and receivers. The most common type of
piezoelectric resonator used is the quartz crystal, so oscillator circuits designed around
them were called "crystal oscillators".
 Quartz crystals are manufactured for frequencies from a few tens of kilohertz to tens of
megahertz. More than two billion (2×109) crystals are manufactured annually. Most are
small devices for consumer devices such as wristwatches, clocks, radios, computers, and
cellphones. Quartz crystals are also found inside test and measurement equipment, such
as counters, signal generators, and oscilloscopes.
 OPERATION:
 A crystal is a solid in which the constituent atoms, molecules, or ions are packed in a
regularly ordered, repeating pattern extending in all three spatial dimensions.
 Almost any object made of an elastic material could be used like a crystal, with
appropriate transducers, since all objects have natural resonant frequencies of vibration.
For example, steel is very elastic and has a high speed of sound. It was often used in
mechanical filters before quartz. The resonant frequency depends on size, shape,
elasticity, and the speed of sound in the material. High-frequency crystals are typically
cut in the shape of a simple, rectangular plate. Low-frequency crystals, such as those used
in digital watches, are typically cut in the shape of a tuning fork. For applications not
needing very precise timing, a low-cost ceramic resonator is often used in place of a
quartz crystal.
 When a crystal of quartz is properly cut and mounted, it can be made to distort in an
electric field by applying a voltage to an electrode near or on the crystal. This property is
known as piezoelectricity. When the field is removed, the quartz will generate an electric
field as it returns to its previous shape, and this can generate a voltage. The result is that a
quartz crystal behaves like a circuit composed of an inductor, capacitor and resistor, with
a precise resonant frequency. (See RLC circuit.)
 Quartz has the further advantage that its elastic constants and its size change in such a
way that the frequency dependence on temperature can be very low. The specific
characteristics will depend on the mode of vibration and the angle at which the quartz is
cut (relative to its crystallographic axes).[7] Therefore, the resonant frequency of the plate,
which depends on its size, will not change much, either. This means that a quartz clock,
filter or oscillator will remain accurate. For critical applications the quartz oscillator is
mounted in a temperature-controlled container, called a crystal oven, and can also be
mounted on shock absorbers to prevent perturbation by external mechanical vibrations.
 CERAMIC CAPACITOR
 The main differences between ceramic dielectric types are the temperature coefficient of
capacitance, and the dielectric loss. C0G and NP0 (negative-positive-zero, i.e. ±0)
dielectrics have the lowest losses, and are used in filters, as timing elements, and for
balancing crystal oscillators. Ceramic capacitors tend to have low inductance because of
their small size. NP0 refers to the shape of the capacitor's temperature coefficient graph
(how much the capacitance changes with temperature). NP0 means that the graph is flat
and the device is not affected by temperature changes.
 DESCRIPTION OF IR SENSOR
 This circuit is one of the most basic and popular sensor modules. In electronics, this
sensor is analogous to human’s visionary senses which can be used to detect an obstacle
which is one of its common applications. In robotics, a group of such modules are used so
that a robot can follow a line pattern.
 The transmitter part of the sensor is an Infrared (IR) Led which transmits continuous IR
rays to be received by an IR receiver. The output of the receiver varies depending upon
its reception of IR rays. Since this variation cannot be analyzed as such, therefore this
output can be fed to a comparator. Here operational amplifier (op-amp) of LM 339 is
used as comparator.
 When the IR receiver does not receive signal the potential at the inverting input goes
higher than that that at non-inverting input of the comparator (LM 339). Thus the output
of the comparator goes low and the LED does not glow .When the IR receiver receives
signal the potential at the inverting input goes low. Thus the output of the comparator
(LM 339) goes high and the LED starts glowing. Resistor R1 (100 ), R2 (10k ) and R3
(330 ) are used to ensure that minimum 10 mA current passes through the IR LED,
photodiode and normal LED, respectively. Resistor VR2 (preset=5k ) is used to adjust
the output. Resistor VR1 (preset=10k ) is used to set the sensitivity of the circuit.
 TRANSISTOR BC547:
 BC547 is an NPN bi-polar junction transistor. A transistor, stands for transfer of
resistance, is commonly used to amplify current. A small current at its base controls a
larger current at collector & emitter terminals.
BC547 is mainly used for amplification and switching purposes. It has a maximum
current gain of 800. Its equivalent transistors are BC548 and BC549.
 The transistor terminals require a fixed DC voltage to operate in the desired region of its
characteristic curves. This is known as the biasing. For amplification applications, the
transistor is biased such that it is partly on for all input conditions. The input signal at
base is amplified and taken at the emitter. BC547 is used in common emitter
configuration for amplifiers. The voltage divider is the commonly used biasing mode. For
switching applications, transistor is biased so that it remains fully on if there is a signal at
its base. In the absence of base signal, it gets completely off.
 Pin Diagram:

 IR LED:
 An IR LED, also known as IR transmitter, is a special purpose LED that transmits
infrared rays in the range of 760 nm wavelength. Such LEDs are usually made of gallium
arsenide or aluminium gallium arsenide. They, along with IR receivers, are commonly
used as sensors.
The appearance is same as a common LED. Since the human eye cannot see the infrared
radiations, it is not possible for a person to identify whether the IR LED is working or
not, unlike a common LED. To overcome this problem, the camera on a cellphone can be
used. The camera can show us the IR rays being emanated from the IR LED in a circuit.
 Pin Diagram:

 Relay:
 What is Relay…..?
 A relay is usually an electromechanical device that is actuated by an electrical current.
The current flowing in one circuit causes the opening or closing of another circuit. Relays
are like remote control switches
and are used in many
applications because of their
relative simplicity, long life,
and proven high reliability.
Relays are used in a wide
variety of applications
throughout industry, such as in
telephone exchanges, digital computers and automation systems. Highly sophisticated
relays are utilized to protect electric power systems against trouble and power blackouts
as well as to regulate and control the generation and distribution of power. In the home,
relays are used in refrigerators, washing machines and dishwashers, and heating and air-
conditioning controls. Although relays are generally associated with electrical circuitry,
there are many other types, such as pneumatic and hydraulic. Input may be electrical and
output directly mechanical, or vice versa.
How do relays work?
All relays contain a sensing unit, the electric coil, which is powered by AC or DC
current. When the applied current or voltage exceeds a threshold value, the coil activates
the armature, which operates either to close the open contacts or to open the closed
contacts. When a power is supplied to the coil, it generates a magnetic force that actuates
the switch mechanism. The magnetic force is, in effect, relaying the action from one
circuit to another. The first circuit is called the control circuit; the second is called the
load circuit.
There are three basic functions of a relay: On/Off Control, Limit Control and Logic
Operation.
On/Off Control: Example: Air conditioning control, used to limit and control a “high
power”
load, such as a compressor
Limit Control: Example: Motor Speed Control, used to disconnect a motor if it runs
slower or
faster than the desired speed
Logic Operation: Example: Test Equipment, used to connect the instrument to a number
of
testing points on the device under test.

LCD Interfacing with PIC 16F877

An LCD is an output device to display text


information. LCDs come in a wide variety of
configurations including multi character, multiline
Figure 3.24(a) Keypad
format. A 4 × 16 LCD format is common. That is,
it has the capability of displaying four lines of 16
characters each. The characters are sent to the
LCD via ASCII format a single character at a
time. For a parallel-configured LCD, an 8-bit data
path and two lines are required between the
microcontroller and the LCD. A small
microcontroller mounted to the back panel of the
LCD translates the ASCII data characters and
control signals to properly display the characters.
LCDs are configured for either parallel or serial
data transmission format.

Specifications

Display Format 16 characters (W) x 4 lines (H)

General Dimensions 80.0 mm (W) x 36.0 mm (H) x 9.5 mm (T)

Backlight LED Optional

Polarizer Mode Reflective

View Angle 6 o’clock or 12 o’clock

Controller S6A0069 or Equivalent

Temperature Range 0oC to 50oC (Operating); -20oC to 70oC (Storage)


Character Size 2.95 mm (W) x 4.35 mm (H)

Character Pitch 3.65 mm (W) x 5.05 mm (H)

Viewing Area 64.0 mm (W) x 13.8 mm (H)

Dot Size 0.55 mm (W) x 0.50 mm (H)

Dot Pitch 0.60 mm (W) x 0.55 mm (H)

Display Type Positive or Negative

LC Fluid STN Yellow-Green

TABLE 3.5: LCD Specifications


Figure 3.25 PIN Configuration of LCD

Pin Number Symbol Description


1 Vss Ground for Logic

2 Vdd Power Supply for Logic

3 Vcc Power Supply for LCD

4 RS Register Selection (H: Data, L: Instruction)

5 R/W Read/Write Selection (H: Read, L: Write)

6 E Enable Signal

7 – 14 DB0 – DB7 Data Bus Lines

15 A BKL +

16 K BKL -

TABLE 3.6: LCD Pin Configuration

3.2 Software(s), used

We used the following software’s.

3.2.1 Easy PC

3.2.2 Proteus 8

3.2.3 Visual basic

3.2.4 PIC Compiler

3.2.1 Easy pc:


Easy-PC is packed with timesaving features to make the task of PCB design and layout so much
quicker and more pleasurable. The design of Easy-PC is quite simple to learn. Unlike some PCB
design products, all the electrical connection points in Easy-PC are truly connected. This might
not sound that impressive but this ensures that electrical design integrity is maintained
throughout the design process, from Schematic to PCB design editors. Your design is always in-
sync. Forward and backward annotation ensures there are no human errors introduced at any
stage. Easy-PC is scalable, from the entry-level 1000 pins to an unlimited pins variant. Each
version can be upgraded at any time for the difference in list price over the phone with our sales
office. Easy-PC is provided with a standard library set and graphical tools to create them.

3.2.1.1 Key Features

 Fully integrated Schematic Capture and PCB Layout

 True 32-bit Windows application

 True connective data model

 High-resolution (1m square design area, 1/10th degree angular rotation, 10 micron resolution)

 Unlimited elements per design*

 Technology files for rapid design setup

 Multi-level Undo and Redo

 Comprehensive 350-page printed Users Guide

 Library editing tools including library creation Wizards

 Library databook auto-generates datasheets

 Preview bar with birds-eye view and component 'bin'

 Fast-find of components, nets and errors

 Selective and cyclic picking

 Fast switch of color settings

 Unlimited custom colors


 TrueType font support

 Customizable toolbars, menus and shortcut keys

 Cut, Copy, Paste and Duplicate of all design data

 Bi-directional cross-probe selection

 Manual 'sketch' routing mode

 'Align' items feature

 Groups

 Input and output to bitmap

 Export to Metafile

 Component Values editor

 User defined grids, optionally with different X and Y step

 User configurable bill of materials output

 Single-button-press plotting

 Output to Windows, Gerber, HP-GL, PDF and Excellon

 Step-and-repeat plotting

 DXF import and export

 Design Calculators

 Design Revision Analyzer

 Shape editing panel

 Merge shapes

 Dotted and dashed line styles

 Auto-numbered sequential backup files

3.2.1.2 Key Schematic Features

 Easy-to-use
 Hierarchical Schematics
 Bus definitions
 Multi-sheet design
 Color by net
 Automatically update PCB with Schematic design changes
 Back annotation
 Reverse Engineer creates Schematic from PCB
 Design Rules Checking

3.2.1.3 Key PCB Layout Features

 Integrated component Auto-place

 Choice of optional integrated Autorouters : Trace-Router or Pro-Router

 Shape-based copper pour

 Full, split and partial power planes

 3D visualization of board

 Automatic track smoothing mode

 Automatic track miring mode

 Star/Delta points

 Apply Layout Pattern

 Back annotate name changes to Schematic

 Automatic component rename

 Supports SMT, PTH and mixed technology, and components on both sides of board

 Unlimited layers and user-defined layer types

 Fast switch of layer visibility

 Net and via optimizer

 On-line and batch design rule checking


 Dimensioning

 ODB++ manufacturing output

 Gerber output

 Excellon NC Drill output

 Full Windows printer support

 Output to PDF without the need for a separate driver

3.2.2 Proteus:

Modern software systems show a complexity and a size that can often make difficult their
maintenance and adaptation to unforeseen environmental changes. Moreover, there is an
increasing need to satisfy functional and non-functional requirements when a system lives in an
environment composed by independent and often competing entities. The current trend is to
delegate adaptation and fault tolerance to the system itself by means of redundancy and other
techniques.

To support these capabilities, we propose a new reconfiguration language called PROTEUS that
aims at building and managing rules to reconfigure software applications.

Proteus 8 is a best simulation software for various designs with microcontroller. It is mainly
popular because of availability of almost all microcontrollers in it. So it is a handy tool to test
programs and embedded designs for electronics hobbyist. You can simulate your programming
of microcontroller in Proteus 8 Simulation Software.

After simulating your circuit in Proteus 8 Software you can directly make PCB design with it so
it could be an all in one package for students and hobbyists.

3.2.3 Visual basic:

Visual Basic is a third-generationevent-driven programming language and integrated


development environment (IDE) from Microsoft for its COM programming model first released
in 1991. Microsoft intended Visual Basic to be relatively easy to learn and use. Visual Basic was
derived from BASIC and enables the rapid application development (RAD) of graphical user
interface (GUI) applications, access to databases using Data Access Objects, Remote Data
Objects, or ActiveX Data Objects, and creation of ActiveX controls and objects.

A programmer can create an application using the components provided by the Visual Basic
program itself. Over time the community of programmers have developed new third party
components, keeping this programming language to modern standards. Programs written in
Visual Basic can also use the Windows API, which requires external function declarations.
Furthermore, new third party functions (which are open source) using part VB6 source code and
part embedded machine code, make the Visual Basic 7.0 applications faster than those designed
in C++.

In 2014 there are tens of thousands of developers who still prefer Visual Basic 7.0 over Visual
Basic .NET. Moreover, in recent years some developers lobbied aggressively for a new version
of Visual Basic 7.0. A dialect of Visual Basic, Visual Basic for Applications (VBA), is used as a
macro or scripting language within several Microsoft applications, including Microsoft Office.

3.2.3.1 Language features:

Like the BASIC programming language, Visual Basic was designed to accommodate a
steep learning curve. Programmers can create both simple and complex GUI applications.
Programming in VB is a combination of visually arranging components or controls on a form,
specifying attributes and actions for those components, and writing additional lines of code for
more functionality. Since VB defines default attributes and actions for the components, a
programmer can develop a simple program without writing much code. Programs built with
earlier versions suffered performance problems, but faster computers and native code
compilation has made this less of an issue.

3.2.4 Compiler:

Code Composer Studio- Integrated Development Environment

Code Composer Studio is an integrated development environment (IDE) that supports TI's
Microcontroller and Embedded Processors portfolio. Code Composer Studio comprises a suite of
tools used to develop and debug embedded applications. It includes an optimizing C/C++
compiler, source code editor, project build environment, debugger, profiler, and many other
features. The intuitive IDE provides a single user interface taking you through each step of the
application development flow. The general purpose of the IDE is to allow the user to create and
edit a source code in C, then compile and program that code into a PIC microcontroller. Familiar
tools and interfaces allow users to get started faster than ever before. Code Composer Studio
combines the advantages of the Eclipse software framework with advanced embedded debug
capabilities from TI resulting in a compelling feature-rich development environment for
embedded developers.

3.2.4.1 Key Compiler Features:

 Easily migrate between all Microchip PICMCUs devices

 Minimize development time with: peripheral drivers and standard C constructs

 C++ style input/output streams with full data formatting to any device or for strings

 Use CCS libraries and object code royalty free

 Convenient functions like #bit and #byte allow C variables to be placed at absolute addresses

 The integral one-bit type (Short Int) permits the compiler to generate very efficient Bit-
oriented code

 Easily define, set-up and manage interrupts

Interfacing of LCD with PIC16F877A:

LCD is important component of many hardware based project. Its interfacing with
microcontroller is simple. Our LCD has 16 pin as shown in given figure. 4 data pins and RS, En
pins are connected with I/O pins of Port A of PIC16f877A. Here we show the name of the pins.
Complete schematic is shown later.
Figure 4.2 PCB design of LCD.

4.2.2 Interfacing of Relay with PIC16F877A:

A relay is an electrically operated switch. Many relays use an electromagnet to mechanically


operate a switch, but other operating principles are also used, such as solid-state relays.
Figure 4.3 PCB design of relay.

4.2.3 Regulated power supply:


A regulated power supply is an embedded circuit; it converts unregulated AC into a constant
DC. With the help of a rectifier it converts AC supply into DC. Its function is to supply a stable
voltage (or less often current), to a circuit or device that must be operated within certain power
supply limits

Figure 4.4 PCB design of regulated power supply.

4.3 Details about software

4.3.1 Schematic of regulated power supply


U1
7805

TR1 1 3
BR1 VI VO

GND
R1
1k

2
12 V ac C1 C3 +88.8
2200uf C2 104pF AC Volts
104pF
D1
BRIDGE LED-GREEN
TRAN-2P2S

U2
7812

1 3
VI VO

GND
C4 +88.8
104pF Volts

2
Figure 4.5 schematic of regulated power supply.

4.3.2 Schematic of Relay:

BAT8
12V

RL3
12V D6
R4 LED-GREEN

470R
Q4
TIP122

RL2
12V D3
R3 LED-GREEN

470R
Q3
TIP122

C1
U1
13 33
OSC1/CLKIN RB0/INT
33pF 14 34
OSC2/CLKOUT RB1
1 35
MCLR/Vpp/THV RB2
36
C2 RB3/PGM
2 37
RA0/AN0 RB4
3
RA1/AN1 RB5
38 RL1
4
RA2/AN2/VREF- RB6/PGC
39 12V D1
33pF 5 40 R2 LED-GREEN
RA3/AN3/VREF+ RB7/PGD
6
RA4/T0CKI
7 15 470R
RA5/AN4/SS RC0/T1OSO/T1CKI
R1 RC1/T1OSI/CCP2
16 Q2
8 17 TIP122
RE0/AN5/RD RC2/CCP1
10k 9 18
RE1/AN6/WR RC3/SCK/SCL
10 23
RE2/AN7/CS RC4/SDI/SDA
24
RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
19
RD0/PSP0
20
RD1/PSP1
21
RD2/PSP2
22
RD3/PSP3
RD4/PSP4
27 RL4
RD5/PSP5
28 12V D4
29 R5 LED-GREEN
RD6/PSP6
30
RD7/PSP7
470R
PIC16F877 Q1
TIP122

BAT4
12V

Figure 4.6 schematic diagrams of 4 relays.

4.3.3 Schematic of LCD and Sensors:


LCD1
LM044L

C1

33pF

S D E
C2 S D E
V V V
S W
R R E
0 1 2 3 4 5 6 7
D D D D D D D D

1 2 3 4 5 6 7 8 9 0 1 2 3 4
33pF 1 1 1 1 1

U1
13 33
OSC1/CLKIN RB0/INT
14 34
OSC2/CLKOUT RB1
35
RB2
2 36
R1 3
RA0/AN0 RB3/PGM
37
RA1/AN1 RB4
4 38
U2 10k RA2/AN2/VREF-/CVREF RB5
1 5 39
RA3/AN3/VREF+ RB6/PGC
6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
15
20.0 RC0/T1OSO/T1CKI
8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17
RE1/AN6/WR RC2/CCP1
2 10 18
VOUT RE2/AN7/CS RC3/SCK/SCL
23
RC4/SDI/SDA
1 24
MCLR/Vpp/THV RC5/SDO
25
3 LM35
RC6/TX/CK
26
R2
RC7/RX/DT
330R
RD0/PSP0
19 D1
20 LED-YELLOW
U3 RD1/PSP1
1 21
RD2/PSP2
22
RD3/PSP3
27
RD4/PSP4
28
R3
24.0 RD5/PSP5
RD6/PSP6 29 330R
RD7/PSP7
30 D2
VOUT 2 LED-YELLOW
PIC16F877A
R4
3 LM35 330R
D3
LED-YELLOW

1 U4

24.0

2
VOUT

3 LM35

Figure 4.7 Schematic of LCD and sensors

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.

Our objectives of making this project are:


 To increase productivity and
 Provide safe material handling operations,
 Reduce cost and
 Manpower
Main Controlling Bored:

PIC 16F877

PIC 16F877 is one of the most advanced microcontroller from Microchip. This controller
is widely used for experimental and modern applications because of its low price, wide range of
applications, high quality, and ease of availability. It is ideal for applications such as machine
control applications, measurement devices, study purpose, and so on. The PIC 16F877 features
all the components which modern microcontrollers normally have. The figure of a PIC16F877
chip is shown below.
Features of PIC16F877

The PIC16FXX series has more advanced and developed features when compared to its
previous series. The important features of PIC16F877 series is given below.

General Features

 High performance RISC CPU.


 ONLY 35 simple word instructions.
 All single cycle instructions except for program branches which are two cycles.
 Operating speed: clock input (200MHz), instruction cycle (200nS).
 Up to 368×8bit of RAM (data memory), 256×8 of EEPROM (data memory), 8k×14 of
flash memory.
 Pin out compatible to PIC 16C74B, PIC 16C76, PIC 16C77.
 Eight level deep hardware stack.
 Interrupt capability (up to 14 sources).
 Different types of addressing modes (direct, Indirect, relative addressing modes).
 Power on Reset (POR).
 Power-Up Timer (PWRT) and oscillator start-up timer.
 Low power- high speed CMOS flash/EEPROM.
 Fully static design.
 Wide operating voltage range (2.0 – 5.56)volts.
 High sink/source current (25mA).
 Commercial, industrial and extended temperature ranges.
 Low power consumption (<0.6mA typical @3v-4MHz, 20µA typical @3v-32MHz and
<1 A typical standby).

Pin Diagrams

PIC16F877 chip is available in different types of packages. According to the type of


applications and usage, these packages are differentiated. The pin diagrams of a PIC16F877 chip
in different packages are shown in the figure below.
Power Supply:

The power supplies are designed to convert high voltage AC mains electricity to a suitable low
voltage supply for electronics circuits and other devices. A power supply can by broken down
into a series of blocks, each of which performs a particular function. A D.C power supply which
maintains the output voltage constant irrespective of a.c mains fluctuations or load variations is
known as “Regulated D.C Power Supply”

For example a 5V regulated power supply system as shown below:

Circuit &PCB LAYOUT:


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,

Automatic Sorting, Counting and Bottle Filling System


UET Taxila, Chakwal Campus
Page 12

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.
Automatic Sorting, Counting and Bottle Filling System
UET Taxila, Chakwal Campus
Page 13

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.

Automatic Sorting, Counting and Bottle Filling System


UET Taxila, Chakwal Campus
Page 14

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.

Bottle filling:
T h e s e c o n d p a r t o f t h i s p r o j e c t i s t o d e s i g n a m i c r o c o n t r o l l e r ba s e d
automatic
b o t t l e f i l l i n g s y s t e m . W h e n t h e I R s e n s o r d e t e c t s t h e b o t t l e t h e c o n v e yo r
belt
stops at the moment. At the same time signal from the
microcontroller
a c t u a t e s t h e s o l e n o i d v a l v e , a n d t h e f i l l i n g s t a r t s . The time required to raise the
bottle few seconds,
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 28

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:
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

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.
Automatic Sorting, Counting and Bottle Filling System
UET Taxila, Chakwal Campus
Page 56

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

CONCLUSION

The automated bottle filling system using pump filling concept was successfully implemented
and studied. Various observations were taken which closely resembled the actual volume to be
filled. The reason for deviations of the readings are studied accordingly. The automated bottle
filling system was beneficial in reducing work, time and cost of filling. The fabricated model of
Automated bottle filling system can be used where high precision is not necessary and time
limits not bound. Hence it must be used application specific and must not be used in places
where faster and more accurate methods of filling are available.

References
http://www.ziva-vatra.com/index.php?aid=26&id=RWxlY3Ryb25pY3M=
http://www.engineersgarage.com/electronic-components/at89c51-microcontroller-
datasheet
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
[1] Asutkar, Sachin More(2013), “Automated bottle filling using microcontroller volume
correction”, International journal of engineering research and technology (IJERT). (vol 2, Issue
3, march-2013). [2] Rajesh G. Khatod, Chandrashekhar Sakhale(2012), “Design & Fabrication
of liquid dispensing machine using automatic control for engg. Industry”, International journal
of innovative technology and exploring engineering (IJITEE). (Vol I, Issue 5, October 2012).
[3] A.S.C.S. Sastry, K.N.H. Srinivas(2010), “An automated microcontroller based liquid mixing
system”, International journal on computer science and engineering. (Volume II, Issue 8,
August 2010). [4] T. kalaiselvi, R. Praveena(2012), “plc based automatic bottle filling and
capping system with user defined volume selection”, International journal of emerging
technology and advanced engineering. (Vol 2, Issue 8, August2012). [5] http://winkitindia.com

You might also like