Universiti Teknologi Malaysia Robot Contest ... - OoCities

pleasanthopebrothersElectronics - Devices

Nov 2, 2013 (3 years and 8 months ago)

84 views



Bengkel Asas Pembinaan Robot 2


UBOCON ‘02

Universiti Teknologi Malaysia Robot Contest

Prepared by Yeong Che Fai


Overview


Micro Controller Circuit


Atmel AT89C2051with output


Micro Controller Programming


Simple Program


Compiler


Universal Programmer


Micro Controller Circuit


Atmel AT89C2051 with output and input


Sensor


Infra red detector


Micro Controller Circuit + Sensor


Motor Driver


L293B


Micro Controller Circuit + Sensor + Motor Driver


Conclusion





Micro controller circuit

(Atmel AT89C2051 with output)


Build a basic micro controller system as shown below.


3 majors component to connect to micro controller;
power, oscillator and reset circuit.

Reset

10K ohm

10uF

5 V

Gnd

P1.7

P1.6

P1.5

P1.4

P1.3

P1.2

P1.1

P1.0

P3.7

P3.5

P3.4

P3.3

P3.2

P3.1

P3.0

1

4

5

19

18

17

16

15

14

13

12

11

9

8

7

6

3

2

20

10

A

T

M

E

L


A

T

8

9

C

2

0

5

1

Oscillator

33pF

33pF

Vcc

12Mhz crystal

Basic micro controller system

Reset

10K ohm

10uF

5 V

Gnd

P1.7

P1.6

P1.5

P1.4

P1.3

P1.2

P1.1

P1.0

P3.7

P3.5

P3.4

P3.3

P3.2

P3.1

P3.0

1

4

5

19

18

17

16

15

14

13

12

11

9

8

7

6

3

2

20

10

A

T

M

E

L


A

T

8

9

C

2

0

5

1

Oscillator

33pF

33pF

Vcc

5 V

220 ohm

220 ohm

LED

LED

12Mhz crystal


Now, connect LEDs to pin as shown below


The circuit is ready, now remove the Atmel and
proceed to download your program onto it.


Micro controller Programming

(Simple Program, Compiler, Universal Programmer)

;Test 1

;Led Blinking


$mod51


org

0h

again:


mov

p1,#00000001b

;On LED at p1.1


acall

delay


;delay


mov

p1,#00000010b

;On LED at p1.0


acall

delay

;delay


ljmp

again

;Always jump back to again

delay:



;Delay's Function


mov

r1,#1

l1:

mov

r2,#160

l2:

mov

r3,#255

l3:

djnz

r3,l3


djnz

r2,l2


djnz

r1,l1


ret


end



Write program as below and save as Test1.asm

Simple program

Make sure save as Test1.asm

Saving Test1.asm file


Now, compile the Test1.asm using software
available (ie; asm51.exe)


Go to dos and go to the directory with the
assembler application (It’s better if your program
save in the same folder).


Type “asm51 Test1.asm “


This function will generate Test1.hex and
Test1.lst.


Text1.hex is machine code which is needed to
download to Atmel.


Compiler

Compiler

Universal Programmer


3 major things to be done using the programmer;


Erase the microcontroller


Load Hex file onto the microcontroller


Program and verify the microcontroller



Next few slides show the steps using the Universal
Programmer

Step 1

Open All
-
11 Universal Programmer & Tester

Step 2

Click at device and choose ATMEL

Step 3

Click at MPU/MCU and choose AT89C2051

Step 4

Erase the microcontroller

Step 5

Click run and close after the process.

Step 6

Load a .Hex file

Step 7

Browse to folder and choose on TEST1.HEX

Step 8

Set the settings as shown and click ok

Step 9

Finally, run program… now, your Atmel is
downloaded with TEST1.HEX


Try run the circuit with the Atmel.


Press reset and the leds should blinking.


Video

Now, add your circuit with a switch.



Micro controller circuit

(Atmel AT89C2051 with output and input)

Reset

10K ohm

10uF

5 V

Gnd

P1.7

P1.6

P1.5

P1.4

P1.3

P1.2

P1.1

P1.0

P3.7

P3.5

P3.4

P3.3

P3.2

P3.1

P3.0

1

4

5

19

18

17

16

15

14

13

12

11

9

8

7

6

3

2

20

10

A

T

M

E

L


A

T

8

9

C

2

0

5

1

Oscillator

33pF

33pF

Vcc

5 V

220 ohm

220 ohm

LED(Green)

LED (Red)

220 ohm

Push on
Button

12Mhz crystal

Input


Add a push on switch circuit as shown below

