caramoan tour package

caramoan tour package

Author Topic: My Differential Line Follower  (Read 7184 times)

Offline tiktak

  • Gas Turbine
  • **
  • Posts: 2859
  • Pogi/Ganda Points: 203
  • Gender: Male
    • Tiktakx's Blog
My Differential Line Follower
« on: July 19, 2009, 02:24:35 PM »
Schematic:


Code: [Select]
#include <pic.h>
#include <htc.h> // Required to interface with delay routines

#ifndef _XTAL_FREQ
 // Unless already defined assume 4MHz system frequency
 // This definition is required to calibrate __delay_us() and __delay_ms()
 #define _XTAL_FREQ 4000000
#endif
__CONFIG(XT & WDTDIS & PWRTDIS & UNPROTECT);

#define TURN_LEFT 0b00000010
#define TURN_RIGHT 0b00001000
#define MOVE_FORWARD 0b00001010
#define MOVE_BACKWARD 0b00000101

void init (void)
{
 TRISA = 0xF0;
 TRISB = 0xE7;
 PORTB = 0xE7;
}

void PWM1 (void)
{
 RB3 = 1;
 RB4 = 1;
 __delay_ms(100);

 RB3 = 0;
 RB4 = 0;
 __delay_ms(150);
}


void main (void)
{
 unsigned char sensor;
 unsigned char prev_command = 0x01;
 init();

  while(1)
   {
    PWM1();
      sensor = (PORTB & 0x07);
switch(sensor)
{
case 0x00: //000 - move forward
PORTA = MOVE_BACKWARD;
prev_command = MOVE_BACKWARD;
break;
case 0x01: //001
PORTA = TURN_RIGHT;
prev_command = TURN_RIGHT;
break;
case 0x02: //010
PORTA = MOVE_FORWARD;
  prev_command = MOVE_FORWARD;
break;
case 0x03: //011
PORTA = TURN_RIGHT;
prev_command = TURN_RIGHT;
break;
case 0x04: //100
PORTA = TURN_LEFT;
prev_command = TURN_LEFT;
break;
case 0x05: //101
PORTA = prev_command;
break;
case 0x06: //110
PORTA = TURN_LEFT;
prev_command = TURN_LEFT;
break;
case 0x07: //111
PORTA = MOVE_BACKWARD;
break;
default:
PORTA = prev_command;
break;
}
    }
}
actual:

sensor (galing sa mouse  ;D)
8051 stuff

Philippine Electronics Forum

My Differential Line Follower
« on: July 19, 2009, 02:24:35 PM »

Offline tiktak

  • Gas Turbine
  • **
  • Posts: 2859
  • Pogi/Ganda Points: 203
  • Gender: Male
    • Tiktakx's Blog
Re: My Differential Line Follower
« Reply #1 on: July 19, 2009, 02:44:07 PM »
8051 stuff

Philippine Electronics Forum

Re: My Differential Line Follower
« Reply #1 on: July 19, 2009, 02:44:07 PM »

Offline tiktak

  • Gas Turbine
  • **
  • Posts: 2859
  • Pogi/Ganda Points: 203
  • Gender: Male
    • Tiktakx's Blog
Re: My Differential Line Follower
« Reply #2 on: July 23, 2009, 07:49:48 PM »
pinned na pala ang thread na to ;D :D
8051 stuff

Philippine Electronics Forum

Re: My Differential Line Follower
« Reply #2 on: July 23, 2009, 07:49:48 PM »

Offline _Jiro

  • CR2032 Battery
  • **
  • Posts: 36
  • Pogi/Ganda Points: 0
Re: My Differential Line Follower
« Reply #3 on: July 28, 2009, 12:45:33 AM »
Ilang battery ginamit jan? :D

Philippine Electronics Forum

Re: My Differential Line Follower
« Reply #3 on: July 28, 2009, 12:45:33 AM »

Offline RaffT

  • Technical People
  • Hydroelectric
  • *****
  • Posts: 3440
  • Pogi/Ganda Points: 103
  • Gender: Male
  • more on R-n-D
    • MY Bots
Re: My Differential Line Follower
« Reply #4 on: July 28, 2009, 07:27:08 AM »
nice one tiktak ;)

school project or TRIP lang? ;D
Learning is CooL! BEAM robotics/DIY UCD180/PSP/AC wtmtr/digiESRmtr/PICkit™2 clone/SGTC/SSTC/DR-SSTC

Never argue with an idiot... They'll take you down to their level and beat you with experience

Philippine Electronics Forum

Re: My Differential Line Follower
« Reply #4 on: July 28, 2009, 07:27:08 AM »

Offline tiktak

  • Gas Turbine
  • **
  • Posts: 2859
  • Pogi/Ganda Points: 203
  • Gender: Male
    • Tiktakx's Blog
Re: My Differential Line Follower
« Reply #5 on: July 28, 2009, 09:11:01 AM »
Trip lang hehe, isang 9v para sa circuit, at 4 na AA para sa motor
8051 stuff

Offline _Jiro

  • CR2032 Battery
  • **
  • Posts: 36
  • Pogi/Ganda Points: 0
Re: My Differential Line Follower
« Reply #6 on: July 28, 2009, 12:49:26 PM »
Umm.. Ung 4xAA nkakonek sa pin4 ng l298? Sapat na b ung pra mapatakb0 ng mabilis ung m0t0r?

Offline tiktak

  • Gas Turbine
  • **
  • Posts: 2859
  • Pogi/Ganda Points: 203
  • Gender: Male
    • Tiktakx's Blog
