Society of Robots - Robot Forum

Software => Software => Topic started by: RITESH29 on October 25, 2011, 12:59:12 AM

Title: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 25, 2011, 12:59:12 AM
hi guys,

I have decided to make a line follower robot which sound easier but viewing the arena of it.
makes me confuse how to make control over robot for deciding the right path as give here in end.
http://www.grafest2011.com/pdf/line.pdf (http://www.grafest2011.com/pdf/line.pdf)


any help will be appreciated,
thanks
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 25, 2011, 01:24:35 AM
It is possible to use camera and image recognition to recognise T junctions. As path is known in advance, You can define where to turn when junction is approached.

Simpler approach would be to use IR Emitter/Detector sensors. Sensors on the rear of the robot would ensure that bot is on the track and sensors on the front side would be used for junction detection.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 25, 2011, 02:23:42 AM
Quote
It is possible to use camera and image recognition to recognize T junctions. As path is known in advance, You can define where to turn when junction is approached.

I don't want to make it complex at begging...

Quote
Simpler approach would be to use IR Emitter/Detector sensors. Sensors on the rear of the robot would ensure that bot is on the track and sensors on the front side would be used for junction detection.

How pls explain and i am using parallax quick start board Spin code...


Thanks
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 25, 2011, 05:46:36 AM
Quote
Simpler approach would be to use IR Emitter/Detector sensors. Sensors on the rear of the robot would ensure that bot is on the track and sensors on the front side would be used for junction detection.

How pls explain and i am using parallax quick start board Spin code...
As shown in the image below, IR Sensors can be placed next to robot corners (depends on the width of the line it has to follow). Such configuration lets robot understand if the line followed is dead under it. If robot drifts to one side or the other, sensor will be triggered sending signal to the MCU to adjust bot's position so that none of the sensors are detecting white (black) line. So, for robot steering You can use rear end sensors.

Now, for junction detection You can use front end sensors, because when junction is approached, right of left sensor will be triggered letting MCU know that there is right/left turn available.

There are many different implementations of IR Detector/Emitter pairs for line following, this is just a very rough explanation of basic principle.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 26, 2011, 02:57:41 AM
HI again,

I want a solution regarding repeating loop and testing condition( spin code)
for eg:-
If defied inputs are matched with statement the outputs goes high in one loop but repeating this loop 2nd time the uC should again check this condition and work...

Till now i have used CASE, IF else statement and waitpeq....they only work once after this they 2nd check condition .

please reply and figure out the problem.

NOTE:- I am testing the inputs to uC with DIP not using sensors just for now and all outputs are seen on paralax QS board LED.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 26, 2011, 03:38:05 AM
I'm not sure if I understand You.

If condition in matched once --> something happens.
If same check is done and condition is matched again --> the same thing happens again.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 26, 2011, 06:47:57 AM
Hi again,
OK, Do you know spin codes??
propeller uC??

And If i want to add a PID controller to my robots what shouldi do for that??
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 26, 2011, 07:06:20 AM
I know Propeller uC as of now, because I've just finished reading Wiki about it  ;D No matter that, controll algorithms are programing language independent, so it does not matter what language You use.

I still don't follow You as first You asked something related to if statements and now You are talking about PID.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 26, 2011, 07:20:10 AM
Quote
I still don't follow You as first You asked something related to if  statements and now You are talking about PID.

OK, please forget of PID at the movement.

I was testing my code in uC board itself.....
I was trying to write code with dozen of case or if else statement and waitpeq ( wait for pin too go as per logic it pause the up i.e. Cog) these all are syntax.

The code was working well on first attempt mean 1st loop ..after continuing second loop it forget the condition and run on previous value.

I am using DIP switch which are  taking position of LDR sensors just for testing code.!!
So, problem is that the code should check the condition in every loop and process the output not blind outputs.


Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 26, 2011, 07:55:33 AM
code was working well on first attempt mean 1st loop ..after continuing second loop it forget the condition and run on previous value.
Here we go, now I get it  :) To be perfectly honest, I have never done anything related to Spin code or Parallax, so probably I'll be of little use for You. If You run same code in a loop and code is set to read value of the pin every time it is executed, then it should do that. By any chance You could post Your code here, or at least the part of code which implements the loop and pin reading.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 26, 2011, 09:18:46 AM
It is something like this:-
VAR
 BYTE A                                                    ' DECLARING A  VARIABLE NAME

PUB LINE                 
A:=INA[16..20]                                           '16 17 18 19 20 AS INPUTS PINS
DIRA[16..22]:= % 0000011              '  0 FOR INPUTS 1 FOR     % FOR BINARY DIGIT

