Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Light follower robot: better to use POT command or A/D ?

Status
Not open for further replies.

arash_micro

Member level 5
Joined
Jan 25, 2005
Messages
91
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
739
light follower robot

Hello
I was make a ""light follower robot"" with analog elements
Now i want to make it with PIC and steper motor
It's good to use ==POT command== in basic language or A/D
((POT command reads the value of resistor but is a litle slow))
if you have good link can show me.
Thanks
 

light follower robot

What do you mean light follower? A robot that follows a light source?
 
Re: light follower robot

glenjoy said:
What do you mean light follower? A robot that follows a light source?

I assume you are refering to the popular "line" following robot that utilises i/r to detect the line and then "follows" it.
A google search will reveal many links and circuits for this circuit,using the pic.

Good Luck
 

Re: light follower robot

Just for Line, not Light

Great site:


try google search with codeword: "Line Follower" or "Line Tracer"
Good Luck
 

light follower robot

No
It has a head and turn it to light source
 

Re: light follower robot

arash_micro said:
No
It has a head and turn it to light source

Then you need a good photodetector with very high dynamic range, because most phototransistor saturates very quick.
 

light follower robot

I use 4 FOTOCELL and cover them with a dark papre
It work's
can i use them in this new project or not. why?
 

Re: light follower robot

glenjoy said:
arash_micro said:
No
It has a head and turn it to light source

Then you need a good photodetector with very high dynamic range, because most phototransistor saturates very quick.

AGC can eliminate this effect, if current trhough phototransistor will be subject to tune.
 

Re: light follower robot

arash_micro said:
I use 4 FOTOCELL and cover them with a dark papre
It work's
can i use them in this new project or not. why?

Yes you can still use them in this project, then what you need next is an analog to digital converter.

You cannot use a simple comparaotr here because we are talking about light intensity not a mere 1 or 0 logic, am I right or wrong?

Glenjoy
 
Re: light follower robot

Other option is to use this proportional signal from light cells, amplify it and use is to directly control a servo motor to turn the head towards to the brightes spot.
This can be quite interesting approach .. so ..
Think about it ..
 

    arash_micro

    Points: 2
    Helpful Answer Positive Rating
    V

    Points: 2
    Helpful Answer Positive Rating
light follower robot

can my robot turn to human
 

My Line Follower Robot

Hello

I have designed my own Line Follower Robot, I wrote the program for PIC using PICBasic Pro.

The Code:

'****************************************************************
'* Name : Path Finder Robot.BAS *
'* Author : Omar Udai Shacker *
'* Notice : Copyright (c) 2005 *
'* Date : 3/27/2005 *
'* Version : 1.8 *
'****************************************************************
'****************************************************************
'*************** Special Registers Setup ***************
'****************************************************************

@ DEVICE XT_OSC, WDT_ON, PWRT_OFF, PROTECT_OFF

' RA0 & RA1 Are Inputs, RA2-RA4 Are Outputs
TRISA = %00000011
' RB0-RB3 Are Inputs, RB4-RB7 Are Outputs
TRISB = %00001111
' PortB Pull-ups Are Disabled, Interrupt on Rising Edge at RB0
OPTION_REG = %11000000

'****************************************************************
'*********************** External Interrupt *****************
'********************* Setup in PICBasic Pro ****************
'****************************************************************

' Global Interrupt Enable, RB0 External Interrupt Enabled
INTCON = %10010000

'****************************************************************
'***************** Global Variables & Conts **************
'****************************************************************

YES CON 0 ' Line Detected, or Obstacle Detected
NO CON 1 ' No Line Detected, or No Obstacle Detected

'****************************************************************

' Switch ON Button Routine For PortA.1
SW_ON VAR PORTA.1

'****************************************************************

' PhotoDiode Receiver Variables "Bit Sized"
L_RX VAR PORTB.1
M_RX VAR PORTB.2
R_RX VAR PORTB.3

'****************************************************************

' Direction Monitor LED Varibles "Bit sized"
L_LED VAR PORTA.2
M_LED VAR PORTA.3
R_LED VAR PORTA.4
GoSub LED_INIT

'****************************************************************

' L293 Motor Driver Variables "Bit Sized"
MOTOR_1A_PLUS VAR PORTB.7
MOTOR_2A_MINUS VAR PORTB.6
STEER_3A_PLUS VAR PORTB.5
STEER_4A_MINUS VAR PORTB.4
GoSub MOTOR_INIT

'****************************************************************
'****************************************************************
'****************************************************************
'********************* Main Program *****************
'****************************************************************
'****************************************************************
'****************************************************************



'****************************************************************
'*************** Enable Interrupts in PBPro ***************
'***************** Switch ON Routine ********************
'****************************************************************

