caramoan tour package

caramoan tour package

Author Topic: differential line follow queries  (Read 732 times)

Offline taliez

  • Size AAA Battery
  • ***
  • Posts: 71
  • Pogi/Ganda Points: 5
differential line follow queries
« on: November 22, 2011, 11:30:55 PM »
 

hi all

 ongoing po  line follow projectko , thanks nga pala kay ***** for the assistance

start ko muna sa code .. actually have it running na pero di pa sa track

parang medyo  malakas cya (gamit ko sa dc motor ng tumbling car same as sir tiktak)

pano ko po ma kocontrol yung speed ng dc motor?  by code or by a component?

TY in advance

Philippine Electronics Forum

differential line follow queries
« on: November 22, 2011, 11:30:55 PM »

Offline taliez

  • Size AAA Battery
  • ***
  • Posts: 71
  • Pogi/Ganda Points: 5
Re: differential line follow queries
« Reply #1 on: November 22, 2011, 11:49:06 PM »


to pala code ko... suggestion are very welcomed

Code: [Select]
#include <htc.h>

#ifndef _XTAL_FREQ
#define _XTAL_FREQ 4000000
#endif
 

__CONFIG(FOSC_INTOSCIO & WDTE_OFF & MCLRE_OFF & BOREN_OFF & LVP_OFF);
__CONFIG(FCMEN_OFF & IESO_OFF);

void main()
{
OSCCON = 0x68;
ANSEL = 0x00;
TRISA = 0x00;
TRISB = 0x07;
PORTB = 0x00;

__delay_ms(2000);
PORTA = 0x0F;
__delay_ms(250);
PORTA = 0x00;
__delay_ms(250);
PORTA = 0x05;
__delay_ms(250);
PORTA = 0x0A;
__delay_ms(250);
PORTA = 0x05;
__delay_ms(250);
PORTA = 0x0A;
__delay_ms(250);
PORTA = 0x09;
__delay_ms(250);
PORTA = 0x06;
__delay_ms(250);
PORTA = 0x09;
__delay_ms(250);
PORTA = 0x06;
__delay_ms(250);
PORTA = 0x00;
__delay_ms(250);
PORTA = 0x01;
__delay_ms(250);
PORTA = 0x02;
__delay_ms(250);
PORTA = 0x04;
__delay_ms(250);
PORTA = 0x08;
__delay_ms(250);
PORTA = 0x00;
__delay_ms(250);
PORTA = 0x0F;
__delay_ms(250);
PORTA = 0x00;
__delay_ms(250);


while(1)
{


while (PORTB == 0x07) // all sense logic 1 //
{
PORTA = 0x00; // standby motor //

}

while (PORTB == 0x02) // center sensor logic 1 //
{
PORTA = 0x0A; // forward //

}
while (PORTB == 0x04) // left sensor logic 1 //
{
PORTA = 0x02; // turn left //

}
while (PORTB == 0x01) // right sensor logic 1  //
{
PORTA = 0x08; // turn right //

}
while (PORTB==0x00) // no sense //
{
PORTA = 0x05;   // reverse //

}
}
 }   

Philippine Electronics Forum

Re: differential line follow queries
« Reply #1 on: November 22, 2011, 11:49:06 PM »

Offline RiDdLeR???

  • Hydroelectric
  • ***
  • Posts: 3033
  • Pogi/Ganda Points: 208
Re: differential line follow queries
« Reply #2 on: November 22, 2011, 11:58:18 PM »
Antay mo response nung mga masters sa line following.

Pero eto yung sa akin  ... idea lang hindi ko pa actual na nasubukan ha.

1. H/W :You have to use some PWM.  Kung gamit mo l293d, you connect a pnp transistor dun sa motor supply pin to control the supply voltage.  You have to control the pnp transistor using a pwm signal.  The pwm signal can be generated by the mcu that you use.

2. S/W:  You simulate pwm through code or make some sort of pseudo pwm.  For a certain logic input, you turn on the motor for a specified amount of time and then turn it off.  Since most probably naman naka forever loop ka, this will seem like pwm control.

Lets say portb input ay 0b101, so imbes na output porta = 0101, pwede siyang
porta = 0101 (forward motor)
__delay_ms(200)
porta = 0000 (stop motor)
__delay_ms(100)