CASE A
        00100: OUTA[21..22]                ' MOVE STRAIGHT
        00010: OUTA[21]                      ' MOVE RIGHT


LIKE THIS.........................
...................
           
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 26, 2011, 04:25:50 PM
So where is the actual loop which You use to read the pin?
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 26, 2011, 10:31:52 PM
Hello again,


I am taking help from parallax forum for code help...
so, please help me to design a good mechanical structure which don't exceed 24cm x 24cm.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 26, 2011, 10:37:58 PM
I will use 2 motors http://robokits.co.in/shop/index.php?main_page=product_info&cPath=2&products_id=247&zenid=982d36c3dbc1594633528a42af15cce2 (http://robokits.co.in/shop/index.php?main_page=product_info&cPath=2&products_id=247&zenid=982d36c3dbc1594633528a42af15cce2) of 375RPM and Li..battery http://robokits.co.in/shop/index.php?main_page=product_info&cPath=13&products_id=69&zenid=6ba297ea6900ec4fc09d1f8e8648af0b (http://robokits.co.in/shop/index.php?main_page=product_info&cPath=13&products_id=69&zenid=6ba297ea6900ec4fc09d1f8e8648af0b)......
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 27, 2011, 01:40:50 AM
It is something like this:-
VAR
 BYTE A                                                    ' DECLARING A  VARIABLE NAME

PUB LINE                  
A:=INA[16..20]                                           '16 17 18 19 20 AS INPUTS PINS
DIRA[16..22]:= % 0000011              '  0 FOR INPUTS 1 FOR     % FOR BINARY DIGIT

CASE A
        00100: OUTA[21..22]                ' MOVE STRAIGHT
        00010: OUTA[21]                      ' MOVE RIGHT


LIKE THIS.........................
...................
          
But seriously where is the loop, all I see is Case that gets executed once. If it's a mock-up code - I don't need it, what I need is actual code from Your project.

please help me to design a good mechanical structure which don't exceed 24cm x 24cm.
Robot in the image above is 240mm x 240mm, so it fits the specs. It is driven by 4 motors (servos), so some feedback is necessary to make sure all 4 wheels keep the same speed. What sort of drive do You have in mind yourself? Is it the one You've sketched?
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 27, 2011, 05:17:21 AM
Code: [Select]
VAR

  BYTE A ' DECLARING A VARIABLE NAME

PUB LINE

  DIRA[16..22]:= %0000011 ' 0 FOR INPUTS 1 FOR % FOR BINARY DIGIT

  REPEAT
    A := INA[16..20] '16 17 18 19 20 AS INPUTS PINS
    CASE A
      %00100: OUTA[21..22] := %11 ' MOVE STRAIGHT
      %00010: OUTA[21] := 0 ' MOVE RIGHT

I have got it from here http://forums.parallax.com/showthread.php?135399-How-to-make-alogrith-for-a-artificial-intelligence-line-follower.&p=1046929#post1046929 (http://forums.parallax.com/showthread.php?135399-How-to-make-alogrith-for-a-artificial-intelligence-line-follower.&p=1046929#post1046929)


Quote
Robot in the image above is 240mm x 240mm, so it fits the specs. It is driven by 4 motors (servos), so some feedback is necessary to make sure all 4 wheels keep the same speed. What sort of drive do You have in mind yourself? Is it the one You've sketched?

The sketch is drawn by me the robot size can be small also but not exceed.....

I am using 2 motors only given in above link.

Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 27, 2011, 07:34:21 AM
Code: [Select]
VAR

  BYTE A ' DECLARING A VARIABLE NAME

PUB LINE

  DIRA[16..22]:= %0000011 ' 0 FOR INPUTS 1 FOR % FOR BINARY DIGIT

  REPEAT
    A := INA[16..20] '16 17 18 19 20 AS INPUTS PINS
    CASE A
      %00100: OUTA[21..22] := %11 ' MOVE STRAIGHT
      %00010: OUTA[21] := 0 ' MOVE RIGHT

I have got it from here http://forums.parallax.com/showthread.php?135399-How-to-make-alogrith-for-a-artificial-intelligence-line-follower.&p=1046929#post1046929 (http://forums.parallax.com/showthread.php?135399-How-to-make-alogrith-for-a-artificial-intelligence-line-follower.&p=1046929#post1046929)
This code is different from what You've posted before. In this one I see the loop in which pin is checked constantly.

The sketch is drawn by me the robot size can be small also but not exceed.....

I am using 2 motors only given in above link.
Well, if You have rough sketch already - then start working on dimensions and material of the robot. Using CAD software would help You big time.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 27, 2011, 07:39:53 AM
Quote
This code is different from what You've posted before. In this one I see the loop in which pin is checked constantly.

