Line follower issue

Hello community, my problem with the line follower robot is that although my robot starts the calibration process, after it he does not follow the line, he simply turns to right side.
The motors are working fine since I have tested them doing a straight line.
voavoapassarinho.ino (2.9 KB)

Hi there,you’re using pololu QRT-8RC sensor package, right? I think it will be easier for pololu team members to answer if you share a connection diagram of your whole circuit. Till then you can cross check your work with this tutorial
And if you ever consider making anything a bit less complicated than your current LFR, here is a good but simple one.

Hello rpiloverbd, thanks for your quick answer. Yes I do have the QTR-8RC sensor.
Below is the scheme of the line follower.
schematic.txt (524 Bytes)

Hello.

If you have not already, please use the QTRRCExample program from our QTR library with minimal modification to confirm that the sensors on your array are each individually working correctly, and to confirm that the output from line reading function provides useful values. Once you have established that, I recommend commenting out the lines in your program that actually drive the motors and adding in some lines that print information about what your program is doing to the Arduino Serial Monitor. For example, you might print the line position, error, and turning value it is calculating. With that you should be able to gain some valuable insight into what your program is doing and what might be going wrong by just manually move the sensor array and robot across the line you are trying to follow.

If you do that and continue having trouble identifying what is going wrong, could you post a video demonstrating what your line follower is doing? The forum does not allow users to post very large videos, but it does work well with videos linked from other sites (like YouTube or Vimeo). Posting a sample of your program’s Serial Monitor output that goes with that might also be useful.

- Patrick

Hello, thanks for your answer!

What happens is that, while the line follower does callibrate, it does not recognize the line it’s supposed to follow, and I have no idea why. I’m sending two videos, as you requested, about the error I mentioned before.

I also tried testing the QTR sensors as you suggested, and they seem to be working just fine, until I try to place him on the line and the values don’t change, which causes it not to recognize the line, as I told you previously.

We also noticed that our code used Analog sensors while we are using Digital ones, which we changed now.


While awaiting for your response, I will attempt to use different PID values on the code and see if any of them end up working.

Thanks again for the help!

I suspect you are not performing a good calibration with your reflectance sensors, which could explain why it is failing to recognize the line. Keep in mind that the calibration function in our library acts on each individual sensor, so while calibrating the array you should make sure that every sensor on it is moved over the black line and the white surface (preferably multiple times). Can you try the minimally modified QTRRCExample.ino program again, but make sure to manually move your array as I described? Could you post the output when you run that example, making sure to get a good calibration?

- Patrick