Timplahin mo and play with the delays to get the right speed you want.

in code it could look like this:

w/o speed control
Code: [Select]
while (portb == 0b101){
porta = 0101;
}

with speed control:
Code: [Select]
while (portb == 0b101) {
porta = 0b0101;  //forward
__delay_ms(200);
porta = 0b0000; //stop
__delay_ms(100);
}

Philippine Electronics Forum

Re: differential line follow queries
« Reply #2 on: November 22, 2011, 11:58:18 PM »

Offline taliez

  • Size AAA Battery
  • ***
  • Posts: 71
  • Pogi/Ganda Points: 5
Re: differential line follow queries
« Reply #3 on: November 23, 2011, 12:02:29 AM »
thanks sir alyas  ha .... ;) ;) ;)

oki cg try ko nga.... ;D ;D ;D

Philippine Electronics Forum

Re: differential line follow queries
« Reply #3 on: November 23, 2011, 12:02:29 AM »

Offline taliez

  • Size AAA Battery
  • ***
  • Posts: 71
  • Pogi/Ganda Points: 5
Re: differential line follow queries
« Reply #4 on: November 23, 2011, 01:13:48 AM »
PORTA = 0x00; // standby motor //
 __delay_ms(250);

ganito boss?

Philippine Electronics Forum

Re: differential line follow queries
« Reply #4 on: November 23, 2011, 01:13:48 AM »

Offline taliez

  • Size AAA Battery
  • ***
  • Posts: 71
  • Pogi/Ganda Points: 5
Re: differential line follow queries
« Reply #5 on: November 27, 2011, 12:03:24 PM »

 1st try mga igan
 


Offline RiDdLeR???

  • Hydroelectric
  • ***
  • Posts: 3033
  • Pogi/Ganda Points: 208
Re: differential line follow queries
« Reply #6 on: November 27, 2011, 12:10:04 PM »
Uyyy! congrats ... pogi points sa yo!  Naunahan mo pa ako gumawa ng LF mobot.  Kaya lang para namang mabagal masyado  ...  bilisan mo kaya ng konti.  Konting tweaks pa siguro sa code lalu na dun sa sharp left turn.

Ano gamit mong track?  Electrical tape lang ba yan?

Offline taliez

  • Size AAA Battery
  • ***
  • Posts: 71
  • Pogi/Ganda Points: 5
Re: differential line follow queries
« Reply #7 on: November 27, 2011, 12:26:21 PM »


parang yan talga speed nya ala namang delays sa forward sa ,  kabigatan ata ng mobot ..heheh
dc motor to ng tumbling car gamit ko kasya sa twin motor gearbox eh

suggestions po te

eto code


Code: [Select]
#include <htc.h>

#ifndef _XTAL_FREQ
#define _XTAL_FREQ 4000000
#endif
 

__CONFIG(FOSC_INTOSCIO & WDTE_OFF & MCLRE_OFF & BOREN_OFF & LVP_OFF);
__CONFIG(FCMEN_OFF & IESO_OFF);

