0% found this document useful (0 votes)
132 views38 pages

Automatic Object Identification and

Here are the key specifications of the device manufactured: - Uses an Atmega32 microcontroller for control - Sensors include LDRs and IR sensors to measure object length on the conveyor belt - An electromagnetic crane with a rotating mechanism (DC servo motor or stepper motor) to pick up and place objects in baskets - Conveyor belt controlled by a PWM-controlled DC motor - Programmable microcontroller allows differentiation of metallic objects by length - Provides automated sorting of objects into 3 length-based categories using electromagnetic placement - Manual control is also incorporated for starting and stopping the system The circuit uses common components like the Atmega32, crystal oscillator, relays, transistors,

Uploaded by

api-19751116
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views38 pages

Automatic Object Identification and

Here are the key specifications of the device manufactured: - Uses an Atmega32 microcontroller for control - Sensors include LDRs and IR sensors to measure object length on the conveyor belt - An electromagnetic crane with a rotating mechanism (DC servo motor or stepper motor) to pick up and place objects in baskets - Conveyor belt controlled by a PWM-controlled DC motor - Programmable microcontroller allows differentiation of metallic objects by length - Provides automated sorting of objects into 3 length-based categories using electromagnetic placement - Manual control is also incorporated for starting and stopping the system The circuit uses common components like the Atmega32, crystal oscillator, relays, transistors,

Uploaded by

api-19751116
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

BANGLADESH UNIVERSITY OF ENGINEERING AND TECHNOLOGY

DEPARTMENT OF ELECTRICAL ENGINEERING AND ELECTRONICS

Course Number: EEE – 402


Course Title: Control System Sessional

Project Report
Name of the Project: Automatic Object Identification and
Handling Controller

Raisul Islam 0406001


Khalid Imtiaz Saad 0406010
Sajid Muhaimin Choudhury 0406023
Md. Aurongozeb 0406024
Kazi Yezdan 0406025
A.B.M. Shamsuzzaman 0406030

i
Group Members

1 Raisul Islam

0406001
Department of EEE
BUET

2 Khalid Imtiaz Saad

0406010
Department of EEE
BUET
3 Sajid Muhaimin Choudhury

0406023
Department of EEE
BUET

4 Aurangozeb

0406024
Department of EEE
BUET

5 Kazi Yezdan

0406025
Department of EEE
BUET

6 A.B.M Samsuzzaman Rupu

0406030
Department of EEE
BUET

ii
iii
Acknowledgement

We would like the express our gratitude to our respected teachers Mr.
Shamim Reza and Mr. Shishir Bhoumic for encouraging us to
undertake this project. We would like to thank Prof. Dr. Pran Kanai
Saha and Prof. Dr. Aminul Haq for helping us get necessary access to
the BUET Machine Shop. With the permition of the Head of the
Department Prof. Dr. Aminul Haq we were allowed to use the Machine
Shop and the Carpentry Shop for making the whole mechanical
structure.

Aluminium bar, Pulley, Nylon bar and all the structures except the
Gamari Wood works for the table were prepared in the Machine Shop.
The woodworks, i.e. the backbone of the structure, was built in the
Carpentry Shop.

iv
Table of Contents

Group Members ................................................................................................................................. ii

Acknowledgement ............................................................................................................................ iv

Project Statement .............................................................................................................................. 1

Specification of the device manufactured ................................................................................. 4

Circuit Components Used .............................................................................................................. 4

Sensors ................................................................................................................................................. 5

Electro-Magnet ................................................................................................................................... 5

1. The coil ................................................................................................................................. 5

2. The core ................................................................................................................................ 5

3. The power source .............................................................................................................. 6

Conveyor Belt ..................................................................................................................................... 7

Electromagnetic Magnetic Moving Pulley .................................................................................. 7

Logic Circuit ........................................................................................................................................ 8

Schematic Diagram of Designed Control Circuit .................................................................. 13

3D Rendered Preview of the planned Printed Circuit Board (PCB) ................................. 14

Algorithm ................................................................................................................................... 15

Measuring the thresholds of the sizes of objects .......................................................... 17

In X axis: Number of observations ............................................................................................ 18

Resistances of the LDR at different conditions ............................................................. 18

Application ................................................................................................................................ 19

Car Making Industries................................................................................................................... 19

Magnetic Crane ................................................................................................................................ 19

Separation of magnetic materials .............................................................................................. 19

Separation of Iron Ores ................................................................................................................. 19


v
Difficulties ......................................................................................................................................... 20

Limitations ........................................................................................................................................ 20

Scope of Future Work .................................................................................................................... 21

Cost Analysis ............................................................................................................................ 22

Appendix ............................................................................................................................................ 23

Code of the Micro Controller ....................................................................................................... 23

vi
This page is kept blank intentionally

vii
Project Statement

The proposed project aims at identification of object by its height that will be
passing through a conveyor belt and handling the objects by placing them in
different baskets assigned for them.