Re: My Differential Line Follower
« Reply #7 on: July 29, 2009, 11:19:51 PM »
yup yun ang connected sa pin4 ng L298, mabilis na yun patakbuhin ang motor, mahirap atang gumawa ng mabilis na mobot madalas mawala sa track ;D mabilis yan pag diretso, pero kung titignan mo sa program meron dun yung parte na nag ko control sa speed ng motor dinedelay ko para di sya gaanong mabilis :D
8051 stuff

Offline Woots29

  • Solar Power Satellite
  • *****
  • Posts: 5466
  • Pogi/Ganda Points: 344
  • Gender: Male
  • asan si mojacko?
    • Woots Page
Re: My Differential Line Follower
« Reply #8 on: September 06, 2009, 12:51:53 PM »
+1 ayus!
WootsPC2 Videos  Woots Page

Offline ♪ ♫ ♫ ♪ ♪ ♪ ♫ ♫ ♫

  • Hydroelectric
  • ***
  • Posts: 3439
  • Pogi/Ganda Points: 123
  • Truth suffers, but never dies.
Re: My Differential Line Follower
« Reply #9 on: September 06, 2009, 12:56:56 PM »
okay a kaya ang very tight na turns...
It's difficult to see the picture when you're inside the frame.

Offline voltaman_krc

  • Size C Battery
  • *****
  • Posts: 176
  • Pogi/Ganda Points: 4
  • Gender: Male
  • aruuuuu!
Re: My Differential Line Follower
« Reply #10 on: December 18, 2009, 10:12:37 PM »
ung chassis ng car.. i saw it before, ung tinitinda ni manong. hehe! great post!!
usb kayo ng usb.... "FLASH DRIVE" ang tawag dun.

Offline amitie

  • LR44 Battery
  • *
  • Posts: 3
  • Pogi/Ganda Points: 0
Re: My Differential Line Follower
« Reply #11 on: January 29, 2010, 01:26:11 PM »
ano po bang value ng transistor dyan po
tnx po.

Offline tiktak

  • Gas Turbine
  • **
  • Posts: 2859
  • Pogi/Ganda Points: 203
  • Gender: Male
    • Tiktakx's Blog
Re: My Differential Line Follower
« Reply #12 on: January 29, 2010, 01:34:58 PM »
yung transistor ay photodiode yun ;D tinamad lang iedit sa tamang symbol :D, yung galing sa mga lumang mouse ginamit ko dyan
8051 stuff

Offline Tarkov24

  • Size C Battery
  • *****
  • Posts: 234
  • Pogi/Ganda Points: 3
  • Gender: Male
Re: My Differential Line Follower
« Reply #13 on: February 01, 2010, 11:07:23 PM »
ano ung mcu nito master?
BANANA YELLOW IS A HAPPY COLOR!!!

Offline tiktak

  • Gas Turbine
  • **
  • Posts: 2859
  • Pogi/Ganda Points: 203
  • Gender: Male
    • Tiktakx's Blog
Re: My Differential Line Follower
« Reply #14 on: February 02, 2010, 04:14:37 PM »
16F84A lang yan ;D
8051 stuff

Offline Tarkov24

  • Size C Battery
  • *****
  • Posts: 234
  • Pogi/Ganda Points: 3
  • Gender: Male
Re: My Differential Line Follower
« Reply #15 on: February 02, 2010, 07:31:13 PM »
16F84A lang yan ;D

wow! anong compiler ginamit mo sir master? btw.. what if ganito po ung gearbox na gamitin ko

pero ung codes nyo po gagamitin ko to program the mcu...will it work?
BANANA YELLOW IS A HAPPY COLOR!!!

Offline tiktak

  • Gas Turbine
  • **
  • Posts: 2859
  • Pogi/Ganda Points: 203
  • Gender: Male
    • Tiktakx's Blog
Re: My Differential Line Follower
« Reply #16 on: February 02, 2010, 07:36:52 PM »
Hi tech C po yan, yup that would work, kahit sensor at opamp nga lang eh wala ng MCU
also check master glutnix tank mobot here
8051 stuff

Offline Tarkov24

  • Size C Battery
  • *****
  • Posts: 234
  • Pogi/Ganda Points: 3
  • Gender: Male
Re: My Differential Line Follower
« Reply #17 on: February 02, 2010, 07:47:12 PM »
hhhmmm... nakakainspire toh...hehehe. thanks sir... i might start working on it this friday evening.hehehe.
BANANA YELLOW IS A HAPPY COLOR!!!

Offline tiktak

  • Gas Turbine
  • **
  • Posts: 2859
  • Pogi/Ganda Points: 203
  • Gender: Male
    • Tiktakx's Blog
Re: My Differential Line Follower
« Reply #18 on: February 02, 2010, 08:07:37 PM »
hehe wala kasing ganyang chassis dito sa province kaya ginamit ko yan tumbling car na tinda sa bangketa ;D ;D ;D pictures ha post mo din :D
8051 stuff

Offline Tarkov24

  • Size C Battery
  • *****
  • Posts: 234
  • Pogi/Ganda Points: 3
  • Gender: Male
Re: My Differential Line Follower
« Reply #19 on: February 02, 2010, 08:38:07 PM »
yes sir! once na matapos ko un post ko pics. salamat pala sa codes in advance.hehehe. OT: san pala province mo sir?
BANANA YELLOW IS A HAPPY COLOR!!!

Philippine Electronics Forum

Re: My Differential Line Follower
« Reply #19 on: February 02, 2010, 08:38:07 PM »

 

Privacy Policy

Contact Us: elabph@yahoo.com