Introduction: A Very Cost Effective ROBOT Using Microcontroller 89c51.

Hey guys this is my first intractable, so please go easy on me..
What I have built in this intractable is a Robot. I call it a spy Robot (cos if built small and if a camera is added it will act as a spy). Any ways, due to time constrain and lack of sufficient funds, I could only build a basic (a huge one and not the micro robot, which I initially planned) model of the robot. I have programmed (Assembly language) the robot  for additional motor control for camera and other switches though.
The basic movement that would happen is the forward backward and the left and right movement. We could also add a camera to it, if required. For some people this would be like a 'Neanderthal Robot'. Any ways I know the pain that went into this. This is also my collage project, thanks to my project partners, Sandesh Davli, Sanjiv Vishvakarma and Jugal Makwana.    

Step 1: Components List

9v battery 1
Bridge wo4 1
Capacitor 1000μf/25v 1
Capacitor 10μf/25v 2
Regulator 7805 1
Key encoder 1
Encoder HT12E 1
RF transmitter 1
IC base 18pin 2
Micro switch 16
Ribbon cable 1Meter
PCB 10cm x 15cm 1


Receiver

Transformer 12v 1Amp 1
Bridge w04 1
Capacitor 1000μf/25v 1
Capacitor 10μf/25v 3
Regulator 7805 1
Relay 12v 8
Decoder HT12D 1
RF transmitter 1
LED 10
89c51 1
SIL resistor 3
Relay Driver IC 2804 1
Crystal 11.0592MHz 1
Micro switch 1
Ribbon calble 2Meter
PCB 15cm x 15cm 1
Motor 12v 30rpm 4
Car base 1
Wheel 4
Camera 1

Other

Soldering Gun 1
Soldering metal 1

Step 2: BASIC PRINCIPLE


         SPY-ROBOT works on the following principle it uses the modulation technique using RF module operating frequency of 433.95Mhz. The module is used to transmit the data from transmitter module accepted from switch pad at the transmitting end. The receiver module kept on the spy-robot receives this transmitted data. This data received is helpful for driving the motor as per the requirement, and performing various operations based on the address used by the encoder and decoder as per the data received.
The basic operation of the Robot is explained below..

Every switch on the switch pad is assigned a different function. When the user presses a particular switch, say if “x” switch is pressed the data associated with that switch will be recognized by the matrix IC 74922 that is directly connected to the switch pad.
The data will be further given to the encoder IC HT12E; the encoder IC is one of the most important and the varied part of the Robot, the data transmitted from the switch-pad connected to the key encoder IC74922 reaches the address/data-multiplexed pin of the encoder IC HT12E. As soon as the data is received, then, through the output pin of the encoder IC the data is given to the RF Module transmitter unit. From there the data is transmitted in open air. At the receiving end the data is collected by the receiver unit and the intended task is performed and the need is full filled. Over here encoder IC HT12E plays a very important role of encoding the data that is required for the intended task. Once the switch is pressed the data is given to the key encoder IC74922 from where the data is again recollected by the HT12E and from there the data in digital format is converted to serial format and is transmitted. The two encoder IC have great deal of work in the whole project and are therefore treated as one of the most important part of the project.
At the receiver end the most important and the biggest operation is performed by the micro controller. The data is received by the RF Module and is provided to the decoder IC HT12D. The decoder IC further provides that data to the micro controller unit and the pre programmed function associated with the switch is executed and the operation is performed. Here the address pins of the decoder IC plays an very important role, the address pin combination of the encoder and decoder must be same for the proper function and operation.
The other feature that I have programmed but could not add to the Robot is the stepper motors for the camera movement (did not get the camera which I was looking for). In this if fitted properly the camera can be rotated in 360 degrees. Now these motors are controlled by the micro controller unit. The camera facility will give the user the ability to guide the robot as required.
There is a provision of direction recognition with the help of the limit switch. If the robot collides with the obstacle then the limit switch will be closed and the micro controller unit connected to it will recognize and will deactivate that control. 

Step 3: Transmitter - the Remote

Transfer of code:
         The 16 various combinations provided by the use of switch pad enable the user with variety of options. The 16 various combinations are transmitted to 4-bit data by the IC74922 which is in turn connected to the encoder ICHT12E this IC will provide 4-bit data.