DC Servo Motor IR Position


Guide Rod Control

Electromagnet

Laser Beam
LDR Basket A Basket B Basket C
Conveyor Belt

Laser Beam LDR

PWM Speed
Controlled DC
Motor

Figure: Basic Proposal of the Design

1
The project will be divided into 2 basic parts. One is the conveyor belt
controller and object identification and the other is the crane controller.
Conveyor belt will be controlled by a PWM speed controlled DC Motor and
two LASER-LDR or IR Sensor based length measurement arrangements will
be there to measure the length of the objects passed through the conveyor
belt at any time.

According to the length of the objects an electromagnetic crane will be


actuated which will pick up the object and eventually place it in the
appropriate basket assigned for it. The crane will be a rotating type whose
position can be conveniently controlled by a DC servo motor or a stepper
motor.

However the total system will be controlled efficiently by the microcontroller


based system which will be programmable and tailored for the specific
purpose intended. This system will eventually differentiate between metallic
objects passing through a conveyor belt.

Microcontroller of AVR family will be preferred because it has built in PWM


control and built in timers and ADC’s will be available. The length
measurement would be done using IR sensors and by measuring whether a
specific sensor placed in the certain length is hindered by the object. We will
allow three length range and all the objects will be picked up by the
electromagnet of the crane. Eventually the rotational system will be directed
according to the length measured and decision of the microcontroller up to
what extent it will rotate and finally it will drop the object to the
corresponding basket. The whole system will be run again and object
identification will be done continuously. Manual controlling will also be
incorporated so as to preferably start and stop the system whenever
necessary.

2
This sort of control system is widely used in industry especially in the
industries where batch processing of multiple different objects are done
simultaneously. However, our project if implemented successfully will be
very much similar to the systems used in the industry. The difference will be
of course the size of the system and scale of operation.

3
Specification of the device manufactured

Circuit Components Used

Atmega32 Micro Controller IC


4MHz Crystal
Serial port cable
Relays
Bipolar Junction Transistors
Voltage Regulator ICs
Diodes
Resistances
Capacitors
Switches

4
Design

Sensors
The length sensors need to be extremely accurate. The sensors are designed
using Laser beams and Light Dependent Resistors (LDR). As less accuracy is
required, the position of the magnet is determined using LED/LDR sensors.

Electro-Magnet
The magnet is designed using a stain-less steel core and a solenoidal
winding with 1000 turns is used to make the magnet. The core was actually
an engine valve scavenged from an old car engine. There are three key items
that affect the design of an electromagnet, and each of them have several
sub-items that need to be considered. They are the coil, the core, and the
power source. Let's look at each one.

1. The coil
 The diameter or gauge of the wire used for the coil.
 The length of the wire used for the coil.
 The number of turns of wire around the core.
The above parameters affect the dimensions of the coil: its inside diameter,
outside diameter, and length. These dimensions, along with the size of wire
used, determine the length of wire needed and the resistance of the wire.

2. The core
 The size of the core.
 The material used for the core.
Is the core going to be air, or will it be steel? Will the steel be laminated or
solid? What shape will it have?

5
3. The power source
 The voltage powering the coil.
 The frequency of the voltage powering the coil.
Is the power source DC or AC? If it is AC, what is the frequency? What is
the duty cycle (how long is it on versus how long is it off)?

Why do all of these things affect the strength of the electromagnet? Because
the one item that has the biggest effect is called the Ampere-turns. This is
simply the number of amps of current flowing in the wire of the coil
multiplied by the number of turns of wire there are around the core. So,
length of the wire, its diameter, the size of the winding, and the source all
affect either the amps that will flow or the number of turns that exist or
both.

In this project, 30AWG enamel coated copper wire is used for its winding.
24Volt supply is used to power it up. Around 30 ohm resistance was
measured in the coil. So upon powering up, it will take approximately 24/30
A = 0.8A = 800mA current. In order to control the object grabbing and
releasing we used power supply as the controlling parameter. Since magnet
coil is highly R-L in nature, a high current spike is observed during
switching which is around 3.2 A. However, a relay is used to implement the
control, so it provides the required isolation from the rest of the circuit. One
more problem is to be kept in mind when designing magnetic control where
frequent magnetizing and demagnetizing cycle is to be employed. Due to
hysteresis, the core gains some permanent magnetism which makes it
attract low mass objects without any power supply. This problem can be
overcome by two approaches. One is to use a low retentivity magnetic
material such as cast iron. The other approach is to allow the magnet to
gain some magnetism in reverse direction for a small amount of time after
demagnetization in order to nullify the remnant flux. This can be done by
designing a bidirectional drive using two relays instead of one. In this
project, however, this effect is very low, so no bidirectional drive is used.

