Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Line Following Sensor Arrangement Algorithm

Status
Not open for further replies.

richardv2

New Member
I'm building several line following sensor arrays. One is an 8-inline array with QRD1114 sensors spaced at 0.5 inches. The 'line' will be 0.75 inch electrical tape. I want a more precise reading, so closer spacing, allowing two sensors to react when both are over the line, will give me more readings per inch.

I also have a theory about an inverted V array, like this:

#.........# front
.#.......#
..#.....#
...#...#
....#.#
.....#
***********
***ROBOT***
***BODY****
***********
***********

(# = sensor. periods are just spacers so your screen won't delete or ignore the spacing.)

My theory is that putting the prongs of the V out front, that I will be able to get earlier detection of 90 degree intersections and greater than 90 degree turns. (And other complex turns that might 'fool' an inline array.) And I equate earlier detection with the ability to go faster and still make the turn, therefore traversing a course or maze faster.

I've completed the inline array, and once working, will make the inverted V array and test both pretty extensively.

Does anyone have any wisdom on this? I've seen one robot on the net with a V, but with the point of the V out front, but not an array like above.

I would like to hear your thoughts or ideas on this.
 
Wouldn't the line follower have a higher chance of losing the parts of the line closest to it (the part of the line under the vertice of the V) sinc sensors are so close there? I would chop off the bottom of the V.

I can't entirely see how the narrowing of the V would improve things. I can see how a larger horizontal array would make you be able to re-acquire a line better and how a dual-parallel vertical array would help you detect turns. So I guess I can see how a V is a compromise between the two so you don't have to have a sensor grid.
 
I'm not sure why you're going with that setup vs all the sensors in a straight line? The reason I say that is the closer the line ends up being inline with your sensors the harder it's going to be to determine how far it's off. With those in a straight line you're going to be off in direct proportion to which sensor to the left or right it is. With the V setup you're going to have combinations of sensors possibly activating up to and including one whole side of the V. Just thinking out loud. That or make a setup so that you can arrange the sensors in different ways and see which gives the best results.
 
>>Wouldn't the line follower have a higher chance of losing the parts of the line closest to it (the part of the line under the vertice of the V) sinc sensors are so close there?

What I was thinking, looking at the V... Use the bottom three sensors of the V mainly to stay centered on the line. Use the upper sensors to detect an intersection, right or left 90 degree turn, or a greater than 90 degree turn.
 
In a "normal - easy" course with easy turns and no intersections, the V array makes no sense.
My point was - Is there a better placement of sensors to see the unusual turns in a more complex race track.
Using pound signs to indicate black tape...
#########
#
#
#
#
for a right turn, top right sensor in V would detect turn in time to slow down and negotiate turn faster/better.

#
#.#
#...#
#.....#
#.......#
#.........#
#
#
and the top right sensor would also "see" a sharper than 90 degree turn coming.
So these might be some possible readings (0 = white under sensor, 1 = black under sensor)

0001000 On the line

0001001 oops - sharp right turn ahead
0001010 Geting closeer to intersection


or..
1001001 Possible intersection ahead
0101010 Yep, coming up on an intersection
 
Wouldn't a circle be the best for that? THe circle could either be out front or it cold be all around the robot's base (which I think is better because...)

If it was around the robot rather than in front of it, you have sensors to stay centered and to keep the line within limits in case you lose it (though it's a circle that that's not likely to happen since other sensors will reacquire the line as soon as one loses it). You'd also need less sensors and it would improve utilization since at least 6 of them would be in use (the sensors that currently see the line, and the first ones to detect the line in case you lose it). WIth the other cases the only difference when you hit a corner is one additional sensor is used.

(FOr utilization, I am referring to the sensors that currently see the line and the ones next-in-line to catch the line (ie when you veer off or are in the process of recentering), since the sensors farther out have zero possibility of triggering until the inner ones trigger first so they are basically doing nothing. So any sensor that is currently not detecting the line and another sensor between itself and the line is serving no functional purpose.)

You seem to have 11 sensors in your diagram. Just 8 sensors makes a might fine approximation of a circle...or a perfect approximation of a circle-like octagon. THat gives you one sensor to stay centered and a two sensor buffer for each side to reacquire the line if you lose it...for both front AND back. And if you reach a corner that folds back in on itself (or even a branch in the path) you can sit on the corner and decide which path to take.

You'd need at least 6 sensors (1 for center, and 2 to reacquire the line for both front and back) though and 8 sensors is probably around optimal since it gives you a double buffer to reacquire the line. If you use 4 sensors in a "circle" (or a square), you're just more likely to lose the line than if you just put them in a linear array.

At least, that's how I'd go about it if I was building something like a tracking antenna (except I'd probably move the antenna in a circular cone fashion rather than arranging multiple ones in a circle since they are large, heavy, and expensive). Very similar to a line tracker I think.
 
Last edited:
As has been stated, having the sensors in a V pattern will

a) give you more advance warning on turns
b) create confusion as to the type of curve


#
#.#
#...#
#.....#
#.......#
#.........#
#
#


0001000 On the line
0001001 oops - sharp right turn ahead
0001010 Getting closer to intersection

Note that that EXACT SAME sensor data could also be sent if the line looked like this

......................######
.................##
...........#
........#
......#
.....#
.....#



0001000 On the line
0001001 oops - sharp right turn ahead
0001010 Getting closer to intersection


So the robot would have no idea, with this setup, whether the curve was a curve or a sharp turn in the opposite direction.

With a straight set up, however, this is easily discerned.

Sharp reverse direction-

0001000
0001001
0001010
0001100

nice easy curve

0001000
0001100
0000100
0000110
0000010
0000011
0000001


Great topic by the way!
 
Staring at NighFalcon's arc, I also realized that you can keep the robot aligned to the line (rather than just following it hoping not to drift off) by having the robot align itself to the line detected by two sensors detected in a circlular base arrangement (ie. the chord of the line following the arc).

It wouldn't work very cleanly in a >90 degree turn, however but that is easily dealt with by programming an exception to when two sensors are picking up the line that are less than 90 degrees apart. It would also know if it reached a dead end since only one sensor would be detecting a line (unless its a really wide line).
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top