Obstacle Avoider Mobile Robot

Curvy Obstacle Avoider Mobile Robot

     My second microcontroller hobby project is “Curvy”. He is an obstacle avoider mobile robot. Schematic diagram of his body is almost the same with “Cruddy” (Line Follower Mobile Robot) but his sensor PCB is far different from him. The programming language used here is still PIC Assembly Language also just like on Cruddy.

     Sensors: In order for the TV IR receiver modules to receive the signals from the Infrared LEDs, the Infrared LEDs should be pulsed from a range of 35-50khz by 555 IC’s Astable mode and it should also be pulsed again to a slower rate from 100hz to 2khz. I used two 555 Timer IC’s for generating this frequencies.

     Mechanism: The mobile robot has an indicator LEDs to show if he detects obstacles. When Curvy encounters walls or high obstacles, he then turns to the right or left to avoid it.

     The Mobile Robot is divided into two parts. The 1st PCB is composed of  PIC16F877A microcontroller, H-bridge, using the basic NPN and PNP Tranistors, LM324 Quad Op-amp Comparator I.C. and a 5v Voltage Regulator I.C.

     2nd PCB is composed of the Sensors and Infrared LEDs. Sensors used here were used TV IR receivers from junkshops. Their pins were tested by trial and error since no datasheets were provided and their labels are already erased.

     The steering method used here is a Differential Steering type. I used differential steering because it can make sharp turns which will make the car not need to move backwards.

Code:

    list        p=16f877A    ; list directive to define processor
#include    <p16f877A.inc>    ; processor specific variable definitions

__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _XT_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF

CBLOCK 0x21
FIRST
SECOND
THIRD
ENDC

ORG     0x000
goto    main              ; go to beginning of program

ORG     0x004
; isr code can go here

main

BANKSEL TRISC
MOVLW 0x00
MOVWF TRISC
MOVLW 0XFF
MOVWF TRISB
BANKSEL PORTC

Start_Up_LED:
MOVLW B'00000001'
MOVWF PORTC
CALL DELAYY
MOVLW B'00000010'
MOVWF PORTC
CALL DELAYY
MOVLW B'00000100'
MOVWF PORTC
CALL DELAYY
MOVLW B'00000101'
MOVWF PORTC
CALL DELAYY
MOVLW B'00000110'
MOVWF PORTC
CALL DELAYY
MOVLW B'00000111'
MOVWF PORTC
CALL DELAYY
MOVLW B'00000000'
MOVWF PORTC
CALL DELAYY
MOVLW B'00000111'
MOVWF PORTC
CALL DELAYY

MOVE:
BTFSS PORTB, 4
GOTO SENSOR0
GOTO SENSOR1

SENSOR0:
BTFSS PORTB, 5
GOTO SENSOR00
GOTO SENSOR01

SENSOR00:
BTFSS PORTB, 6
GOTO SENSOR000
GOTO SENSOR001

SENSOR01:
BTFSS PORTB, 6
GOTO SENSOR010
GOTO SENSOR011

SENSOR1:
BTFSS PORTB, 5
GOTO SENSOR10
GOTO SENSOR11

SENSOR10:
BTFSS PORTB, 6
GOTO SENSOR100
GOTO SENSOR101

SENSOR11:
BTFSS PORTB, 6
GOTO SENSOR110
GOTO SENSOR111

SENSOR000:                        ;LONG TURN
MOVLW B'10100111'
MOVWF PORTC
CALL DELAYY
CALL DELAYY
GOTO MOVE

SENSOR001:
MOVLW B'01100011'
MOVWF PORTC
CALL DELAYY
GOTO MOVE

SENSOR010:
MOVLW B'10010110'
MOVWF PORTC
CALL DELAYY
GOTO MOVE

SENSOR011:
MOVLW B'10100010'
MOVWF PORTC
CALL DELAYY
GOTO MOVE

SENSOR100:                        ;LONG TURN
MOVLW B'01100101'
MOVWF PORTC
CALL DELAYY
CALL DELAYY
GOTO MOVE

SENSOR101:
MOVLW B'01100001'
MOVWF PORTC
CALL DELAYY
GOTO MOVE

SENSOR110:
MOVLW B'10010100'
MOVWF PORTC
CALL DELAYY
GOTO MOVE

SENSOR111:
MOVLW B'01010111'
MOVWF PORTC
CALL DELAYY
GOTO MOVE

DELAYY:

MOVLW .1
MOVWF THIRD
MOVLW .60
MOVWF SECOND
MOVWF FIRST

LOOP_.5_MS:
NOP
DECFSZ    FIRST,F
GOTO    LOOP_.5_MS

DECFSZ     SECOND,F
GOTO    LOOP_.5_MS

DECFSZ     THIRD,F
GOTO    LOOP_.5_MS
return

END

Here is its video:

Watch it on FACEBOOK

Advertisements

6 responses to “Obstacle Avoider Mobile Robot

  1. I have been looking for the exact content like this. My day seems to be completed now. Only one thing is going on in my mind at this moment and that is commenting as a way of appreciating.And yes i have digg your site lloydi12345.wordpress.com .

    • Hi Azizi, thanks. I’ve listed there all the components well except for the sensors since I just got them from Junkshops. You can try TSOP series sensors. They have power pin, ground pin and output pin which is connected to your op amp. Hope I’ve helped.

  2. sir, thank you for sharing this project. can i ask for the complete list of all the components used in this project. just want to clarify the other components sir..

    thank you. good day ahead!! 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s