6
Conveyor Belt
Conveyor belt used here is an industry standard conveyor belt with 3 layers
fiber coating with rubber core. The belt was reshaped to 3 inch width. Belt
runners are made using Nylon Cylinders created with reshaped nylon bars
and as axis, stainless steel bars are used. To drive the conveyor belt, a gear
motor with extended shaft is used. Extended shaft is pulled into at the
center of one of the Nylon Cylinder.

Electromagnetic Magnetic Moving Pulley


The moving pulley is designed with two goals:
1. Enable the electromagnet to move vertically using a pulley.
2. Enable horizontal motion of the pulley to move objects from one place to
another.

For moving the pulley vertically, a gear motor with extended shaft was used
and a small string was tied to it. The other end of the string was tied to the
electro magnet. So when the motor is rotated, the string is coiled and the
electromagnet is moved towards up or down accordingly.

For moving the crane horizontally, another gear motor is used, which is
placed on a wooden pillar. An aluminium made wheel is coupled with the
shaft of the motor. A nylon wire is coupled with the wheel through three
pulleys, which are placed on the walls of the structure. The two ends of the
nylon wire are connected with the two ends of the crane. The four
aluminium wheels of the crane are placed on the two mild steel rods. When
the motor is rotated, the crane moves horizontally.

7
Logic Circuit
The first design was done using logic circuitry. The design was done in
Proteus 7.2 sp 6 simulation programs and was simulated accordingly.

The basic idea was to detect object based on the amount of time they block
the laser sensor1 and then pick up the object when they reach sensor 2.

The circuit was designed to count the pulses generated from a


predetermined counter as long as the sensor was high. The clock frequency
was adjusted so that the count is between 0 and 15. (4 bit)
Laser1falling

U3:B
Capacitor to introduce proper delay
3 4

?
?
?
?
74LS04
C2
t0
t1
t2
t3
47n
Laser1

C3

C2

C1

C0
U1 U2
3 14 14 15
D0 Q0 D0 Q0 C0
4 13 1
D1 Q1 Q0
5 12 4 3
D2 Q2 D1 Q1 C1
6 11 2
D3 Q3 Q1
15 5 6
RCO D2 Q2 C2
7 7
ENP Q2
10 11 10
ENT D3 Q3 C3
2 9
CLK Q3
9
LOAD
1 12
MR CLK
13
MR
74LS161
74LS171

U31:A(A) U31:A U3:A


1
BeltRun

1
3 1 2
U3:D 2
74LS04
13 12 74LS08

74LS04

Figure: Determination of Object length by time

Then the object length is compared with predetermined length given input
by a switch array.

8
U10
10
C0 A0
12
C1 A1
13
C2 A2
15
C3 A3
9
B0
11
B1
14
B2
1
B3
2 7
A<B QA<B
3 6
A=B QA=B
4 5
A>B QA>B
0
1
1
1
74LS85
Lower Threshold

U12:A
U11 2
10 1
C0 A0 QueIn1
12 3
C1 A1
13
C2 A2
15 74LS02
C3 A3
9
B0
11
B1
14
B2
1
B3
2 7
A<B QA<B
3 6
A=B QA=B
4 5
A>B QA>B
0
1
0
0

74LS85
Upper Threshold

Figure: A single basket comparator

If the object-length count falls between the upper and lower limit of the
lengths of a corresponding basket, the object is assumed to be belong in be
belong in that particular basket. To allow pipelinining of objects on the belt
and maximum concurrency, a Queue data structure was designed using
standard 7496 serial shifters. When an object passes laser 1, the basket-
number into which it needed to be dropped is enqueued. There are 4
baskets, so number of bits required is 2 for each basket.

9
QueIn0
16

16
8
1

7
6
4
3
2
9

8
1

7
6
4
3
2
9
U9 U8X
PE
CLK

PE
CLK
MR

MR
SI

SI
D4
D3
D2
D1
D0

D4
D3
D2
D1
D0
74LS96 74LS96
Q4
Q3
Q2
Q1
Q0

Q4
Q3
Q2
Q1
Q0
10
11
13
14
15

10
11
13
14
15
Top0
Top1
Top2
10
11

12
13
14
15
7
9

1
2
3
4

U17
B
A
C

D7
D6
D5
D4
D3
D2
D1
D0
OE

74LS251
Y

Y
5

QueOut0

Figure: Queue Structure for single bit

However, to avoid encoding and decoding, four bits of each basket are
chosen, and the corresponding bit of a basket will be one in any particular
element of the cue to represent the correct basket. To point the top of the
queue, an updown counter was used in the design.

10
? ? ? ?

U18
15 3 0
D0 Q0 Top0 t
u t
u t
u t
u
1 2 O O O
D1 Q1 Top1 e e e e
10 6 u u u u
D2 Q2 Top2 Q Q Q Q
9 7
D3 Q3
5 12
ShiftClk UP TCU
4 13
TargetBasketReached DN TCD
11
PL
14
MR
C4 C5 74193
47n 47n

9 U36:B
Top0
10
Top1
13
QueNotEmpty
11
Top2
12
4072

