Shop OBEX P1 Docs P2 Docs Learn Events
How to make alogrith for a artificial intelligence line follower. - Page 2 — Parallax Forums

How to make alogrith for a artificial intelligence line follower.

2

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-10-30 07:24
    Look at the menu bar at the top of every Parallax forum webpage. There's a button labelled OBEX. It's the Propeller OBject Exchange. If you want to write your own PID routines, use the Wikipedia for information ... there's more than enough theory and examples to get started.
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-10-31 09:55
    Will this model work fine for a line follower...??
    1024 x 1365 - 88K
    1024 x 768 - 59K
    1024 x 768 - 60K
  • Mike GreenMike Green Posts: 23,101
    edited 2011-10-31 10:54
    As long as you have some kind of propulsion that can steer and some way to mount photo sensors to detect a line on the floor, you could probably build a line following robot out of it. Your photos show the wheels and batteries for propulsion along with a platform for photo sensors. Whether this will "work fine" for a line following robot or not depends on the things you haven't shown or described.

    The construction of the chassis is very nicely done. It looks like essentially all of it was made from a single sheet of metal, cut and folded with a few fasteners. Is it stiff enough where the motors and wheels are mounted? You might consider some kind of strap across the front as a stiffener where the motors and wheels are mounted.
  • ercoerco Posts: 20,256
    edited 2011-10-31 13:18
    Most anything can be made to work at low to moderate velocities. A Scribbler goes fairly slow here: http://www.youtube.com/watch?v=XUteXTxXSAY

    For maximum speed, chassis geometry & sensor quantity location are critical, as is the software to control it. Here's one ridiculously fast demo for the 3pi robot: http://www.youtube.com/watch?v=mJV-KDqHgDQ You can see it accelerate to higher speeds in the longer straightaways. At those speeds, traction, weight and rotational mass make a huge difference.

    The type of line (wide vs. narrow, curved vs straight + 90-degree turns, etc) is a factor worth considering for your robot's physical configuration.
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-01 07:58
    Most anything can be made to work at low to moderate velocities. A Scribbler goes fairly slow here: http://www.youtube.com/watch?v=XUteXTxXSAY

    For maximum speed, chassis geometry & sensor quantity location are critical, as is the software to control it. Here's one ridiculously fast demo for the 3pi robot: http://www.youtube.com/watch?v=mJV-KDqHgDQ

    Hi,

    I have seen that video and other .....
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-01 08:01
    Whether this will "work fine" for a line following robot or not depends on the things you haven't shown or described.

    HI again,

    So what should i describe more pls tell......
    Is it stiff enough where the motors and wheels are mounted?

    I have measured the size The motor and tires are feet in the box...( or robot)
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-01 09:06
    Hi again,

    I have checked the PM of motor it was not so fast with single of 4.2V....
    that want i from 375RPM motor..!!

    OK,Now come to hardware is there any requirement of connecting any buffer or not??
    Because i am not using any H bridges...only transistor like BC547 or 588...


    Thanks
  • Mike GreenMike Green Posts: 23,101
    edited 2011-11-01 10:00
    1) If you turn a motor on and off using a transistor, the amount of current drawn by the motor has to be less than the maximum allowed current for the transistor ... See the transistor's datasheet for the value. Remember that a motor can draw several times the "normal" current when the motor is under heavy mechanical load and the transistor has to chosen based on that.

    2) A H-Bridge is used so the motor can be reversed. If you don't need the motor to run in reverse, you may not need an H-Bridge.

    The Wikipedia is a very good resource. It has been translated into many languages as well. For example, there's a good section on H-Bridges.
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-01 20:38
    A H-Bridge is used so the motor can be reversed. If you don't need the motor to run in reverse, you may not need an H-Bridge.

    I think there is no need to reverse the motor in line follower...??

    And pls suggest any transistor and what should i do to isolate the uC..??
    one more question i am using 4.2V cell , propeller board work on 3.3V i don't have any regulator below 7805 or 317 a variable one...
    there are two supply on the board 4.4V near by and regulated 3.3V so where should i connect the 4.2V cell to Board, will to that opp. to GND pin on board ( 4.4V )??
  • Mike GreenMike Green Posts: 23,101
    edited 2011-11-01 21:41
    "I think there is no need to reverse the motor in line follower ... ??" That's your choice. Having reversible motors allows more flexibility and the ability to make sharp turns with one motor going forward and the other in reverse.

    Look at the Nuts and Volts Columns, in particular #6 which discusses the use of transistors to control small motors, relays, and solenoids. It was written for the Stamps, but the same ideas apply to the Propeller. The only difference is that the voltages on the microcontroller are 3.3V rather than 5V for the Stamps. Since bipolar transistors are current driven, you just have to change the base resistor values so that there's roughly the same amount of base current with the 3.3V of the Propeller. Use Ohm's Law.

    You didn't say what board you're using. Assuming you're using a QuickStart Board, there are pins on J1 and J3 for Vin and Ground. That's where you should connect your 4.2V battery. Look at the QuickStart schematic which you can download from Parallax (here).
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-02 08:04
    OK, so i have got L298 chip for h- bridges any suggestion will be appreciated..!!

    I already have schematic of QS board..!!
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-02 09:33
    Hi,

    I have got L298 chip for h- bridges the problem is what the use of logic supply pin 9voltage??
    Is that mean at what logic the bridges will work If yes then i have connected to 5V..
    and current sensing pin 1 to GND without any resistance...
    Out put 1 and 2 to motor terminal just for testing small motor pin 2 and 3...
    and input spin to GND and Vcc for testing pin 5 and 7...
    till now i am not using output 3 and 4....
    supply voltage is 12V 800mA max.

    edited: the problem is the motor is not rotating...
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-11-02 10:32
    Hi Ritesh,

    I haven't every used L298 chips.

    I typed this into Google: L298 propeller site:forums.parallax.com/

    Hopefully you can find your answers there.

    I've only used SN754410 chips to drive motors.

    I looked at the L298 datasheet, watch out for "Vss" which is used for "Logic Supply Voltage" (4.5V to 7.0V). I think it's very strange they use Vss that way.

    I'm not sure if 3.3V will be enough to drive the logic lines on the L298 chip. You might need a level shifter (a transitor should work) on the logic lines.

    Sorry I can't help much with the L298.

    I think your 4.4V battery pack should be okay to power the QS board (yes, use Vin next to Vss). Do you use the labels I included?

    Duane
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-02 20:19
    Do you use the labels I included?

    Hi again Sir,

    I use both label and schematic of QS board...!!
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-03 09:07
    Hi again,

    The 298 chip is now working fine......
    pls suggest me how to connect it to QS board as uC (propeller work on 3.3V0
    somebody suggest me that 298 will work fine on 3.3V..
    and while connecting sensors LDR( from 339 op -amp) to QS board should be there any pull ups resistance
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-11-03 11:46
    I haven't made a line following robot with the Propeller.

    The book Robotics with the Boe-Bot v2.2 has a section about using LDRs with a Basic Stamp. Chapter 6 has the LDR information. It starts on page 193 (page 207 of the pdf).

    Duane
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-03 20:14
    Pls suggest me on this:-

    SO, working with LDR for line follower is creating a problem while testing:-
    1.) the response time was very less..
    2.) I can't check properly which ldr is working due to light interface..!!
    as i am using 100K variable resistance at 26-27Kohms ...........

    Pls tell should i continue with LDR or just have IR led?? and if IR then which IR receiver diode one or TSOP 1738 one ( wires)
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-11-03 20:38
    Ritesh,

    Hopefully someone with more experience using LDRs will answer your questions.

    Here are a couple of items I think would be useful in making a line following robot.

    Parallax's IR Line Follower Kit (kind of expensive at $39.99, but it has 8 sensors).

    Here's another Parallax Kit ($29.99 but only 4 sensors instead of 8).

    I've used these sensors from SparkFun to read black and white stripes on a motor encoder. (I think the $2.95 price is pretty good.)

    You can also purchase the bare QRE1113 sensor for $1.95.

    All the sensors I just listed include an IR LED. I think these are the type of sensors usually used with line following robots.

    Duane
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-04 07:12
    OK, Now iam using IR led fore robot should i use uC for 38Khz freq. from QS board or 555 Chip??
    and which transistor will be best for 5 IR LED..!!
  • FranklinFranklin Posts: 4,747
    edited 2011-11-04 13:19
    It is really impressive that you are trying to do this but some of your questions are easy to answer with a little help from a search engine. Why not do some research on your own first rather than asking questions on every aspect of the project? As you modify your code and design you should also post that so others can see how you are progressing.
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-05 00:38
    I was testing my circuit using multimeter......it is working fine with it.
    But testing with uC( quick start board) the output is not working well.....I have have tested my code with DIP switch in place of sensor output all code are right i don't know what problem in it........
    962 x 641 - 43K
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-05 03:36
    Pls guys help me on Monday is the event.!!
  • FranklinFranklin Posts: 4,747
    edited 2011-11-05 11:51
    Pls guys help me on Monday is the event.!!

    How can we help without the code you are trying to run?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-11-05 11:56
    Ritesh,

    I'd like to help but I've never used the parts you are using.

    If you are having trouble with the code I could probably help with it.

    The componted labeled "339 I.C.", I assume that is a LM339 comparitor?

    Can you give more information about what voltages you measure with your meter and how the IC is connected to the Propeller?

    I doubt I will be able to help, but maybe someone with experience with comparitors could help if you provided some more details.

    Duane
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-06 10:17
    Hi again sir,
    The component labeled "339 I.C.", I assume that is a LM339 comparator?

    Yes, it is LM339..
    If you are having trouble with the code I could probably help with it.

    Please tell how to add counter with if or case statement i don't have enough time to find in manual.....
    ( as i want to make a counter which will count at certain condition of sensors as in maze robot)


    Thanks
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-11-06 11:02
    Please tell how to add counter with if or case statement i don't have enough time to find in manual.....
    ( as i want to make a counter which will count at certain condition of sensors as in maze robot)

    I'm not really sure what you mean.

    Here's an example based on my best guess of what you want to do.
    CON
      _clkmode = xtal1+pll16x
      _xinfreq = 5_000_000
       
      _FirstPin = 16
      _LastPin = 20
      _AllWhite = %1111
      _AllBlack = %0000
      _LinesToPass = 5
      
    VAR
      long countAllBlack, countAllWhite, countOther
      long previousState, pins
      
    PUB Loop | localCharacter
      previousState := _AllWhite ' you need to decide what the best starting value is
      
      repeat 
        pins := ina[_FirstPin.._LastPin]
        case pins
          _AllBlack:
            if previousState <> _AllBlack
              countAllBlack++
          _AllWhite:
            if previousState <> _AllWhite
              countAllWhite++
          other:
            countOther++
        previousState := pins    
        if countAllBlack > _LinesToPass
          AllLinesPassed
    PUB AllLinesPassed
      'Do something after all lines have been passed.
                    
    

    I'm guessing you want to count states of the sensors, but probably only when they change.

    Duane
  • PublisonPublison Posts: 12,366
    edited 2011-11-06 17:45
    Duane Degn wrote: »
    I'm not really sure what you mean.

    Here's an example based on my best guess of what you want to do.
    CON
      _clkmode = xtal1+pll16x
      _xinfreq = 5_000_000
       
      _FirstPin = 16
      _LastPin = 20
      _AllWhite = 11
      _AllBlack = 00
      _LinesToPass = 5
      
    VAR
      long countAllBlack, countAllWhite, countOther
      long previousState, pins
      
    PUB Loop | localCharacter
      previousState := _AllWhite ' you need to decide what the best starting value is
      
      repeat 
        pins := ina[_FirstPin.._LastPin]
        case pins
          _AllBlack:
            if previousState <> _AllBlack
              countAllBlack++
          _AllWhite:
            if previousState <> _AllWhite
              countAllWhite++
          other:
            countOther++
        previousState := pins    
        if countAllBlack > _LinesToPass
          AllLinesPassed
    PUB AllLinesPassed
      'Do something after all lines have been passed.
                    
    

    I'm guessing you want to count states of the sensors, but probably only when they change.

    Duane

    Duane, your a saint for hanging in there, but if found this to be a little offensive from the poster:
    i don't have enough time to find in manual.....

    Our friend NEEDS to spend some time in the manuals instead of demanding information that is available through a Google search as Franklin has pointed out.

    It's almost Monday.
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-06 22:33
    OK, I am driving motor from propeller chip by using 298 as H bridges motor...
    all are working fine problem is the motor is not revolving in both direction i have change the port out put from =%01 to =%10 but i work in same direction i am not using any pull up resistance at input pins of 298..!!
    here is mode code:-
    CON

    Delay = 3_000_000

    PUB Toggle

    dira[0..1]:=%01 'Set I/O pin to output direction
    repeat 'Repeat following endlessly
    !outa[0..1] ' Toggle I/O Pin
    waitcnt(Delay + cnt) ' Wait for Delay cycles

    pls reply fast any one watching this thread.
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-06 22:46
    After using this code same result....
    CON

    Delay = 3_000_000

    PUB Toggle

    dira[0..1]:=%11 'Set I/O pin to output direction
    repeat 'Repeat following endlessly
    outa[0..1] := ' Toggle I/O Pin
    waitcnt(Delay + cnt) ' Wait for Delay cycles
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-11-06 23:06
    guys it is working..............
Sign In or Register to comment.