Automatic Object Identification and
Automatic Object Identification and
Project Report
Name of the Project: Automatic Object Identification and
Handling Controller
i
Group Members
1 Raisul Islam
0406001
Department of EEE
BUET
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
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
Acknowledgement ............................................................................................................................ iv
Sensors ................................................................................................................................................. 5
Electro-Magnet ................................................................................................................................... 5
Algorithm ................................................................................................................................... 15
Application ................................................................................................................................ 19
Limitations ........................................................................................................................................ 20
Appendix ............................................................................................................................................ 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.
Electromagnet
Laser Beam
LDR Basket A Basket B Basket C
Conveyor Belt
PWM Speed
Controlled DC
Motor
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.
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
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.
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.
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
1
3 1 2
U3:D 2
74LS04
13 12 74LS08
74LS04
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
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
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
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
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
2 U36:A
eIn0
3
eIn1 U31:B
1
4 5
eIn3
5 6
eIn2 ShiftClk
4072 4
Laser1falling
74LS08
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
U31:C U3:E
9
NotEmpty
8 11 10
10
Laser2
74LS04
74LS08
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
17
In X axis: Number of observations
In Y axis: Counter value during passing the first LASER of the Conveyor Belt
18
Application
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.
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
22
Appendix
#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
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);
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();
}
30
}
}
return 0;
31