Encoding:
The 4-bit data received from the IC74922 is given to the encoder. Four bits (D0- D3) are given as data at the data pins.
      The 4 bit data connected at the pins 10 to 13 is in parallel order. This 4 bit parallel data is converted into serial form internally by the encoder and the serial 4 data is obtained at pin no 17. This serial data is further given to the transmitter module.
       The external 1 ohm resistor connected at the pins 15 and 16 is used to generate oscillations in the encoder of a particular frequency. So the 4 bit serial data is fed to the transmitter module at the same frequency.
Transmission:
The main transmitter is an ASK transmitter module, based on OOK modulation (ON OFF keying). Its carrier frequency is 433.92Mhz.
At the data pin of the module, the serial data from the 14th pin of the encoder is connected. This data is transmitted at 433.92Mhz frequency. The transmitting range of the transmitter is 25 to 30m (radius) without antenna. For transmission over this distance an antenna should be connected.
 Once the data reaches the data pin i.e. pin no 2 of the RF Module then the data is transmitted through it, the transmission of data is through a very high frequency carrier, the data is further transformed into a suitable type and then it is transmitted out through antenna connected to the RF Module pin no 4.

Step 4: Receiver - the Robot

Antenna:
The receiver antenna picks up the serial 4 bit data sent by the transmitter. Antenna is connected to one of the pins of the receiver. And this data is further processed through the receiver module.
Receiver module:
             The serial 4 bit data received from the antenna is further processed and fed to the data pin of the decoder IC HT12E.
Decoding:
       The serial data received at data in pin i.e. pin no 14 is internally converted in parallel form and the 4 bit data available at the 4 data out pins of the decoder is similar to the status of data at data in pins of the encoder.
       The decoding part is also dependent on the position or the conditioning of the 8-pin DIP SWITCH. The complete operation will depend on the switch position. As the switch is conditioned the receiver will respond to that signal and will not operate if the transmitter and the receiver switch position is not similar or same.
DECODING:
          When the particular switch is pressed IC74922 the matrix connected to the encoder IC HT12E will enable to transmit the particular data associated to it through the RF Module
The signal transmitted by the transmitter unit reaches the receiver unit where the data is collected by the RF Module and provide it to the decoder ICHT12D. The decoder IC will provide 4-bit data to the micro controller unit and the micro controller unit will recognize the signal and will provide appropriate data to that particular IC (ULN2804), this IC will drive respected motors connected to it for particular application.
There are several applications that are to be carried out such as image capturing, emission of poisonous gas, etc.
Motor driver:
The input from the motor driver circuitry comes from IC (ULN2804). The motor driver circuit consists of the “Relay Driver”. Using this circuit one motor can be driven in one direction at a time. Connecting it in parallel can also drive more than one motor so as per the data provided to the motor driver circuit, the motor’s direction can be controlled, and the robotic vehicle can be moved as per requirement.
The main part of the motor driver unit is the relay driver unit, which consist of two relays to drive a single motor in both clockwise and anticlockwise and to momentarily control the movement of the vehicle. 

Step 5: Programming




; P0.0 = M1 FORWARD RELAY
; P0.1 = M1 REVERSE RELAY
; P0.2 = M2 FORWARD RELAY
; P0.3 = M2 REVERSE RELAY
; P0.4 = M3 FORWARD RELAY
; P0.5 = M3 REVERSE RELAY
; P0.6 = M4 FORWARD RELAY
; P0.7 = M4 REVERSE RELAY
;
; P0.0 = LCD D0
; P0.0 = LCD D1
; P0.0 = LCD D2
; P0.0 = LCD D3
; P0.0 = LCD D4
; P0.0 = LCD D5
; P0.0 = LCD D6
; P0.0 = LCD D7
;
; P2.0 = FAN
; P2.1 =
; P2.2 = LIMT SWITCH 1
; P2.3 = DATA RECEIVED
; P2.4 = RECEIVED DATA LSB
; P2.5 = RECEIVED DATA LSB + 1
; P2.6 = RECEIVED DATA LSB + 2
; P2.7 = RECEIVED DATA MSB
;
; P3.0 =
; P3.1 =
; P3.2 = LCD RS
; P3.3 = LCD R/W
; P3.4 = LCD E
; P3.5 =
; P3.6 =
; P3.7 =

; Program starts here

ORG 0000H ;START

MOV P0,#00H
MOV P2,#OFOH
SETB P2.3

MOV DPTR,#COMM1 ; COMMAND REGISTER
UPI : CLR A ; INITIALIZE BY COMM1 STRING
MOVC A,@A+DPTR
INC DPTR




CJNE A,#’$’,COMMAND1
HERE:
MOV A,#80H ; STARTING ADDRESS OF LINE 1
ACALL COMMAND

