Node counter by the ir sensor in a line

Kindly someone help me the cord of line counting robot using ir YL-70 , i would like to know how it is done thanks.

Getting Stuff done for me…
You’re in the wrong part of the forum, there’s a specific section for getting things done without any effort.

The forum generally works on the principle that you collect as much info as possible, give it your best effort, and only then - post that here as informed by the guidelines.
Many helpers will help you overcome your weaknesses and suggest possible methods for you to build on your skills.

1 Like

Hi,
Is this related to this?

Tom... :smiley: :+1: :coffee: :australia:

Have done my best sarch all media but just what am encountered is just line follower if i find a smilar program i can larn an interpret on it, have done all my best thats why i would like to get a help from thise site. Thanks

Yeah its related to it.....

you must explicitly demonstrate the effort

you

have put into it.

You must prove that you have made your

own attempt

This is exclusively and only about the fact that you post

your own program.

What's so hard to understand about that???!!!

The longer you wait with showing your own effort the less the users here believe you that you want to do some own effort.

You should post a code as a code-section (like shown in the other thread)

And then mark that line in your code where you assume detecting a node might be coded.

Add a few lines of your basic idea how counting a node might can be done.

Then what was the purpose of the group some of us are not ict programmers we are electricians we try our best and aask for help whenever we are overwhelmed, but am not seing eny help hear just demoralizing the user :cry:

You started this thread in a manner that was asking for the max without telling something about your situation. Even with telling something about your situation:
showing no own effort !

It took you about 20 posts to at least write

Again: As soon as you start showing some own effort the real support will rush in.
But I guess you are just too lazy to even write down a 20 sentence long description of:

  • how many members your group has

  • what "elecricians" exactly means (40 year old guys faced with some education about automation or 15 year-old just started my electrician-education)

  • the exact microcontroller that you are using

  • links to datasheets of used components

  • asking for links to initial tutorials
    starting to read at least 3 sentences of such a tutorial coming back with a link to this tutorial and asking what this or that tecnical term in the tutorial means.

You are still expecting to get a ready to use code delivered.

At least me I will not deliver that.

Be the change you want to see in the world
best regards Stefan

Hi @chepketemon ,

one way to really get help is to describe where your problems start.

addition: showing your own effort by posting some links you tried
https://www.google.de/search?as_q=Arduino+line+follower+robot

https://www.google.de/search?q=Arduino+line+follower+l298+ir+led

https://www.google.de/search?q=Arduino+mega++line+follower

but the results I got there do not cover how to count lines

Can somebody suggest better suited keywords with which I might find a link to a code that does count crossing lines?

I'm very sure mutliple people would have posted suggestions.

possible answer:
alternaive or similar words for counting lines might be "detect crossings"
or "crossing detection"

https://www.google.de/search?q=Arduino+mega++line+follower+detect+crossings

https://www.google.de/search?q=Arduino+Line+follower+with+crossing+detection

the second google-search has this link in the hits

You might find the code way too difficult to understand

void check() {
  switch (irSensors) {

    // jalan maju
    case B11000011:
      maju();
      break;

    case B11000111:
      maju();
      break;

    // kalibrasi maju

    case B11000010:
      CW();
      break;

    case B11000001:
      CCW();
      break;

    case B10000010:
      kanan();
      break;

    case B01000001:
      kiri();
      break;

    case B10000001:
      CCW();
      break;

    case B01000010:
      CW();
      break;

    case B10000011:
      CCW();
      break;

    case B01000011:
      CW();
      break;

    // jalan kanan
    case B11101111:
      kanan();
      break;

    case B11011111:
      kanan();
      break;

    case B11001111:
      kanan();
      break;

    case B00001111:
      kanan();
      break;

    case B00011111:
      kanan();
      break;

    case B00101111:
      kanan();
      break;

    case B01001111:
      kanan();
      break;

    // kalibrasi kanan
    case B00000011:
      CCW();
      break;

      case B00011001:
      kanan();
      break;

    case B10001111:
      kanan;
      break;

    case B01001101:
      CCW();
      break;

    case B00000010:
      CCW();
      break;

    case B10001110:
      CW();
      break;

    case B11001110:
      CCW();
      break;

    case B11001101:
      CCW();
      break;

    case B11001011:
      CW();
      break;

    case B00001011:
      CW();
      break;

    case B00000111:
      CCW();
      break;

    case B11001001:
      mundur();
      break;

    case B00001001:
      mundur();
      break;

    case B00000110:
      maju();
      break;

    case B00000101:
      CCW();
      break;

    case B00001010:
      CW();
      break;

    case B00001101:
      CCW();
      break;

    case B00001110:
      CW();
      break;

    // perempatan


    default:
      berhenti();

  }
  delay(1);
}

void maju() {
  analogWrite(RPWMa, spd);
  analogWrite(LPWMb, spd);
  analogWrite(RPWMc, spd);
  analogWrite(LPWMd, spd);
  analogWrite(LPWMa, 0);
  analogWrite(RPWMb, 0);
  analogWrite(LPWMc, 0);
  analogWrite(RPWMd, 0);
}

