SENIOR PROJECT

REPORT

REMOTE CONTROL CAR

MURAT DİNÇER

200114017

ELECTRONIC AND COMMUNICATION

ENGINEERING

Advisor: Orhan GAZI

REMOTE CONTROL CAR

INTRODUCTION

My project is about making a remote controlled car. It has 3 basic parts:

-Transmitter

-Receiver

-Microcontrollers

I bought the transmitter and receiver from an electronic shop. So I do not need to make calibrations to them. The hard part about the Project is the microcontroller programming. I used two (one in transmitter and one in receiver) PIC 16F84 microcontrollers. I used PIC because it is cheap and easy to program.

What is PIC16F84?

PIC means Peripheral Interface Controller.

This microcontroller is selected because of:

-Its software can be owned from Microchip or internet with not paying anything

-It has wide customer group

-It is cheap and can be found easily

-It has cheap programming circuit

-Very easy to program

Here is the PIC16F84 pin diagram:

Ready to use Transmitter and Receiver Modules

TRANSMITTER

RECEIVER

I used relays for driving the dc motors

Methods and Experiments

My Project has two main circuits. One is serial communication circuit and the other is the dc motor driving circuit. Let’s take a look to the circuit diagrams:

SERIAL COMMUNICATION CIRCUIT

*I connected leds instead of dc motor…

MOTOR DRIVING CIRCUIT

*M1 Relates to the motor that is used for forward-backward motion and M2 relates to the motor for the direction. (Left-Right motion)

I used relays for decreasing the current. The current need is decreased by 50% rate.

The program code (Serial Communication Program) for Pic 16F84 is in the appendix part.

Discussions

This projects main aim is learning and using the basics of programming. It is the hardest part of the Project. The driving of the dc motors and connecting the transmitter and receiver are relatively easy to make. The steering is also made by dc motor, this simplifies my Project. If I use stepper motor instead of dc, I need to write some microcontroller codes to drive that. I bought a toy car and used the dc motors on it. So the fitting of the motors are not a problem. The most interesting part of my Project is the usage of Proteus ISIS program. This program really helped me. I don’t need to construct the circuit over and over for adding new components. I don’t need to program the PIC microcontroller as I change the code of the program. I just simply compile the code and start my simulation at the ISIS. This program also makes the PCB schematic automatically, so if you want to make a practical model of your design, it is not a problem.

Summary

This project makes me a good beginner assembly programmer. I learned a lot of new things about this subject. It effected my future selections about job looking. I learned a new program named ISIS. This program helped me very much. I think the main aim to make a project is learning new things by yourself. I learned so many things myself so the project reach to its goal.

REFERENCES

-Mikroişlemciler ve PIC Programlama – Orhan Altınbaşak

-Microcontrol’n Applications – David Benson

APPENDIX

Code of the program:

Transmitter Part