MOV DPTR,#DATA 1 ; DISPLAY THE DATA
LCALL LINE_DISPLAY_ROLL
HERE1:
MOV A,#0C0H ; STARTING ADDRESS OF LINE 2
ACALL COMMAND

MOV DPTR,#DATA2
LCALL LINE_DISPLAY

LCALL CHECK_INPUT

CJNE A,#00H,NEXT1
MOV P0,#05H
LCALL DELAY
LCALL DELAY
MOV A,#0C0H ;STARTING ADDRESS OF LINE 2
ACALL COMMAND
MOV DPTR,#DATA3
LCALL LINE_DISPLAY
LCALL CHECK_KEY_RELEASE
LJMP HERE1 ;LOOP HERE AFTER DISPLAY

COMMAND1: ACALL COMMAND
AJMP UP1

NEXT1:
CJNE A,#01H,NEXT2
MOV P0,#0AH
LCALL DELAY
LCALL DELAY
MOV A,##0C0H ;STARTING ADDRESS OF LINE 2
ACALL COMMAND
MOV DPTR,#DATA4
LCALL LINE_DISPLAY
LCALL CHECK_KEY_RELEASE
LJMP HERE1 ;LOOP HERE AFTER DISPLAY

NEXT2:
CJNE A,#02H,NEXT3
MOV P0,#09H
LCALL DELAY
LCALL DELAY
MOV A,#OCOH ;STARTING ADDRESS OF LINE 2
ACALL COMMAND
MOV DPTR,#DATA5
LCALL LINE_DISPLAY
LCALL CHECK_KEY_RELEASE
LJMP HERE1 ;LOOP HERE AFTER DISPLAY

NEXT3:
CJNE A,#03H,NEXT4
MOV P0,#06H
LCALL DELAY
LCALL DELAY
MOV A,#0C0H ;STARTING ADDRESS OF LINE 2
ACALL COMMAND
MOV DPTR,#DATA6
LCALL LINE_DISPLAY
LCALL CHECK_KEY_RELEASE
LJMP HERE1 ;LOOP HERE AFTER DISPLAY

NEXT4:
CJNE A,#04H,NEXT5
MOV P0,#10H
LCALL DELAY
LCALL DELAY
MOV A,#0C0H ;STARTING ADDRESS OF LINE 2
ACALL COMMAND
MOV DPTR,#DATA7
LCALL LINE_DISPLAY
LCALL CHECK_KEY_RELEASE
LJMP HERE1 ;LOOP HERE AFTER DISPLAY

NEXT5:
CJNE A,#05H,NEXT6
MOV P0,#20H
LCALL DELAY
LCALL DELAY
MOV A,#0C0H ;STARTING ADDRESS OF LINE 2
ACALL COMMAND
MOV DPTR,#DATA8
LCALL LINE_DISPLAY
LCALL CHECK_KEY_RELEASE
LJMP HERE1 ;LOOP HERE AFTER DISPLAY

NEXT6:
CJNE A,#06H,NEXT7
MOV P0,#40H
LCALL DELAY
LCALL DELAY
MOV A,#0C0H ;STARTING ADDRESS OF LINE 2
ACALL COMMAND
MOV DPTR,#DATA9
LCALL LINE_DISPLAY
LCALL CHECK_KEY_RELEASE
LJMP HERE1 ;LOOP HERE AFTER DISPLAY

NEXT7:
CJNE A,#07H,NEXT8
MOV P0,#80H
LCALL DELAY
LCALL DELAY
MOV A,#0C0H ;STARTING ADDRESS OF LINE 2
ACALL COMMAND
MOV DPTR,#DATA10
LCALL LINE_DISPLAY
LCALL CHECK_KEY_RELEASE
LJMP HERE1 ;LOOP HERE AFTER DISPLAY

NEXT8:
CJNE A,#08H,NEXT9
SETB P2.0 ;(CONDITIONAL.. IF ADDED EXTRA FEATURES)
LCALL DELAY
LCALL DELAY
MOV A,#0C0H ;STARTING ADDRESS OF LINE 2
ACALL COMMAND
MOV DPTR,#DATA11
LCALL LINE_DISPLAY
LCALL CHECK_KEY_RELEASE
LJMP HERE1 ;LOOP HERE AFTER DISPLAY