void mundur() {
  analogWrite(LPWMa, spd);
  analogWrite(RPWMb, spd);
  analogWrite(LPWMc, spd);
  analogWrite(RPWMd, spd);
  analogWrite(RPWMa, 0);
  analogWrite(LPWMb, 0);
  analogWrite(RPWMc, 0);
  analogWrite(LPWMd, 0);
}

void kiri() {
  analogWrite(RPWMa, spd);
  analogWrite(RPWMb, spd);
  analogWrite(LPWMc, spd);
  analogWrite(LPWMd, spd);
  analogWrite(LPWMa, 0);
  analogWrite(LPWMb, 0);
  analogWrite(RPWMc, 0);
  analogWrite(RPWMd, 0);
}

void kanan() {
  analogWrite(LPWMa, spd);
  analogWrite(LPWMb, spd);
  analogWrite(RPWMc, spd);
  analogWrite(RPWMd, spd);
  analogWrite(RPWMa, 0);
  analogWrite(RPWMb, 0);
  analogWrite(LPWMc, 0);
  analogWrite(LPWMd, 0);
}

void CCW() {
  analogWrite(RPWMa, spd);
  analogWrite(RPWMb, spd);
  analogWrite(RPWMc, spd);
  analogWrite(RPWMd, spd);
  analogWrite(LPWMa, 0);
  analogWrite(LPWMb, 0);
  analogWrite(LPWMc, 0);
  analogWrite(LPWMd, 0);
}

void CW() {
  analogWrite(LPWMa, spd);
  analogWrite(LPWMb, spd);
  analogWrite(LPWMc, spd);
  analogWrite(LPWMd, spd);
  analogWrite(RPWMa, 0);
  analogWrite(RPWMb, 0);
  analogWrite(RPWMc, 0);
  analogWrite(RPWMd, 0);
}

void berhenti() {
  analogWrite(LPWMa, 0);
  analogWrite(LPWMb, 0);
  analogWrite(LPWMc, 0);
  analogWrite(LPWMd, 0);
  analogWrite(RPWMa, 0);
  analogWrite(RPWMb, 0);
  analogWrite(RPWMc, 0);
  analogWrite(RPWMd, 0);
}

void periksa() {
  Serial.print(digitalRead(irPins[0]));
  Serial.print(" || ");
  Serial.print(digitalRead(irPins[1]));
  Serial.print(" || ");
  Serial.print(digitalRead(irPins[2]));
  Serial.print(" || ");
  Serial.print(digitalRead(irPins[3]));
  Serial.print(" || ");
  Serial.print(digitalRead(irPins[4]));
  Serial.print(" || ");
  Serial.print(digitalRead(irPins[5]));
  Serial.print(" || ");
  Serial.print(digitalRead(irPins[6]));
  Serial.print(" || ");
  Serial.println(digitalRead(irPins[7]));
  delay(100);
}

void digRead() {

  for ( byte count = 0; count < 8; count++ )
  {
    bitWrite(irSensors, count, digitalRead( irPins[count] ));
  }
} 
etc. etc.

So you could ask can somebody explain to me how this code works?
in addition you could ask
Does somebody know of a different code that does line-counting or intersection counting?

Posting that would demonstrate you have put some own effort into solving your problems.

Posting this makes

visible

that you have put some own effort into it.

Another way would be to describe much more details about the circumstances of your project:

I'm a ...... (student in x grade) / electrician with y years of working experience / in my z year of traing to become a electrician doing a project about ...... my knowledge about electronics is .......
and my knowledge about programming is ........

The components I have so far are

  • an Arduino Mega 2560
  • two DC-motors (technical specs voltage / current)
  • a motor-controller with L298 (link to where you got it from or at least to one that looks similar
  • and a four channel YL-70 IR-sensor

I was unable to find a real datasheet for this YL-70-sensor but I found this website that describes how to use it

The website describe some details about it I do not understand. It has only a small demo-code for testing the sensor

How would I add this code to a line-follower-code to make it count the lines?

int switchState = 0;
int switchPin = 13;
int sensorPin = 12;
int sensorNew;
int sensorOld = 1;
int dtime = 100;


void setup() {
  pinMode(switchPin, OUTPUT);
  pinMode(sensorPin, INPUT);
}


void loop() {
  sensorNew = digitalRead(sensorPin);

  if (sensorOld == 0 && sensorNew == 1) {
    if (switchState == 0) {
      digitalWrite(switchPin, HIGH);
      switchState = 1;
    }
    else {
      digitalWrite(switchPin, LOW);
      switchState = 0;
    }
  }
  sensorOld = sensorNew;
  delay(dtime);
}

If taking this effort is just demoralising you the project might be indeed too big for you.
or you should do a motivational training pre-limary to this electronic project.

Be the change you want to see in the world
best regards Stefan

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.