Question about line-tracking robot algorithm

I want to use PID to control a line-tracking robot, and what I need is to extract a number from the signals measured from TCRT5000 sensors that represent the position of the line below the robot (for example 0 for the most left and 7000 for the most right). I need that number to feed the PID function.
Is there any possible way to do so?

Post a link to the sensor.

If it is something like this one, most people use the background corrected, weighted average of the sensor readings as the line position.

I use 5 of these: Module Cảm Biến Dò Line Đơn TCRT5000 4 Chân - Nshop (sry for the language)

Should work, if you use the analog signal.

Thanks for your suggestion, I gonna pay some minutes researching.

This tutorial looks pretty good: How to Program a Line Following Robot

Thanks.
I found sth that may be what I need:


However I have quite a concern: if the weight of the center sensor is 0, it won't affect the result.

Try it and see.

I'd tried and had my solution. Thanks for your help.

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