' Enable Interrupt in PICBasic Pro
ON INTERRUPT GoTo SW_OFF
SWITCH_ON :
IF SW_ON == 0 Then SWITCH_ON

'****************************************************************
'**************** Variables Initialization **************
'****************************************************************

' General Variable Initialization
MAIN :
GoSub MOTOR_INIT
GoSub LED_INIT

'****************************************************************
'****************** Line Follower Routine ***************
'****************************************************************

' Line Follower PhotoDiode Check Routine
LINE_FOLLOWER :
IF ( L_RX == NO ) AND ( M_RX == NO ) AND ( R_RX == NO ) Then ERROR
IF ( L_RX == NO ) AND ( M_RX == NO ) AND ( R_RX == YES ) Then RIGHT
IF ( L_RX == NO ) AND ( M_RX == YES ) AND ( R_RX == NO ) Then FORWARD
IF ( L_RX == NO ) AND ( M_RX == YES ) AND ( R_RX == YES ) Then RIGHT
IF ( L_RX == YES ) AND ( M_RX == NO ) AND ( R_RX == NO ) Then LEFT
IF ( L_RX == YES ) AND ( M_RX == NO ) AND ( R_RX == YES ) Then ERROR
IF ( L_RX == YES ) AND ( M_RX == YES ) AND ( R_RX == NO ) Then LEFT
IF ( L_RX == YES ) AND ( M_RX == YES ) AND ( R_RX == YES ) Then FORWARD

'****************************************************************
'********************* Forward Routine ******************
'****************************************************************

' Forward Routine
FORWARD :
L_LED = L_RX
M_LED = M_RX
R_LED = R_RX
LOW MOTOR_2A_MINUS
LOW STEER_3A_PLUS
LOW STEER_4A_MINUS
PWM MOTOR_1A_PLUS, 122, 1
LOW MOTOR_1A_PLUS
IF ( L_RX == NO ) AND ( M_RX == YES ) AND ( R_RX == NO ) Then FORWARD
IF ( L_RX == YES ) AND ( M_RX == YES ) AND ( R_RX == YES ) Then FORWARD
IF ( L_RX == NO ) AND ( M_RX == NO ) AND ( R_RX == NO ) Then FORWARD
GoTo MAIN

'****************************************************************
'********************** Right Routine *******************
'****************************************************************

' Turn Right Routine
RIGHT :
L_LED = L_RX
M_LED = M_RX
R_LED = R_RX
LOW MOTOR_2A_MINUS
HIGH STEER_3A_PLUS
LOW STEER_4A_MINUS
PWM MOTOR_1A_PLUS, 126, 2
LOW MOTOR_1A_PLUS
IF ( L_RX == NO ) AND ( M_RX == NO ) AND ( R_RX == YES ) Then RIGHT
IF ( L_RX == NO ) AND ( M_RX == YES ) AND ( R_RX == YES ) Then RIGHT
IF ( L_RX == NO ) AND ( M_RX == NO ) AND ( R_RX == NO ) Then right
GoTo MAIN

'****************************************************************
'********************** Left Routine ********************
'****************************************************************

' Turn Left Routine
LEFT :
L_LED = L_RX
M_LED = M_RX
R_LED = R_RX
LOW MOTOR_2A_MINUS
LOW STEER_3A_PLUS
HIGH STEER_4A_MINUS
PWM MOTOR_1A_PLUS, 126, 2
LOW MOTOR_1A_PLUS
IF ( L_RX == YES ) AND ( M_RX == NO ) AND ( R_RX == NO ) Then LEFT
IF ( L_RX == YES ) AND ( M_RX == YES ) AND ( R_RX == NO ) Then LEFT
IF ( L_RX == NO ) AND ( M_RX == NO ) AND ( R_RX == NO ) Then left
GoTo MAIN

'****************************************************************
'********************** Error Routine *******************
'****************************************************************

' Error Routine
ERROR :
L_LED = L_RX
M_LED = M_RX
R_LED = R_RX
LOW MOTOR_2A_MINUS
LOW STEER_3A_PLUS
LOW STEER_4A_MINUS
PWM MOTOR_1A_PLUS, 122, 1
LOW MOTOR_1A_PLUS
GoTo MAIN

'****************************************************************
'***************** MOTOR Initailization ******************
'****************************************************************

MOTOR_INIT :
' L293 Motor Driver Initialization
LOW MOTOR_1A_PLUS
LOW MOTOR_2A_MINUS
LOW STEER_3A_PLUS
LOW STEER_4A_MINUS
Return

'****************************************************************
'************** LED Direction Initailization *************
'****************************************************************

LED_INIT :
HIGH L_LED
HIGH M_LED
HIGH R_LED
Return

'****************************************************************
'****************** Interrupt Handler Routine *****************
'****************************************************************