Now as the object reaches laser


Figure: 2, not
Queue theempty
beltlogic
willand
stop momentarily.
Queue pointer A bi

directional drive in the motor of the pulleys would be energiezed in such a


way that the magnet advances towards the conveyor belt. Now the magnet
will be moved with the help of the pully car towards the baskets. An LDR
sensor on each of the baskets are kept and a LED on the pulley car is
appropriately aligned with the LDRs.

11
U6
10
C0 A0
12
C1 A1
13
C2 A2
15 k
C3 A3 l
C
9
B0 fti
11 h
B1 S
14
B2
1 0
B3 n
2 7 Ie
A<B QA<B u
3 6 Q
A=B QA=B
4 5
A>B QA>B

0 0 1 1 74LS85

Lower Threshold

U8:A
6 6
U7 2 1 8 1 7 6 4 3 2 9 1 8 1 7 6 4 3 2 9
10 1
C0 A0 QueIn0 R E K 4 3 2 1 0 IS R E K 4 3 2 1 0 IS
C1
12
A1
3 M P L D D D D D U9 M P L D D D D D U8X
13 C C
C2 A2 74LS96 74LS96
15 74LS02
C3 A3
9
B0 4 3 2 1 0 4 3 2 1 0
11 Q Q Q Q Q Q Q Q Q Q
B1
14
B2
1 0 1 3 4 5 0 1 3 4 5
B3 1 1 1 1 1 1 1 1 1 1
2 7
A<B QA<B
3 6
A=B QA=B
4 5
A>B QA>B

0 0 0 0 74LS85

Top0
Upper Threshold Top1
Top2

0 1 2 3 4 5
7 9 1 1 1 1 1 1 1 2 3 4

E C B A 7 6 5 4 3 2 1 0
O D D D D D D D D U17
74LS251

Y Y
U10
10 5 6
C0 A0
12
C1 A1
13
C2 A2 QueOut0
15
C3 A3
9 k
B0 l
C
11
B1 fti
14 h
B2 S
1
B3
2 7 1
A<B QA<B n
3 6 I
e
A=B QA=B u
4 5 Q
A>B QA>B

0 1 1 1 74LS85

Lower Threshold

U12:A
U11 2
6 6
10 1 1 8 1 7 6 4 3 2 9 1 8 1 7 6 4 3 2 9
C0 A0 QueIn1
12 3
C1 A1 R E K 4 3 2 1 0 S R E K 4 3 2 1 0 S
I
C2
13
A2 M P L D D D D D U20 M P L D D D D D I U19
15 74LS02 C C
C3 A3 74LS96 74LS96
9
B0
11
B1 4 3 2 1 0 4 3 2 1 0
14 Q Q Q Q Q Q Q Q Q Q
B2
1
B3
2 7 0 1 3 4 5 0 1 3 4 5
A<B QA<B 1 1 1 1 1 1 1 1 1 1
3 6
A=B QA=B
4 5
A>B QA>B

0 1 0 0 74LS85

Upper Threshold
Top0
Top1
Top2

0 1 2 3 4 5
7 9 1 1 1 1 1 1 1 2 3 4

Comparators E C B A
O
7 6 5 4 3 2 1 0
D D D D D D D D U21
74LS251

Y Y

5 6

U13 QueOut1

10
C0 A0
12
C1 A1
13 k
C2 A2 l
C
15
C3 A3 fti
9 h
B0 S
11
B1
14 2
B2 n
1 Ie
B3 u
2 7 Q
A<B QA<B
3 6
A=B QA=B
4 5
A>B QA>B

1 0 1 1 74LS85

Lower Threshold
6 6
U12:B 1 8 1 7 6 4 3 2 9 1 8 1 7 6 4 3 2 9
U14 5
R E K 4 3 2 1 0 I R E K 4 3 2 1 0 I
C0
10
A0
4
QueIn2 M P L D D D D D S U23 M P L D D D D D S U22
12 6 C C
C1 A1 74LS96 74LS96
13
C2 A2
15 74LS02
C3 A3 4 3 2 1 0 4 3 2 1 0
9 Q Q Q Q Q Q Q Q Q Q
B0
11
B1
14 0 1 3 4 5 0 1 3 4 5
B2 1 1 1 1 1 1 1 1 1 1
1
B3
2 7
A<B QA<B
3 6
A=B QA=B
4 5
A>B QA>B

1 0 0 0 74LS85
Top0
Top1
Upper Threshold Top2

0 1 2 3 4 5
7 9 1 1 1 1 1 1 1 2 3 4

E C B A 7 6 5 4 3 2 1 0
O D D D D D D D D U24
74LS251
U15
10 Y Y
C0 A0
12
C1 A1
13 5 6
C2 A2
15
C3 A3
9
B0 QueOut2
11
B1
14
B2
1
B3
2 7
A<B QA<B
3 6 k
A=B QA=B l
C
4 5
A>B QA>B fti
h
S
1 1 1 1 74LS85
3
Lower Threshold n
Ie
u
Q