NEXT9:
CJNE A,#09H,NEXTA
CLR P2.0 ; (CONDITIONAL.. IF ADDED EXTRA FEATURES)
LCALL DELAY
LCALL DELAY
MOV A,#0C0H ;STARTING ADDRESS OF LINE 2
ACALL COMMAND
MOV DPTR,#DATA12
LCALL LINE_DISPLAY
LCALL CHECK_KEY_RELEASE
LJMP HERE1 ;LOOP HERE AFTER DISPLAY

NEXTA:
LJMP HERE1 ;LOOP HERE AFTER DISPLAY


LINE_DISPLAY:
CLR A
MOVC A,@A+DPTR
INC DPTR
CJNE A,#’$’,DISPLAY1
RET

DISPLAY1: ACALL DISPLAY
AJMP LINE_DISPLAY

LINE_DISPLAY_ROLL:
LCALL DELAY
CLR A
MOVC A,@A+DPTR
INC DPTR
CJNE A,#’$’,DISPLAY11
RET

DISPLAY11: ACALL DISPLAY
AJMP LINE_DISPLAY_ROLL

DELAY: MOV R7,#0FFH
LOOP1: MOV R6,#0FFH
LOOP: DJNZ R6,LOOP
DJNZ R7,LOOP1
RET

;************************************************************************************************

;LCD STROBE COMMAND

COMMAND: ACALL READY ;WRITE WHEN DISPLAY IS NOT BUSY
MOV P1,A ;COMMAND CHARACTER IN PORT P1
CLR P3.2 ;COMMAND REGISTER CHOSEN
CLR P3.3 ;WRITE ENABLE
SETB P3.4 ;STROBE CHARACTER TO DISPLAYED
CLR P3.4
RET ;RETURN

;************************************************************************************************

DISPLAY: ACALL READY
MOV P1,A ;TAKE DATA TO BE DISPLAYED
SETB P3.2 ;PS=P3.2=1 TO SELECT DATA REGISTER
CLR P3.3 ;WRITE ENABLE
SETB P3.4 ;STROBE CHARACTER TO DISPLAYED
CLR P3.4
RET ;RETURN

;************************************************************************************************

READY: CLR P3.4 ;STROBE DISPLAY
MOV P1,#0FFH ;CONFIGURE P1 FOR INPUT
CLR P3.2 ;SELECT COMMAND REGISTER
SETB P3.3 ;READ ENABLE
WAIT: CLR P3.4 ;STROBE DISPLAY
SETB P3.4
JB P1.7,WAIT ;READ BUSY STATUS (BF=0)
CLR P3.4 ;END DISPLAY STROBE.
RET ;RETURN

; ************************************************************************************************

COMM1: DB 3CH,0EH,06,01H,’$’
DATA1: DB ‘BEBIL’S- ROBOT, $’
DATA2: DB ‘INSTRUCTABLES , $’
DATA3: DB ‘FORWARD $’
DATA4: DB ‘BACKWARD $’
DATA5: DB ‘LEFT $’
DATA6: DB ‘RIGHT $’
DATA7: DB ‘CAMERA LEFT $’
DATA8: DB ‘CAMERA RIGHT $’
DATA9: DB ‘CAMERA UP $’
DATA10: DB ‘CAMERA DOWN$’
DATA11: DB ‘OPTIONAL $’
DATA12: DB ‘OPTIONAL $’

CHECK_INPUT:
MOV P2,#0F0H
SETB P2.3
JB P2.3,READ_INPUT
NOP
SJMP CHECK_INPUT

READ_INPUT:
MOV P0,#00H
LCALL DELAY
MOV A,P2
ANL A,#0F0H
SWAP A
RET

CHECK_KEY_RELEASE:
SETB P2.3
NOP
JB P2.3,CHECK_KEY_RELEASE
SETB P2.3
MOV P0,#00H
RET

Step 6: Conclusion.

That's it guys, I hope you like it.

I have not mentioned about how to program the IC, soldering it and assembling. Will publish in detail on demand.

Critics are always welcome.

Please suggest ideas and comment on the project. 


Reference BOOKS:
Robotics demystified ----By Edwin Wise.
8051 Micro-controller ----By Kenneth.J.Ayala.
Electric drives ----By Vedam Subhramanyam.
Robot 4 U ----By Ruth Davis.

MAGAZINES:
ELECTRONICS FOR YOU.

WEBSITES:
www.epanorama.com
www.robotbooks.com
www.robothaven.com
www.haltekindia.com
www.google.com
www.epe.mag/uk.org
www.efy.com
www.electronics.co.in


                                                                                                                                                                                                                  Thank you,
Bebil Poovakoot :-D