Disable
SW_OFF :
GoSub MOTOR_INIT
GoSub LED_INIT
INTCON.1 = 0
Resume SWITCH_ON
Enable

'****************************************************************
'********************* The End *******************
'****************************************************************

End
 
Re: My Line Follower Robot

metal said:
Hello

I have designed my own Line Follower Robot, I wrote the program for PIC using PICBasic Pro.

The Code:

'****************************************************************
'* Name : Path Finder Robot.BAS *
'* Author : Omar Udai Shacker *
'* Notice : Copyright (c) 2005 *
'* Date : 3/27/2005 *
'* Version : 1.8 *
'****************************************************************
'****************************************************************
'*************** Special Registers Setup ***************
'****************************************************************

@ DEVICE XT_OSC, WDT_ON, PWRT_OFF, PROTECT_OFF

' RA0 & RA1 Are Inputs, RA2-RA4 Are Outputs
TRISA = %00000011
' RB0-RB3 Are Inputs, RB4-RB7 Are Outputs
TRISB = %00001111
' PortB Pull-ups Are Disabled, Interrupt on Rising Edge at RB0
OPTION_REG = %11000000

'****************************************************************
'*********************** External Interrupt *****************
'********************* Setup in PICBasic Pro ****************
'****************************************************************

' Global Interrupt Enable, RB0 External Interrupt Enabled
INTCON = %10010000

'****************************************************************
'***************** Global Variables & Conts **************
'****************************************************************

YES CON 0 ' Line Detected, or Obstacle Detected
NO CON 1 ' No Line Detected, or No Obstacle Detected

'****************************************************************

' Switch ON Button Routine For PortA.1
SW_ON VAR PORTA.1

'****************************************************************

' PhotoDiode Receiver Variables "Bit Sized"
L_RX VAR PORTB.1
M_RX VAR PORTB.2
R_RX VAR PORTB.3

'****************************************************************

' Direction Monitor LED Varibles "Bit sized"
L_LED VAR PORTA.2
M_LED VAR PORTA.3
R_LED VAR PORTA.4
GoSub LED_INIT

'****************************************************************

' L293 Motor Driver Variables "Bit Sized"
MOTOR_1A_PLUS VAR PORTB.7
MOTOR_2A_MINUS VAR PORTB.6
STEER_3A_PLUS VAR PORTB.5
STEER_4A_MINUS VAR PORTB.4
GoSub MOTOR_INIT

'****************************************************************
'****************************************************************
'****************************************************************
'********************* Main Program *****************
'****************************************************************
'****************************************************************
'****************************************************************



'****************************************************************
'*************** Enable Interrupts in PBPro ***************
'***************** Switch ON Routine ********************
'****************************************************************

' Enable Interrupt in PICBasic Pro
ON INTERRUPT GoTo SW_OFF
SWITCH_ON :
IF SW_ON == 0 Then SWITCH_ON

'****************************************************************
'**************** Variables Initialization **************
'****************************************************************

' General Variable Initialization
MAIN :
GoSub MOTOR_INIT
GoSub LED_INIT

'****************************************************************
'****************** Line Follower Routine ***************
'****************************************************************

' Line Follower PhotoDiode Check Routine
LINE_FOLLOWER :
IF ( L_RX == NO ) AND ( M_RX == NO ) AND ( R_RX == NO ) Then ERROR
IF ( L_RX == NO ) AND ( M_RX == NO ) AND ( R_RX == YES ) Then RIGHT
IF ( L_RX == NO ) AND ( M_RX == YES ) AND ( R_RX == NO ) Then FORWARD
IF ( L_RX == NO ) AND ( M_RX == YES ) AND ( R_RX == YES ) Then RIGHT
IF ( L_RX == YES ) AND ( M_RX == NO ) AND ( R_RX == NO ) Then LEFT
IF ( L_RX == YES ) AND ( M_RX == NO ) AND ( R_RX == YES ) Then ERROR
IF ( L_RX == YES ) AND ( M_RX == YES ) AND ( R_RX == NO ) Then LEFT
IF ( L_RX == YES ) AND ( M_RX == YES ) AND ( R_RX == YES ) Then FORWARD

'****************************************************************
'********************* Forward Routine ******************
'****************************************************************

' Forward Routine
FORWARD :
L_LED = L_RX
M_LED = M_RX
R_LED = R_RX
LOW MOTOR_2A_MINUS
LOW STEER_3A_PLUS
LOW STEER_4A_MINUS
PWM MOTOR_1A_PLUS, 122, 1
LOW MOTOR_1A_PLUS
IF ( L_RX == NO ) AND ( M_RX == YES ) AND ( R_RX == NO ) Then FORWARD
IF ( L_RX == YES ) AND ( M_RX == YES ) AND ( R_RX == YES ) Then FORWARD
IF ( L_RX == NO ) AND ( M_RX == NO ) AND ( R_RX == NO ) Then FORWARD
GoTo MAIN