U12:C
U16 8
10 10
C0 A0 QueIn3
12 9
C1 A1
13
C2 A2
15 74LS02
C3 A3
9
B0 6 6
11 1 8 1 7 6 4 3 2 9 1 8 1 7 6 4 3 2 9
B1
14
B2 R E K 4 3 2 1 0 I R E K 4 3 2 1 0 I
1
B3 M P L D D D D D S U26 M P L D D D D D S U25
2 7 C C
A<B QA<B 74LS96 74LS96
3 6
A=B QA=B
4 5
A>B QA>B 4 3 2 1 0 4 3 2 1 0
Q Q Q Q Q Q Q Q Q Q
1 1 0 0 74LS85
0 1 3 4 5 0 1 3 4 5
1 1 1 1 1 1 1 1 1 1
Upper Threshold

? ? ? ? Top0
Top1
Top2

0 1 2 3 4 5
7 9 1 1 1 1 1 1 1 2 3 4

U18 E C B A 7 6 5 4 3 2 1 0
D D D D D D D D U27
O
15 3 3 2 1 0
D0 Q0 Top0 tu tu t
u tu 74LS251
1 2 O O O O
D1 Q1 Top1 e e e e
10 6 u u u u
D2 Q2 Top2 Q Q Q Q
9 7 Y Y
D3 Q3

5 12 5 6
ShiftClk UP TCU
4 13
TargetBasketReached DN TCD
11
PL QueOut3
14
MR

C4
47n
C5
47n
74193
Queue

Queue Pointer

9 U36:B
Top0
10
Top1
13
QueNotEmpty
11
Top2
12
4072

Figure: Complete setup for 4 comparators, and the 2 bit queue 12


Schematic Diagram of Designed Control Circuit

Target Basket has been Reached


U5:A
1
QueOut0
3
2

TargetBasketReached
Sensor0
74LS08

U5:B
4
QueOut1
6
5
Sensor1
74LS08 2 U30:A
3
1
U5:C 4
9 5
QueOut2
8 4002
10
Sensor2
74LS08

U5:D
12
QueOut3
11
13
Sensor3

MagnetOn
74LS08
U4:B

8
Condition for Magnet Unlatch (Release)
MagnetLatchCondition
12 10

R
K Q
6
CLK
9 11
J Q

S
7
74LS76

U28:A
SensorBelt
1

2
3 Magnet Latch
ObjectToBePicked
7400

Condition for Magnet Latch

2 U36:A
eIn0
3
eIn1 U31:B
1
4 5
eIn3
5 6
eIn2 ShiftClk
4072 4
Laser1falling
74LS08

Figure : Control Circuit design without Micro Controller

13
U33:A
1
voReverse
3
2
ensorBelt
7432

U29:A
If not running to basket, then latch

2
4 15

S
J Q ServoForward
1
CLK
If reached belt then unlatch
16 14
K Q

R
U3:F

3
74LS76
9 8
SensorBelt

74LS04
Servo Forward (Towards Belt)

MagnetLatchCondition
Latch if Magnet is latch (drop it in proper place)
BasketReached
U29:B
Unlatch if Target has reached basket
7

9 11
S

J Q ServoReverse
6
CLK
12 10
K Q
R
8

74LS76
TargetBasketReached

C3 Servo Reverse (Towards Belt)


47n
ObjectToBePicked

As long as no object between laser 2


Belt Run
BeltRun

U31:C U3:E
9
NotEmpty
8 11 10
10
Laser2
74LS04
74LS08

3D Rendered Preview of the planned Printed Circuit Board (PCB)

Figure : 3D Schematic of the PCB design (Circuit without Micro Controller)

14
Algorithm

1. Check choice
2. If choice is equal to 1
a. Go to manual mode
If choice is equal to 0
b. Go to automatic mode
a. Manual Mode
1. Wait for a character to receive through serial port
2. Check the character and flags
Case ‘a’ and belt flag ‘0’ : Run the belt motor and make flag ‘1’
Case ‘a’ and belt flag ‘1’ : Stop the belt motor and make flag ‘0’
Case ‘s’ and magnet flag ‘0’ : Magnetize signal ON and make flag ‘1’
Case ‘s’ and magnet flag ‘1’ : Magnetize signal OFF and make flag ‘0’
Case ‘j’ : Pully motor rotating signal ‘left’
Case ‘l’ : Pully motor rotating signal ‘right’
Case ‘k’ : Pully motor ‘stop’
Case ‘u’ : Magnet carrier motor ‘up’
Case ‘o’ : Magnet carrier motor ‘down’
Case ‘I’ : Magnet carrier motor ‘stop’
3. Go to step (1) in manual mode again
b. Automatic Mode
1. Start timer 1 and set it to ‘Input Capture Mode’
2. Wait for the signal from ‘Laser1’
a. For the falling edge reset ‘Input Capture Register’ and set the
interrupt edge to falling.
b. For the rising edge capture ‘Input Capture Register’ and
calculate time delay and compare with predefined calibrated
value.
c. Push the value in a queue.