Yes, off course these are right code.....


Quote
Well, if You have rough sketch already - then start working on dimensions and material of the robot. Using CAD software would help You big time.

OK, I am new to CAD please tell any link to download and start it as i am Electrical and Electronics student....
and will this 2 motors will be alright??
http://www.google.co.in/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&hl=en&source=hp&biw=1440&bih=668&q=freee+download+Cad+software&btnG=Google+Search]
[url]http://www.google.co.in/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&hl=en&source=hp&biw=1440&bih=668&q=freee+download+Cad+software&btnG=Google+Search (http://[url)[/url]
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 27, 2011, 07:49:22 AM
Yes, off course these are right code.....
If this is the right code, why did You post wrong code before?

OK, I am new to CAD please tell any link to download and start it as i am Electrical and Electronics student....
Well, Google (http://www.google.co.in/search?q=open+source+cad+software&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&hl=en&source=hp&biw=1440&bih=668&oq=open+source+cad+software&aq=f&aqi=g7g-v1g-j2&aql=1&gs_sm=e&gs_upl=14757l20452l0l20686l24l22l0l7l7l0l203l1797l7.6.2l15l0) is a good start  ;)

and will this 2 motors will be alright??
I don't know weight of Your bot and radius of it's wheels, hence i cannot know.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 27, 2011, 08:24:18 AM
Quote
If this is the right code, why did You post wrong code before?

Hi again,
Because i was not aware of the instuction some people on another forum have figure out the syntax error.

Quote
I don't know weight of Your bot and radius of it's wheels, hence i cannot know.

Bot Specifications
Dimensions and Fabrication
Autonomous bot -
1. Only one autonomous bots per team are allowed. A team may enter with only 1 autonomous bot.
2. The top view of each autonomous bot must fit within a square of dimensions 240mm x 240mm (l x b).
3. Bot must be started individually by only 1 on board switch. However, a team may have a separate on board switch for restart.
4. The autonomous bot(s) must be stable and must stand on its own at the beginning of the run when put in the starting point. Bots not fulfilling this criterion will be disqualified.
5. During the run, the autonomous bot can expand itself provided it does not damage the arena in anyway. However, it is not allowed to leave anything behind or make any marks while traversing the arena. Bot found damaging the arena will be immediately disqualified. The final decision is at the discretion of the organizers.
6. The autonomous bot should not separate or split into two or more units. All bot/units which are touching each other or are in the starting point will be considered as one bot.
The teams are allowed to use ready-made micro-controller boards/ready-made sensor kits. However they are not allowed to use lego kits or any similar assemblies.


I have give the link of motor in above post it has images of motor and tire and battery also.
the size of Tyre is 6cm diameter and .5cm width...
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 27, 2011, 11:20:16 AM
I have give the link of motor in above post it has images of motor and tire and battery also.
the size of Tyre is 6cm diameter and .5cm width...
OK, so wheel radius is 3cm, however, I still don't know weight of the robot to answer the question about motor suitability.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 27, 2011, 10:14:16 PM
Quote
OK, so wheel radius is 3cm, however, I still don't know weight of the robot to answer the question about motor suitability.


Hi again,

I have again the link which tell mooter wt. and battery wt.

the total wt. will be around 500-800gm i think.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 28, 2011, 12:35:23 AM
the total wt. will be around 500-800gm i think.
If:
then torque of the motor should be around 0.53kgf.cm. Motors You've chosen are rated @ 1.9kgf.cm - so they are all right. Motor seller states that motors are rated @ 375rpm, this gives You 4.23km/h (3.85feet/s), if that is satisfactory - You are good to go.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 28, 2011, 02:32:22 AM
Quote
Motor seller states that motors are rated @ 375rpm

The 375 RPM is of no load so it will decrease.....
if the speed create a problem we will add some series resistance, etc.... 
please give me a good design so that today i can ordered it in my local market ( they don't make robot only boxes of etc uses)

One more question how should i charge my lithium  battery, i have not buy any ready made charger for it.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 28, 2011, 03:06:04 AM
The 375 RPM is of no load so it will decrease.....
According to details you've provided - each motor has almost 4x more torque than it's required; You are going to use 2x motors, hence ~8x more torque than it's required. Knowing that - RPM will not fall much.

if the speed create a problem we will add some series resistance, etc....
Bad idea, as voltage drop created by resistor will not only decrease RPM, it will also reduce torque. As You'll be using microcontroller (unless You hope to build beam bot line follower which can make decisions on every junction (which would be really difficult to achieve (if possible at all))), it's a good idea to drive motors using PWM; that way You can controll motor speed without sacrificing torque.

please give me a good design so that today i can ordered it in my local market ( they don't make robot only boxes of etc uses)
Completing design stage is homework that has to be done by You and only You, because You and only You know exactly what You want to achieve and implement. There are many line follower designs online to assist You. Start by using Your best friend Google (http://www.google.co.uk/search?q=line+follower+design&hl=en&gs_sm=e&gs_upl=811l4321l0l5475l9l7l1l0l0l0l172l782l2.4l6l0&um=1&sa=N&tab=iw&oq=line+follower+design&aq=f&aqi=g-v2g-b2&aql=1)  ;) Also, good design takes long time to develop, hence do not expect other people to do it for You. When You have primary design ready, specific question can be asked in forum in order to perfect it.

One more question how should i charge my lithium  battery, i have not buy any ready made charger for it.
You cannot charge Li-Ion battery without a proper charger. Charging Li-Ion without setting something on fire is art in its own right. Charging single Li-Ion cell is relatively difficult, when it comes to battery packs, one has to employ witchcraft  ;D So, either You have to buy ready made charger, or be really competent in electronics to build one Yourself.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 28, 2011, 03:16:41 AM
Quote
You cannot charge Li-Ion battery without a proper charger. Charging Li-Ion without setting something on fire is art in its own right. Charging single Li-Ion cell is relatively difficult, when it comes to battery packs, one has to employ witchcraft  Grin So, either You have to buy ready made charger, or be really competent in electronics to build one Yourself.

So, what should I do for charging battery without any hazard??
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 28, 2011, 03:21:17 AM
Buy an approved LI-Ion charger that is rated for the battery You want to charge.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 28, 2011, 03:33:57 AM
OK< please tell me circuit or some link will that link will work that i have give robotkits.co.in
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 28, 2011, 03:43:58 AM
Mate, You have to do decent amount of research before You start any project. Previously You've posted a link to battery pack You are willing to use, go to that page and You will find compatible chargers.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 28, 2011, 04:17:10 AM
OK, you suggest me to buy which chargers
http://robokits.co.in/shop/index.php?main_page=index&cPath=13 (http://robokits.co.in/shop/index.php?main_page=index&cPath=13)
Thanks
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 28, 2011, 04:30:03 AM
OK, you suggest me to buy which chargers
http://robokits.co.in/shop/index.php?main_page=index&cPath=13 (http://robokits.co.in/shop/index.php?main_page=index&cPath=13)
Thanks
:D No, this is not the page You posted before, plus it's not even linked to the battery You want to use.

I will use 2 motors http://robokits.co.in/shop/index.php?main_page=product_info&cPath=2&products_id=247&zenid=982d36c3dbc1594633528a42af15cce2 (http://robokits.co.in/shop/index.php?main_page=product_info&cPath=2&products_id=247&zenid=982d36c3dbc1594633528a42af15cce2) of 375RPM and Li..battery http://robokits.co.in/shop/index.php?main_page=product_info&cPath=13&products_id=69&zenid=6ba297ea6900ec4fc09d1f8e8648af0b (http://robokits.co.in/shop/index.php?main_page=product_info&cPath=13&products_id=69&zenid=6ba297ea6900ec4fc09d1f8e8648af0b)......
Do You remember this post? Good. Now, follow the link and read  ;)
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 28, 2011, 04:52:23 AM
Quote
Do You remember this post? Good. Now, follow the link and read  Wink

It show Compatible Chargers

    * Li-Ion / Li-Po Intelligent Fast Charger for 2-3 Cell Battery(RKI-1122)
    * Li-Ion / Li-Po 2A 3 Cell Fast Charger
    * IMAX B6 5A Multipurpouse Battery Charger


should i buy that Rs 650/. cost one??
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 28, 2011, 05:20:39 AM
OK, i have downloaded Google sketch up software also....
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 28, 2011, 05:22:14 AM
It show Compatible Chargers

    * Li-Ion / Li-Po Intelligent Fast Charger for 2-3 Cell Battery(RKI-1122)
    * Li-Ion / Li-Po 2A 3 Cell Fast Charger
    * IMAX B6 5A Multipurpouse Battery Charger
You've found it  ;D Well done  ;D

should i buy that Rs 650/. cost one??
I believe You meant Rs 6500  ;) It's up to You to decide. Description is very clear. If You need smart multipurpose charger, go for something like IMAX B6 5A Multipurpouse Battery Charger (http://robokits.co.in/shop/index.php?main_page=product_info&cPath=13&products_id=221). If charger is going to be used only for Li-Ion packs containing up to 3 cells, then Li-Ion / Li-Po Intelligent Fast Charger for 2-3 Cell Battery (http://robokits.co.in/shop/index.php?main_page=product_info&cPath=13&products_id=133) is fully sufficient.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 28, 2011, 05:23:34 AM
OK, i have downloaded Google sketch up software also....
Good start. CAD skills are very useful to posses.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 28, 2011, 05:37:23 AM
One thing more charger are asking for input of 15v not 220V why??
Do you think the chargers deserve the cost or not??
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 28, 2011, 06:32:23 AM
Here some CAD images please tell any changes to do........
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 28, 2011, 06:37:00 AM
One thing more charger are asking for input of 15v not 220V why??
Both of them do not take 220VAC, only DC voltage is a suitable input. Suitable power supply has to be used in order to operate them.

Do you think the chargers deserve the cost or not??
Honestly, i don't know, as I never bought one. You can always look around the net and try to find something cheaper without sacrificing performance.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 28, 2011, 06:39:42 AM
Here some CAD images please tell any changes to do........
If You think that it's fine, then it is fine. You do realise that frame you've designed is not symmetrical, don't You?
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 28, 2011, 06:45:28 AM
Quote
If You think that it's fine, then it is fine. You do realize that frame you've designed is not symmetrical, don't You?

As it was my first attemt to use the CAD i can see it is not geometrical ......

Please tell any changes to do in the designing making it more col.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 28, 2011, 06:51:09 AM
As it was my first attemt to use the CAD i can see it is not geometrical ......

Please tell any changes to do in the designing making it more col.
I told you already, it's not symmetrical, hence it has to be fixed. Moreover, as posted before, have a look at what designs other people have used for their line followers, then try to achieve something similar.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 29, 2011, 10:52:21 PM
Updated images:-
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 31, 2011, 10:49:43 AM
Will this model work fine for a line follower...??
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on October 31, 2011, 11:01:10 AM
You are fast, well done  :)

Does it have a caster wheel at the back?

What are You going to use for line recognition?
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on October 31, 2011, 11:10:17 AM
Quote
You are fast, well done  Smiley

Hi again,

Do you like it??
Quote
Does it have a caster wheel at the back?

Yes, off course..!!
Quote
What are You going to use for line recognition?

The length is nearby 14cm (140mm) and breath is 12cm ( 120mm)....

OK< the circuit you can see in image is LM339 ( Quat op-amp) ...
with 100K variable resistance act as i Wheatstone bridge to terminal of op-amp....

and uC is quick start board containing propeller chip...( spin code)
and sensors are LDR with green LED's.





Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: Gertlex on November 01, 2011, 08:10:18 PM
To briefly comment on your question about whether your chassis is good... I've seen pretty much every possible robot configuration used for line following (even hexapods).  So ya, that looks like a nice simple and easy to work with chassis to throw the electronics on.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 02, 2011, 09:02:07 AM
OK, i am using L298 chip for h- bridges any suggestion will be appreciated..!!

Thanks
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 02, 2011, 10:34:52 AM
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...
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 03, 2011, 01:24:34 AM
OK, the output from pin 2 and 3 is rising properly but the current is very low when i connect the load like buzzer and motor the voltage level decrease to 1V or less and motor does not seems work...........
same with buzzer very less sound..!!
pls suggest me what to do??
I have connected pin 1 and 15 to gnd with resistance and with out it also but no changes were seen.

pls reply soon...........
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 03, 2011, 02:21:28 AM
According to L298 Datasheet (http://www.cse.dmu.ac.uk/~mgongora/Resources/L298N.pdf) You should connect pins as follows:
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 03, 2011, 02:34:45 AM
Quote
Set Pin 5 OR 7 (In1 OR In2) to run motor1 (Pin 10 OR 11 - motor2) to one side OR the other (NEVER  set both Pins high at the same time)

First thanks for reply.........

OK, the i have done both pin higher just for checking....!!
after that i have connected one to -ve 5V and another to GND vice versa.

the voltage on multimeter is working well but i think current is very low.....i think in few mA...


Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 03, 2011, 02:58:12 AM
pls help.............
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 03, 2011, 03:15:59 AM
Quote
Set Pin 5 OR 7 (In1 OR In2) to run motor1 (Pin 10 OR 11 - motor2) to one side OR the other (NEVER  set both Pins high at the same time)

First thanks for reply.........

OK, the i have done both pin higher just for checking....!!
after that i have connected one to -ve 5V and another to GND vice versa.

the voltage on multimeter is working well but i think current is very low.....i think in few mA...
I meant Pins 12 OR 10 (NOT Pin 10 OR 11) to run motor.

Can You sketch (with circuit designer if possible) current configuration You have, so I can see what You have and what might be wrong?

What motor are You using?
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 03, 2011, 03:24:27 AM
Hi again,

I am using past motor only ( given link in past post) any way its stall current is 700mA..
and i am using first bridges....
not the end one that you are talking about pin 10 and 12.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 03, 2011, 03:29:22 AM
Did You set Pin 6 high?

How many power supplies are You using?
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 03, 2011, 04:12:28 AM
 OK, thanks for guiding.....

The chip is working it was soldering problem..

so, i have 3 op-amp i want to use it to raise the 3.3v to 4.2V at least to drive  the l298 chip....as uC output is 3.3V ( it work on 3.3V propeller)
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 03, 2011, 04:24:32 AM
3.3V should be enough, as anything above 1.5V is logical 1 (high) for L298.

If it was soldering problem, did You fix it? Is it working as it is supposed to work now?
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 03, 2011, 06:29:53 AM
Quote
If it was soldering problem, did You fix it? Is it working as it is supposed to work now?

OK, now again after fixing it....when i connect the enable to gnd motor still run in same direction....
pls post a simple circuit!!

It is going over my head...
thanks
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 03, 2011, 06:49:49 AM
when i connect the enable to gnd motor still run in same direction....
Enable (Pin 6) has to be connected to 3.3V, otherwise it will not work.

When In1 (Pin 5) is HIGH - 3.3V and In2 (Pin 7) is LOW - 0V --> motor spins to one side.

When In2 (Pin 7) is HIGH - 3.3V and In1 (Pin 5) is LOW - 0V --> motor spins to the opposite side.

Also, did You connect 4 diodes to motor terminals as shown in L298 Datasheet (http://www.cse.dmu.ac.uk/~mgongora/Resources/L298N.pdf) - Page 6, Figure 6?


Edit: Some useful info about L298 can be found in Experiment 7 - Bi-directional Control Of Motors And The H-Bridge (http://www.learn-c.com/experiment7.htm) page.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 03, 2011, 10:10:00 AM
OK, now 298 is working as i want but should i connect any resistance or buffer to 298 enable and input pins???
while connecting uC to 298 directly will cause any hazard or not??
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 03, 2011, 11:46:14 AM
OK, now 298 is working as i want [...]
Well done  ;) Why didn't it work before?

[...] but should i connect any resistance or buffer to 298 enable and input pins??? while connecting uC to 298 directly will cause any hazard or not??
As long as You don't go over 7V for Your logics and use quick recovery diodes to block EMF from motors - You're fine.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 03, 2011, 09:10:16 PM
Quote
Why didn't it work before?

I think there must be a problem .....( can't guess)

OK, i was just checking the input pins rating while connecting 12Kohms resistance the 298 was working perfect then i change voltage from 5V to 1V at 1V to 2.5V the 298 was not working but after 2.6V it start working ....I have connected the logic suplly voltage to 5V then also it was working...!!

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 leds?? and if IR then which  IR receiver diode one or TSOP 1738 one (  wires)
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 04, 2011, 02:31:52 AM
Using LDR for line following is not the best decision, as change in light conditions will greatly affect performance (although it is possible to overcome these issues).

The better option, as You already mentioned, is to use IR Emitter/Detector pairs, which, speaking plain, are pairs of IR LEDs and IR phototransistors (IR sensors do not work well with masking tapes, so if line to follow is going to be made of one, consider Your choices well). They can be used with:

Schmitt Trigger option is more efficient.


Have a look at these articles to get deeper insight on what You want to use:
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 04, 2011, 07:15:14 AM
But IR led switching at 38Khz........but here it is not used why???
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 04, 2011, 07:40:57 AM
But IR led switching at 38Khz........but here it is not used why???
I'm not sure I understand what You ask for.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 04, 2011, 08:10:40 AM
Quote
I'm not sure I understand what You as for.

As in fig you can see there is no source of 38khz switching freq. which is required for IR led......
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 04, 2011, 10:00:12 AM
As in fig you can see there is no source of 38khz switching freq. which is required for IR led......
You don't necessarily need frequency modulation (if You have that in mind).
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 04, 2011, 10:50:24 AM
Quote
You don't necessarily need frequency modulation (if You have that in mind).

After checking 3 different IR lED i came to know that IR can work without any switching freq. ( common used 38Khz) i was watching with digital camera all are glowing like visible LED ..

But why in remote control we use switching freq. for IR led??
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: rbtying on November 04, 2011, 01:09:48 PM
Remote controls switch at 38KHz primarily to make it easier to filter out the noise from background light--the receiver is often pointed towards a window, so being able to pick only the 38KHz signal helps to significantly improve the SNR. This is not nearly as much of an issue for line following, since the main light source is the LED.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 04, 2011, 03:08:54 PM
Quote
You don't necessarily need frequency modulation (if You have that in mind).

After checking 3 different IR lED i came to know that IR can work without any switching freq. ( common used 38Khz) i was watching with digital camera all are glowing like visible LED ..

But why in remote control we use switching freq. for IR led??
I think we don't speak about the same thing... Do You ask about IR circuit used for line following or for remote control?
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 04, 2011, 09:00:00 PM
Quote
Remote controls switch at 38KHz primarily to make it easier to filter out the noise from background light--the receiver is often pointed towards a window, so being able to pick only the 38KHz signal helps to significantly improve the SNR. This is not nearly as much of an issue for line following, since the main light source is the LED.

Hi again,

Thanks for the light on my doubt.
Quote
Do You ask about IR circuit used for line following or for remote control?

I got my answer ........
and IR is working well then LDR & easy to use..!!
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 05, 2011, 01:32:05 AM
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........
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 05, 2011, 08:10:12 AM
You have to tell us what is not working well. What do You expect it to do on certain condition and what it actually does?
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 05, 2011, 08:28:16 AM
First the event is on Monday........!!So we have to be fast.

In my circuit the output from 339 is working as on black surface the output is partial zero..0.5V nearby.
and on white it goes to 3.5 depend on surface..!
while vcc was 4.0V from 1 Li-cell.

So, should i add chip like 7414??
or any changes in value of resistance ??

and when i connect the circuit with Vcc 3.3V of uC...
the output seen in LED of uC is not working well.
Note:- Code are right no error.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 09, 2011, 07:05:27 AM
How was competition?  :)
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 10, 2011, 04:24:06 AM
Quote
How was competition?  Smiley

Hi again,

well every thing was fine my motor was running well while testing code.
but my code was not so good enough in testing condition of sensors
so, i have to complete it.
If we talk about completion my Bot was not ready and the others guys who has got the Bot was fully Ready made buy from company as it is.

they have done only coding part.
There was one more guy with his team who has also brought robot by self hard work it was also not working ( incomplete)
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 10, 2011, 06:47:46 AM
You were going the right way with it, however, You did not leave Yourself enough time to finish it. Just finish it now, so next time You have more knowledge.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 10, 2011, 07:36:41 AM
OK, as my IR circuit was totaly different as in society of Robots so can tell me how to make more sensitive circuits for R sensors.......
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 10, 2011, 07:43:53 AM
OK, as my IR circuit was totaly different as in society of Robots so can tell me how to make more sensitive circuits for R sensors.......
To start with, i don't know what circuit You used  ;D Why didn't You use circuit from SoR? It's simple and very effective.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 10, 2011, 11:14:40 AM
Hi ,

I was using simple comparator with Wheatstone bridges as posted earlier (post71)  ...
actually i was not able to get why SOR was using a feedback Resistance??
can you explain the schematic working?? why it is more effective than my basic comparator..!!
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 10, 2011, 12:37:54 PM
Why use comparator at all? Look at the circuit below:

(http://www.societyofrobots.com/images/schematics_infraredemitdetbas.jpg)

R2 and T1 creates voltage divider. If You measure voltage between them when IR LED rays are detected by T1, You get around 0V as T1 is fully ON. When IR LED rays are not detected - T1 is fully OFF, hence voltage between T1 and R2 is going to be around Vcc.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 11, 2011, 09:21:32 AM
Quote
R2 and T1 creates voltage divider. If You measure voltage between them when IR LED rays are detected by T1, You get around 0V  as T1 is fully ON. When IR LED rays are not detected - T1  is fully OFF, hence voltage between T1 and R2 is going to be around Vcc.

I think this schematic will mot be so power full without comparators??
and if i will do freq. modulation of 38Khz will this effect in its working  more precise??
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 11, 2011, 12:45:19 PM
What do You mean by "more powerfull"? What do You want to achieve with comparator? What do You want to achieve with modulation?
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 11, 2011, 11:55:44 PM
Quote
What do You mean by "more powerfull"? What do You want to achieve with comparator? What do You want to achieve with modulation?

It should be more sensitive..............
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 12, 2011, 03:01:21 AM
some one suggest me while using IR with 38Khz its absorbing and performance  will increase and efficient, is this true??
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 12, 2011, 03:44:07 AM
Quote
There can be with some CMOS digital inputs because if the voltage is between logic states, both transistors in a totem pole will be conducting, and it could get hot.

One more suggestion from an engg.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 12, 2011, 06:01:09 PM
Could You post a circuit which You are willing to use?
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 13, 2011, 12:26:06 AM
Here it is:-

http://www.societyofrobots.com/schematics_infraredemitdet.shtml (http://www.societyofrobots.com/schematics_infraredemitdet.shtml)
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 14, 2011, 05:04:30 AM
In this circuit i don't understand the use of feedback resistance..
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 14, 2011, 05:39:10 AM
Hello again  :)

(http://www.societyofrobots.com/images/schematics_infraredemitdetamp.jpg)

In the circuit You pointed me to Op-Amp is used as Non-Inverting amplifier (http://www.electronics-tutorials.ws/opamp/opamp_3.html). R3 and R4 creates voltage divider (http://www.electronics-tutorials.ws/resistor/res_3.html) which feeds only part of the output voltage back to inverting pin of an Op-Amp. As Op-Amp tries to hold potencial voltage difference of inverting and non-inverting pin at 0V, it increases output as required. So, if Your R3 = R4, then feedback voltage will be exactly 1/2 of the output voltage, to compensate the difference between input pins Op-Amp will increase output voltage 2 times making difference = 0V.

Play around with this Non-Inverting Op-Amp circuit (http://www.falstad.com/circuit/#%24+1+5.0E-6+10.20027730826997+50+5.0+50%0AR+304+144+256+144+0+0+40.0+5.0+0.0+0.0+0.5%0Aa+304+160+448+160+1+1000.0+-1000.0+1000000.0%0Ar+304+224+304+272+0+1000.0%0Ag+304+272+304+288+0%0Aw+448+160+448+224+0%0Aw+448+160+496+160+2%0Aw+304+224+304+176+0%0A174+448+224+320+224+0+2000.0+0.5+Resistance%0Aw+320+224+304+224+0%0Aw+384+240+384+256+0%0Aw+384+256+448+256+0%0Aw+448+256+448+224+0%0A).
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 14, 2011, 06:08:02 AM
Quote
In the circuit You pointed me to Op-Amp is used as Non-Inverting amplifier. R3 and R4 creates voltage divider which feeds only part of the output voltage back to inverting pin of an Op-Amp. As Op-Amp tries to hold potencial voltage difference of inverting and non-inverting pin at 0V, it increases output as required. So, if Your R3 = R4, then feedback voltage will be exactly 1/2 of the output voltage, to compensate the difference between input pins Op-Amp will increase output voltage 2 times making difference = 0V.

Hi again,

So using feedback will give any advantage then simple comparator as used by me earliers??
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 14, 2011, 06:42:01 AM
So using feedback will give any advantage then simple comparator as used by me earliers??
These are very different circuits with different parts in them. The circuit You showed before uses Comparator which will change from low to high (or vice versa) when 1.65V threshold is passed. The circuit in SoR page (the one with an Op-Amp) uses, well... an Op-Amp and NOT the Comparator (yes, they look the same, but are different things). So, the second circuit is used to amplify voltage coming from phototransistor and resistor voltage divider. Both circuits will work if colour difference of line to be followed and the ground around it is well defined (say, white line, black ground around it and there are no greys in between). Your circuit is OK and it would perform the same way as a circuit I posted before (only You don't use comparator making circuit more simple to implement, cheaper as well and taking less space), however them two circuits are not immune to noise (changing lighting conditions, slightly varying colours of line and ground around it). To get that immunity, you have to implement Schmitt Trigger to Your comparator based circuit, this will give You well defined transitions between high and low which are immune to signal noise and inaccuracies (to some extent).

(http://pcbheaven.com/wikipages/images/theschmitttrigger_1265549431.png) (http://pcbheaven.com/drcalculus/index.php?calc=st_nonsym_sp)
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 14, 2011, 07:00:05 AM
OK, Now what the different in this ckt..........
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 14, 2011, 07:16:57 AM
OK, Now what the different in this ckt..........
This is a Schmitt Trigger circuit which can be incorporated into Your IR circuit.

Edit: Read through Page 1 and Page 2 of The Schmitt Trigger (http://pcbheaven.com/wikipages/The_Schmitt_Trigger/?p=0) tutorial so that You better understand how it is going to benefit Your line follower.
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: RITESH29 on November 14, 2011, 07:54:36 AM
There is 7414 chip for that........
Title: Re: How to make alogrith for a artificial intelligence line follower.....??
Post by: newInRobotics on November 14, 2011, 08:14:19 AM
You can use IC chip as well, it does not matter, apart from missing on learning part.
Nowadays, there is an IC for almost anything  ;D