void main()
{
OSCCON = 0x68;
ANSEL = 0x00;
TRISA = 0x00;
TRISB = 0x07;
PORTB = 0x00;

 



__delay_ms(2000);
PORTA = 0x0F;
__delay_ms(300);
PORTA = 0x00;
__delay_ms(300);
PORTA = 0x0A;
__delay_ms(300);
PORTA = 0x09;
__delay_ms(300);
PORTA = 0x05;
__delay_ms(300);
  PORTA = 0x05;
__delay_ms(300);
PORTA = 0x06;
__delay_ms(300);
PORTA = 0x09;
__delay_ms(300);
PORTA = 0x06;
__delay_ms(300);
PORTA = 0x00;
__delay_ms(300);
PORTA = 0x01;
__delay_ms(300);
PORTA = 0x02;
__delay_ms(300);
PORTA = 0x04;
__delay_ms(300);
PORTA = 0x08;
__delay_ms(300);
PORTA = 0x00;
__delay_ms(300);
PORTA = 0x0F;
__delay_ms(300);
PORTA = 0x00;
__delay_ms(300);



while(1)
{
 
  while (PORTB == 0x07) //  111 //
{
PORTA = 0x00; // stop //
}

while (PORTB == 0x02) // 010 //
{
         PORTA = 0x06; // forward //
}


while (PORTB == 0x04) // 100 turn right //
{
 
PORTA = 0x00; // stop //
__delay_ms(100);
      PORTA = 0x04; // right //
  __delay_ms(150);
 
}

while (PORTB == 0x06) // 110 turn right//
{
__delay_ms(100);
PORTA = 0x00; // stop //
__delay_ms(150);
      PORTA = 0x04; // right //
  __delay_ms(100);
 
}

while (PORTB == 0x01) // 001 turn left //
{
__delay_ms(100);
PORTA = 0x00; // stop //
__delay_ms(150);
  PORTA = 0x02; //  //
__delay_ms(100);

  }

while (PORTB == 0x03) // 011 turn left //
{
__delay_ms(100);
PORTA = 0x00; // stop //
__delay_ms(150);
PORTA = 0x02; //  //
__delay_ms(100);
}
while (PORTB == 0x07) //  111 //
{
__delay_ms(100);
PORTA = 0x00; // stop //
__delay_ms(100);
PORTA = 0x09; // revere //
__delay_ms(100);
}
}

}
 

Offline taliez

  • Size AAA Battery
  • ***
  • Posts: 71
  • Pogi/Ganda Points: 5
Re: differential line follow queries
« Reply #8 on: November 28, 2011, 09:00:09 PM »
2nd try

Offline tiktak

  • Gas Turbine
  • **
  • Posts: 2863
  • Pogi/Ganda Points: 204
  • Gender: Male
    • Tiktakx's Blog
Re: differential line follow queries
« Reply #9 on: November 28, 2011, 09:34:16 PM »
ayos +1 sayo
8051 stuff

Offline taliez

  • Size AAA Battery
  • ***
  • Posts: 71
  • Pogi/Ganda Points: 5
Re: differential line follow queries
« Reply #10 on: November 28, 2011, 09:52:54 PM »
ayos +1 sayo

imitation yan ng lf mu boss tiktak heheehe
tsaka salamat kay ate ***** sa tulong......


question kung IR and Phototrans gagamitin ko sa sensors same lang po ba yung schem?

Offline tiktak

  • Gas Turbine
  • **
  • Posts: 2863
  • Pogi/Ganda Points: 204
  • Gender: Male
    • Tiktakx's Blog
Re: differential line follow queries
« Reply #11 on: November 28, 2011, 10:15:50 PM »
yup same lang

___
yung test track square din  ;D
8051 stuff

Offline taliez

  • Size AAA Battery
  • ***
  • Posts: 71
  • Pogi/Ganda Points: 5
Re: differential line follow queries
« Reply #12 on: November 28, 2011, 11:07:48 PM »
try ko oval track soon..... heheheh

Offline taliez

  • Size AAA Battery
  • ***
  • Posts: 71
  • Pogi/Ganda Points: 5
Re: differential line follow queries
« Reply #13 on: November 29, 2011, 10:21:26 PM »
imitation yan ng lf mu boss tiktak heheehe
tsaka salamat kay ate ***** sa tulong......


question kung IR and Phototrans gagamitin ko sa sensors same lang po ba yung schem?

i meant this phototrans boss



same pa rin po ba middle is the reading part? both sides gnd?

Offline taliez

  • Size AAA Battery
  • ***
  • Posts: 71
  • Pogi/Ganda Points: 5
Re: differential line follow queries
« Reply #14 on: November 30, 2011, 01:43:05 AM »
done... na mata ni "bobot" post ko later nag low batt kasi cam..hehe

Offline taliez

  • Size AAA Battery
  • ***
  • Posts: 71
  • Pogi/Ganda Points: 5
Re: differential line follow queries
« Reply #15 on: November 30, 2011, 09:51:18 PM »
parang mlakas kain ng batt sa new sensors ni bobot ,is it the PT and the IR?

Philippine Electronics Forum

Re: differential line follow queries
« Reply #15 on: November 30, 2011, 09:51:18 PM »

 

Privacy Policy

Contact Us: elabph@yahoo.com