list p=16f84
include "P16F84A.inc"
sendreg equ h'0c'
sendreg2 equ h'0d'
sendreg3 equ h'0e'
sendreg4 equ h'0f'
count equ h'10'
start
bsf STATUS,5
movlw b'00001111'
movwf TRISA
clrf TRISB
bcf STATUS,5
bsf PORTB,0
switch
movlw b'00100000' ;number to be sent
movwf sendreg
btfsc PORTA,0
goto switch2
goto ser_out
switch2
movlw b'00010000'
movwf sendreg2
btfsc PORTA,1
goto switch3
goto ser_out2
switch3
movlw b'00001000' / movwf sendreg3
btfsc PORTA,2
goto switch4
goto ser_out3
switch4
movlw b'00000100'
movwf sendreg4
btfsc PORTA,3
goto switch
goto ser_out4
circle
;gotocircle
ser_out
bcf INTCON,5 ; disable tmr0 interrupts
bcf INTCON,7 ; disable global int.
clrf TMR0
CLRWDT
bsf STATUS,5
movlw b'11011000'
movwf OPTION_REG
bcf STATUS,5
movlw h'08' ;counter for 8 bits
movwf count
bcf PORTB,0
clrf TMR0
bcf INTCON,2 ;clear tmr0 flag
time1
btfss INTCON, 2 ;timer overflow?
goto time1
bcf INTCON, 2 ;clear tmr0 flag
nxtbit
bcf STATUS,0
rlf sendreg, f ; rotate left
btfsc STATUS,0 ;test carry flag
goto setportb
bcf PORTB,0
goto time2
setportb
bsf PORTB,0
time2
btfss INTCON, 2 ;timer overflow?
goto time2
bcf INTCON, 2 ;clear timer overflow flagdecfsz count, f ;decrease counter
goto nxtbit
bsf PORTB, 0 ;output mark
time3
btfss INTCON, 2 ;timer overflow?
goto time3
goto switch
ser_out2
bcf INTCON,5 ; disable tmr0 interrupts
bcf INTCON,7 ; disable global int.
clrf TMR0
“CLRWDT
bsf STATUS,5
movlw b'11011000'
movwf OPTION_REG
bcf STATUS,5
movlw h'08' ;counter for 8 bits
movwf count
bcf PORTB,0
clrf TMR0
bcf INTCON,2 ;clear tmr0 flag
time1_serout2
btfss INTCON, 2 ;timer overflow?
goto time1_serout2
bcf INTCON, 2 ;clear tmr0 flag
nxtbit2
bcf STATUS,0
rlf sendreg2, f ; rotate left
btfsc STATUS,0 ;test carry flag
goto setportb2 / bcf PORTB,0
goto time2_serout2
setportb2
bsf PORTB,0
time2_serout2
btfss INTCON, 2 ;timer overflow?
goto time2_serout2
bcf INTCON, 2 ;clear timer overflow flag
decfsz count, f ;decrease counter
goto nxtbit2
bsf PORTB,0 ;output mark
btfss INTCON, 2 ;timer overflow?
goto time3_serout2
goto switch
ser_out3
bcf INTCON,5 ; disable tmr0 interrupts
bcf INTCON,7 ; disable global int.
clrf TMR0
CLRWDT
bsf STATUS,5
movlw b'11011000'
movwf OPTION_REG
bcf STATUS,5
movlw h'08' ;counter for 8 bits
movwf count
bcf PORTB,0
clrf TMR0
bcf INTCON,2 ;clear tmr0 flag
time1_serout3
btfss INTCON, 2 ;timer overflow?
goto time1_serout3
bcf INTCON, 2 ;clear tmr0 flag
nxtbit3
bcf STATUS,0
rlf sendreg3, f ; rotate left
btfsc STATUS,0 ;test carry flag
goto setportb3
bcf PORTB,0
goto time2_serout3
setportb3
bsf PORTB,0
time2_serout3
btfss INTCON, 2 ;timer overflow?
goto time2_serout3
bcf INTCON, 2 ;clear timer overflow flag
decfsz count, f ;decrease counter
goto nxtbit3
bsf PORTB,0 ;output mark
time3_serout3
btfss INTCON, 2 ;timer overflow?
goto time3_serout3
goto switch
ser_out4
bcf INTCON,5 ; disable tmr0 interrupts
bcf INTCON,7 ; disable global int.
clrf TMR0
CLRWDT
bsf STATUS,5
movlw b'11011000'
movwf OPTION_REG
bcf STATUS,5
movlw h'08' ;counter for 8 bits
movwf count
bcf PORTB,0
clrf TMR0
bcf INTCON,2 ;clear tmr0 flag
time1_serout4
btfss INTCON, 2 ;timer overflow?
goto time1_serout4
bcf INTCON, 2 ;clear tmr0 flag
nxtbit4
bcf STATUS,0
rlf sendreg4, f ; rotate left
btfsc STATUS,0 ;test carry flag
goto setportb4
bcf PORTB,0
goto time2_serout4
setportb4
bsf PORTB,0
time2_serout4
btfss INTCON, 2 ;timer overflow?
goto time2_serout4
bcf INTCON, 2 ;clear timer overflow flag
decfsz count, f ;decrease counter
goto nxtbit4
bsf PORTB,0 ;output mark
time3_serout4
btfss INTCON, 2 ;timer overflow?
goto time3_serout4
goto switch
end

Receiver Part

“list p=16f84
include "P16F84A.INC"
rcvreg equ 0x0c
count equ 0x0d
temp equ 0x0e
counterr equ 0x0f
start
bsf STATUS,5
movlw b'00000001'
movwf TRISA
clrf TRISB
bcf STATUS,5
clrf PORTA
movlw b'11111111'
movwf PORTB
clrf rcvreg
switch
call ser_in
movf rcvreg, 0 ;get the byte received
movwf PORTB
goto switch
ser_in
bcf INTCON, 5 ;disable tmr0 intr.
bcf INTCON, 7 ;disable global intr.
clrf TMR0
CLRWDT
bsf STATUS,5
movlwb'11011111'
movwfOPTION_REG
bcf STATUS,5
movlw h'08'
movwf count ;counter for 8 bits
sbit
btfscPORTA, 0 ;look for start bit
goto increment
goto cont
increment
incf counterr,f
btfss counterr,7
goto sbit
btfss counterr,6
goto sbit
btfss counterr,5
goto sbit
goto setb
goto sbit / setb
clrf PORTB
;movlw b'11111111'
;movwf PORTB
clrf counterr
goto sbit
cont
clrf counterr
movlw0x80 ;tmr0 value
movwfTMR0
bcf INTCON, 2 ;clear timer flag
time1
btfssINTCON,2 ;timer overflow?
gototime1
btfscPORTA,0 ;start bit still low?
gotosbit ;false go back
clrfTMR0 ;clear tmr0 value
bcfINTCON,2 ;clear timer flag
time2
btfssINTCON,2 ;timer overflow?
gototime2 ;no
bcfINTCON,2 ;yes, clear flag
movfPORTA,w ;write the value to w
movwftemp ;write the bit value to temp
rrftemp, f ;rotate right temp
rrfrcvreg, f ;rotate left the rcvreg
decfsz count, f ;decrement counter
gototime2
time3
btfssINTCON,2 ;timer overflow?
gototime3 ;no
return ;yes, byte received
end