15
3. Wait for the signal from ‘Laser2’
a. Response ‘Laser2’ interrupt request
b. Turn off the belt motor
c. Deque the recent destination value from the que.
d. Turn on the pulley car to the left until belt position is reached.
e. Turn on the magnet carrier motor to down for approximately 3
seconds.
f. Turn on the magnet
g. Turn on the magnet carrier motor to up for approximately 3
seconds
h. Turn on the pulley car to the right until destination value from
queue is matched.
i. Turn on the magnet carrier motor to down for approximately 3
seconds.
j. Turn off the magnet
k. Turn on the magnet carrier motor to up for approximately 3
seconds
l. Turn on the belt
m. Go to step (1) automatic mode again

16
Measuring the thresholds of the sizes of objects

Smallest Small M edium Large


213 403 624 1028
197 367 454 992
248 418 499 1071
234 363 459 1002
158 305 495 1054
175 301 465 894
146 439 475 871
141 335 510 890
162 428 845 1149
184 350 420 897
114 309 538 1589
182 355 517 880
153 298 428 1132
168 323 649 846
189 333 439 1435
183 424 476 935
201 343 476 957
294 341 500 843
219 343 428 1061
264 359 688 1265
244 309 446 1112

Mean 193.761905 354.571429 515.761905 1043


Standard Deviatoin 44.6653163 44.1322687 104.592497 193.8641
Lower Threshold 59.765956 222.174622 201.984413 461.4076
Higher Threshold 327.757854 486.968235 829.539396 1624.592

Final Low Threshold 59.765956 274.966238 344.476324 645.4735


Final Higher Threshold 274.966238 344.476324 645.473507 2000

17
In X axis: Number of observations
In Y axis: Counter value during passing the first LASER of the Conveyor Belt

Resistances of the LDR at different conditions


Condition Resistance
At Daylight 70 ~ 210 Ω
At Daylight (Under shade) 50 ~ 70 KΩ
At Night (Dark) 6.4 ~ 6.5 MΩ
At Night (Tube Light) 230 ~ 250 Ω
In LASER (that was used in the project) 1.2 ~ 1.4 KΩ
In LED (that was used in the project) 300 ~ 500 Ω

18
Application

Car Making Industries


In car making industries, various types of nuts and bolts of different
sizes are needed. As our ‘OBJECT SIZE DETECTION AND
SEPARATION PLANT USING MAGNETIC CRANE’ separates the nuts
and bolts according to their sizes, this plant can be used very
efficiently in the above mentioned industries.

Magnetic Crane
Magnetic cranes are used in different industries as well as in ports.
Sophisticated and vulnerable metallic things those cannot be lifted by
typical cranes by grabbing, can easily be lifted and carried by
magnetic cranes. However, larger electromagnets of high current
rating must be used to carry larger loads.

Separation of magnetic materials


As the magnetic cranes can only be used to lift magnetic materials, it
can separate between magnetic and non-magnetic materials. For this,
our plant can be used in those applications, where only magnetic
materials are used.

Separation of Iron Ores


Iron ores are magnetic materials. In iron extraction companies, it is
quite important to separate magnetic iron ores from the other ones.
For this detection and separation, this plant can be used.

19
Difficulties

During working with the project, we have faced many mechanical and
electrical difficulties. Two microcontrollers were burnt and the serial port
was not working properly. The alignment of the conveyor belt was not
perfect. If it rotates continuously for several minutes, it becomes loose.
Some problems also arised in aligning the sensors. Sometimes, the LDRs do
not work well. In fact, in our first design, the objects of different sizes were
to be placed in four different boxes. But as the LDRs were not working well,
the crane places all the objects in the fourth basket. This difficulty can be
overcome by using a good LDR.

Limitations
At first it was designed that the length would be measured with a cogwheel
coupled directly to the shaft of the conveyor belt, and thus measuring the
linear distance with the help of circular rotation. But unfortunately, in
machine-shop, it was not possible to properly couple the cogwheel without
tilting. So thus it was impossible to put use it without interrupter. The
conveyor belt used was industry standard, and was extremely hard. At first,
the conveyor belt was running properly. But after substantial number of
operations, the conveyor belt began to slip. Unfortunately no adjustment
technique was kept to keep conveyor belt in tightly coupled. Due to slip of
conveyor belt, the length measurement wasn’t accurate with conveyor belt.
With a better designed conveyor belt, the length measurement could have
been done without slipping. And due to oversensitivity of the LDRs, the
operation can be hampered at extremely bright conditions.

20
Scope of Future Work

In our project, we have used nuts of small mass and size as objects, as the
electromagnet was operated at 12 V. If the operating voltage of the magnet is
increased, it the same design and algorithm can be used to work with
objects of higher mass and size. However, for heavier and larger objects, the
total size and strength of the plant is also to be increased.