'****************************************************************
'********************** Right Routine *******************
'****************************************************************

' Turn Right Routine
RIGHT :
L_LED = L_RX
M_LED = M_RX
R_LED = R_RX
LOW MOTOR_2A_MINUS
HIGH STEER_3A_PLUS
LOW STEER_4A_MINUS
PWM MOTOR_1A_PLUS, 126, 2
LOW MOTOR_1A_PLUS
IF ( L_RX == NO ) AND ( M_RX == NO ) AND ( R_RX == YES ) Then RIGHT
IF ( L_RX == NO ) AND ( M_RX == YES ) AND ( R_RX == YES ) Then RIGHT
IF ( L_RX == NO ) AND ( M_RX == NO ) AND ( R_RX == NO ) Then right
GoTo MAIN

'****************************************************************
'********************** Left Routine ********************
'****************************************************************

' Turn Left Routine
LEFT :
L_LED = L_RX
M_LED = M_RX
R_LED = R_RX
LOW MOTOR_2A_MINUS
LOW STEER_3A_PLUS
HIGH STEER_4A_MINUS
PWM MOTOR_1A_PLUS, 126, 2
LOW MOTOR_1A_PLUS
IF ( L_RX == YES ) AND ( M_RX == NO ) AND ( R_RX == NO ) Then LEFT
IF ( L_RX == YES ) AND ( M_RX == YES ) AND ( R_RX == NO ) Then LEFT
IF ( L_RX == NO ) AND ( M_RX == NO ) AND ( R_RX == NO ) Then left
GoTo MAIN

'****************************************************************
'********************** Error Routine *******************
'****************************************************************

' Error Routine
ERROR :
L_LED = L_RX
M_LED = M_RX
R_LED = R_RX
LOW MOTOR_2A_MINUS
LOW STEER_3A_PLUS
LOW STEER_4A_MINUS
PWM MOTOR_1A_PLUS, 122, 1
LOW MOTOR_1A_PLUS
GoTo MAIN

'****************************************************************
'***************** MOTOR Initailization ******************
'****************************************************************

MOTOR_INIT :
' L293 Motor Driver Initialization
LOW MOTOR_1A_PLUS
LOW MOTOR_2A_MINUS
LOW STEER_3A_PLUS
LOW STEER_4A_MINUS
Return

'****************************************************************
'************** LED Direction Initailization *************
'****************************************************************

LED_INIT :
HIGH L_LED
HIGH M_LED
HIGH R_LED
Return

'****************************************************************
'****************** Interrupt Handler Routine *****************
'****************************************************************

Disable
SW_OFF :
GoSub MOTOR_INIT
GoSub LED_INIT
INTCON.1 = 0
Resume SWITCH_ON
Enable

'****************************************************************
'********************* The End *******************
'****************************************************************

End

He is asking advise about light follower not line follower, but you have a good code anyway and some members will benefit from it.
 
Re: light follower robot

Hello glenjoy

Is that reply for the sake of points collection, the easy way.

This project took me months of hard work, then you came saying that Its a line follower, light follower needed.
 

light follower robot

THANKS metal for your code and glenjoy for your advocate
but i haven't receive my answer yet
can my robot turn to human
pleas don't contest
sorry for my english
 

light follower robot

what do you mean "turns to human" its a sifi quistion ro you want it to track and follow a human.
 

Re: light follower robot

Hi,

arash_micro said:
THANKS metal for your code and glenjoy for your advocate
but i haven't receive my answer yet
can my robot turn to human
pleas don't contest
sorry for my english

Ok, the idea is that you first need to find the light and then to folow it. so first you neet to find the light. what you do is use a simple photo detector and 2 motores for X and Y. You start to move the X motor left and see if the output from the sensor ( with the ADC ) is getting stronger you are on the right way, or getting weaker ( you are on the wrong way ). If you are on the right way, then keep forwared until you start getting a weaker signal. Then go back few steps to max.
Then you start moving the Y motor on the way that you did with the X. Untill you reach the max level signal. This is your light source.
To track it, when the signal changes from the sensor, then you start the search again.

Good luck.
 

light follower robot

Hi gidimiz
thanks for your guid
but i have done all of them in analog
 

Re: light follower robot

Hi,

arash_micro said:
Hi gidimiz
thanks for your guid
but i have done all of them in analog

So where is the problem? please re define your question and also explain what you want to do with the "human" part...
 

Re: light follower robot

Hello

You can use passive infra red sensors to follow homans, but in that case it will follow every object that radiates infra red, including light bulbs ;)

Any thing else you need you are welcome.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top