; Test2.asm

; Input :: Push on button

;Output :: LEDs


$mod51


org

0h


mov

p3,#10000000b


;Set pin p3.7 as input

again:



jnb

p3.7,on


;Jump to "on" if switch is pressed


mov

p1,#00000001b


;Green LED on




ljmp

again


;Always loop back to "again"

on:


mov

p1,#00000010b


;Yellow LED on


ljmp

again


;Always loop back to "again"


end



Now write source code below and save as
Test2.asm


Redo the previously step of compiling and load
onto atmel.


Run the circuit.


LED will switch when the push on button is “On”

Not pressed

Pressed

Video

Sensor

(Infra Detector)

Out4

Inp4
-

Inp4+

Gnd

Inp3+

Inp3
-

Out3

14

13

12

11

10

9

8


1

2

3

4

5

6

7


L

M

2

3

4

5 V

10K Ohm
preset

Out1

Inp1
-

Inp1+

Vcc

Inp2+

Inp2
-

Out2


Build circuit below

10K Ohm
preset

5 V


Set the 10K ohm preset for input 2
-

to
middle position.


By tuning the 10K ohm preset for input 2+
will trigger the output2.


If input 2+ is tuned to max, led will light on
and vice versa when input 2+ is tuned to
minimum.

If Inp2+ > Inp2
-

;


out2 will at “HIGH” state

If Inp2+ < Inp2
-

;


out2 will at “LOW” state

220 ohm

5 V

Multi turn
preset

Normal preset
(Cheaper)

Out4

Inp4
-

Inp4+

Gnd

Inp3+

Inp3
-

Out3

14

13

12

11

10

9

8


1

2

3

4

5

6

7


L

M

2

3

4

5 V

10K Ohm
preset

220 ohm

Out1

Inp1
-

Inp1+

Vcc

Inp2+

Inp2
-

Out2

5 V

5 V

5 V

3.7K ohm

IR Detector

IR Transmitter


Build circuit below


Now, modify your inp2+ with ir sensor as
shown below.


Moving a pierce of paper (any white
surface material) on top of the sensor will
trigger the output.

I R
Transmitter

I R Detector

Top view

Side view

With white line

Without white line

Different view

Video

Micro controller

(Circuit and Programming)

+

Sensor

(Infra Detector)


Reset

10K ohm

10uF

5 V

Gnd

P1.7

P1.6

P1.5

P1.4

P1.3

P1.2

P1.1

P1.0

P3.7

P3.5

P3.4

P3.3

P3.2

P3.1

P3.0

1

4

5

19

18

17

16

15

14

13

12

11

9

8

7

6

3

2

20

10

A

T

M

E

L


A

T

8

9

C

2

0

5

1

Oscillator

33pF

33pF

12Mhz

Vcc

5 V

220 ohm

220 ohm

LED

LED

220 ohm

Push on
Button

Connect to

sensor circuit

Micro controller

Connect the micro controller and sensor
together by red point shown in picture below.

Out4

Inp4
-

Inp4+

Gnd

Inp3+

Inp3
-

Out3

14

13

12

11

10

9

8


1

2

3

4

5

6

7


L

M

2

3

4

5 V

10K Ohm
preset

220 ohm

Out1

Inp1
-

Inp1+

Vcc

Inp2+

Inp2
-

Out2

5 V

5 V

5 V

3.7K ohm

IR Detector

IR Transmitter

Connect to

Micro controller circuit

Sensor


Connect both circuits together

Sensor

Micro controller

Make a connection by simply add a wire

To the point shown previously slides.

Sensor + micro controller

Combination

Video


Use Test2.asm as program for this circuit.


Triggering the infra detector will switch “on” the
microcontroller.



DC Motor

(Motor driver L293B)


Working in progress

Check back on 9
th

November 2002

Micro controller

(Circuit and Programming)

+

Sensor

(Infra Detector)

+

DC Motor

(Motor driver L293B)

Working in progress

Check back on 9
th

November 2002

Conclusion



Now, put everything in one piece of PCB in a
structure manner.


Make it robust as it can be modified anytime.


Circuit above is only “hiasan”….

Conclusion

DC Motors

Power Supply

Start and

stop switch

Line Sensors

Conclusion


Learn how to build a basic Atmel system.


Learn how to build a simple white
detector sensor.


Learn how to combine the sensors to the
microcontroller.



Hope, you can proceed with … blah
blah..blah….



CHECK BACK ON 9
TH

NOVEMBER 2002
FOR A COMPLETE AND CORRECT
VERSION.






The End!!


Check back again on

9
th

November 2002