Sometimes, the Conveyor Belt does not work properly, as it slips after
working continuously for several minutes. This problem may be overcome by
using a more sophisticated material as the belt as well as by making the belt
more accurately.

21
Cost Analysis

Material Quantity Unit price Total price


(Pcs) (BDT) (BDT)
DC Gear Motor 3 400 1200
Magnet Core 1 20 20
Magnet winding 1 140 140
Bearing 6 40 (Apprx.) 250
Pulley 4 25 100
Nuts and Bolts (As Object) Several Different 50
Stainless Steel Shaft Rod 2 35 70
Aluminium Bar 1 140 140
Aluminium Rail 1 70 70
Mild Steel Rod 1 75 75
Nylon Bar 1 220 220
Screw Several Different 150
Hooks 2 10 20
Conveyor Belt 1 290 290
Nylon String 1 20 20
Super Glue 3 18 54
LDR 20 6.25 125
Laser Source 3 70 210
ATmega32 Micro Controller IC 1 140 140
MAX 232 IC 5 50 250
4MHz Crystal 1 10 10
Resistors and Capacitors Several Different 40
Serial port header 1 35 35
LED 14 2.5 35
7805 Voltage Regulator 1 5 5
2N2222A Transistor 15 2 30

Grand Total = 3749 BDT

22
Appendix

Code of the Micro Controller

#include <avr/io.h>
#include <avr/interrupt.h>
//#inlcude <eeprom.h>
#include <string.h>
#include <stdlib.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include "lcd.h"
#include <avr/pgmspace.h>

typedef struct
{
unsigned char bit0:1;
unsigned char bit1:1;
unsigned char bit2:1;
unsigned char bit3:1;
unsigned char bit4:1;
unsigned char bit5:1;
unsigned char bit6:1;
unsigned char bit7:1;
}io_reg;

#define ON 1
#define OFF 0
#define F_CPU 4000000// Clock Speed
#define UART_BAUD_RATE 9600
#define UBRR F_CPU/16/BAUD-1
#define UART_UBBR 25

#define belt_motor ((volatile io_reg*)_SFR_MEM_ADDR(PORTA))->bit0


#define pully_motor_left ((volatile io_reg*)_SFR_MEM_ADDR(PORTA))->bit1
#define pully_motor_right ((volatile io_reg*)_SFR_MEM_ADDR(PORTA))->bit2
#define mgnt_motor_up ((volatile io_reg*)_SFR_MEM_ADDR(PORTA))->bit3
23
#define mgnt_motor_down ((volatile io_reg*)_SFR_MEM_ADDR(PORTA))->bit4
#define magnet ((volatile io_reg*)_SFR_MEM_ADDR(PORTA))->bit5

#define Laser1 ((volatile io_reg*)_SFR_MEM_ADDR(PORTC))->bit0


#define Laser2 ((volatile io_reg*)_SFR_MEM_ADDR(PORTC))->bit1
#define LDR0 ((volatile io_reg*)_SFR_MEM_ADDR(PORTC))->bit2
#define LDR1 ((volatile io_reg*)_SFR_MEM_ADDR(PORTC))->bit3
#define LDR2 ((volatile io_reg*)_SFR_MEM_ADDR(PORTC))->bit4
#define LDR3 ((volatile io_reg*)_SFR_MEM_ADDR(PORTC))->bit5
#define LDR4 ((volatile io_reg*)_SFR_MEM_ADDR(PORTC))->bit6
#define choice ((volatile io_reg*)_SFR_MEM_ADDR(PINB))->bit0

//#define int_cont ((volatile io_reg*)_SFR_MEM_ADDR(PORTD))->bit7


//volatile unsigned char uart_rcv;
void INT0_init(void);
void timer0_init(void);
void uart_init(void);
void uart_putc(unsigned char c);
void uart_puts (char *s);
unsigned char uart_getc( void );
void init(void);
void mydelay(unsigned long);
char command;
//static volatile unsigned char int0flag;
static volatile unsigned long lenque[16];
static volatile unsigned char quetop;
static volatile unsigned char queserve;
static volatile unsigned char overflow_count;
static volatile unsigned char s[20];

ISR(INT0_vect)
{

//int_cont=1;
TCCR1B=TCCR1B|(1<<CS12);
uart_puts("counting starts \n");
//LCDClear();
//LCDWriteString("Inside INT0 odd");
//int0flag=1;

24
}
ISR(INT1_vect)
{
//int_cont=0;
TCCR1B=TCCR1B&~(1<<CS12);
//PORTA=TCNT1L;
//PORTB=TCNT1H;
lenque[quetop]=TCNT1;
lenque[quetop]=lenque[quetop]+0xFFFF*overflow_count;
dtostrf(lenque[quetop],10,0,s);
strcat(s,"=Count\n ");
uart_puts(s);
LCDClear();
LCDWriteString(s);
dtostrf(overflow_count,3,0,s);
strcat(s,"=overflow\n ");
uart_puts(s);
LCDGotoXY(0,1);
LCDWriteString(s);
quetop=((quetop++)%16);
//int0flag=0;

TCNT1=0;
overflow_count=0;

}
ISR(TIMER1_OVF_vect)
{

overflow_count++;

}
void mydelay(unsigned long cnt)
{

while(cnt--);

25
}
void INT0_init(void)
{
GICR=GICR|(1<<INT0); //interrupt 0 enable
MCUCR=MCUCR|(1<<ISC01)|(1<<ISC00); // interrupt 0 rise edge trigger
//
}
void INT1_init(void)
{
GICR=GICR|(1<<INT1);
MCUCR=MCUCR|(1<<ISC11); //int 1 falling edge

}
void timer1_init(void)
{
TIMSK=(1<<TOIE1);
}

void uart_init(void)
{
// set baud rate
UBRRH = (unsigned char) (UART_UBBR>>8);
UBRRL = (unsigned char) (UART_UBBR&0xFF);

//UBRRL=0x06;
// Enable receiver and transmitter; enable RX interrupt
UCSRB = (1 << RXEN) | (1 << TXEN);

void uart_putc(unsigned char c) {


// wait until UDR ready
while(!(UCSRA & (1 << UDRE)));
UDR = c; // send character
}

void uart_puts (char *s) {


cli(); //disabling all interrupts during serial
transmission

26
// loop until *s != NULL
while (*s) {
uart_putc(*s);
s++;
}
uart_putc('\0'); //sending null terminator
sei(); // Enabling all interrupts again
}
unsigned char uart_getc( void )
{
/* Wait for data to be received */
while ( !(UCSRA & (1<<RXC)) )
;
/* Get and return received data from buffer */
return UDR;
}

void init(void)
{

DDRA=0xFF;
//DDRC=0x00;
DDRB=0x00;
//DDRD=0xC0;

PORTA=0x00;
PORTB=0xFF;
//PORTC=0xFF;
//int0flag=0;
//int_cont=0;
quetop=0;
queserve=0;
overflow_count=0;
sei();

int main(void)

27
{
char beltflag=0;
char magnetflag=0;
init();
/*if (choice == 0)
{ //auto mode
belt_motor=1;
}

*/
uart_init();
InitLCD(LS_ULINE);
LCDClear();
LCDHome();
long int ctr=0;

INT0_init();
INT1_init();
timer1_init();

while(1)
{

if(choice==1)
{

command=uart_getc();
if(command=='a'&& beltflag==0)
{
belt_motor=1;
beltflag=1;
uart_puts("Conveyor belt running ");
LCDClear();
LCDWriteString("Conveyor belt running ");
LCDHome();

}
else if(command=='a' && beltflag==1)
{
belt_motor=0;

28
beltflag=0;
uart_puts("Conveyor belt stopped ");
LCDClear();
LCDWriteString("Conveyor belt stopped ");
LCDHome();
}

else if(command=='j')
{
pully_motor_left=1;
pully_motor_right=0;
uart_puts("Pully going left ");
LCDClear();
LCDWriteString("Pully going left ");
LCDHome();
}
else if(command=='k')
{
pully_motor_left=0;
pully_motor_right=0;
uart_puts("Pully stopped ");
LCDClear();
LCDWriteString("Pully stopped ");
LCDHome();
}
else if(command=='l')
{
pully_motor_left=0;
pully_motor_right=1;
uart_puts("Pully going right ");
LCDClear();
LCDWriteString("Pully going right ");
LCDHome();
}

else if(command=='u')
{
mgnt_motor_up=1;
mgnt_motor_down=0;
uart_puts("Magnet going up ");

29
LCDClear();
LCDWriteString("Magnet going up ");
LCDHome();
}
else if(command=='i')
{
mgnt_motor_up=0;
mgnt_motor_down=0;
uart_puts("Magnet stopped ");
LCDClear();
LCDWriteString("Magnet stopped ");
LCDHome();
}
else if(command=='o')
{
mgnt_motor_up=0;
mgnt_motor_down=1;
uart_puts("Magnet going down ");
LCDClear();
LCDWriteString("Magnet going down ");
LCDHome();
}

else if(command=='s' && magnetflag==0)


{
magnet=1;
magnetflag=1;
uart_puts("Magnetized ");
LCDClear();
LCDWriteString("Magnetized ");
LCDHome();
}
else if(command=='s' && magnetflag==1)
{
magnet=0;
magnetflag=0;
uart_puts("Demagnetized ");
LCDClear();
LCDWriteString("Demagnetized ");
LCDHome();

30
}

if (choice == 0) { //auto mode


belt_motor=1;
if(ctr++==10000){
uart_puts("Welcome\n\r");
ctr=0;
}
}

}
return 0;

31

You might also like