Andrew Woodings and Geoff Carlson - EET 548 1999
Introduction Line Following Lift IR Scanning Analysis Code References

Line Follower

To see an our forklift following a line (in its early state) view the following MPEG movies, Center circle, turns

The line follower was constructed using five 15 mA red wide-angle LED's and four CdS photoresistors.  Each LED was connected in series with a 330 Ohm resistor and in parallel to 5 Volts, supplied by Handy Board.  The 330 Ohm resistor dropped the current through the LED down to approximately 15 mA; which was sufficient to cause it to burn quite bright.  The CdS photoresistors were each connected to ground and to their own analog input port.  The schematic of the line follower circuit is show in Figure 1.

The LED's and the photoresistors were placed next to each other in a linear, alternating sequence—the four photoresistors were placed in between each of the five LED's.  This arrangement provided relatively even lighting on the track for each of the photoresistors.  To further enhance the photoresistors "view" of the reflective light, they were placed on small 0.25 inch thick acrylic risers to position them closer to the track surface.  By placing the photoresistors on risers the LED's could be placed further away from the track to produce a more even strip of light without sacrificing the ability of the photoresistors to detect light changes.  Thus, this configuration provided even lighting and excellent photoresistor placement.  Figure 2 shows line follower configuration.
 




All four photoresistors were used simultaneously to follow the line and to detect landmarks.  The manner in which they were used will be explained.

The basic idea for our line follower set up came from the paper, A Lateral Position Sensing System for Automated Vehicle Following, by Alleyne, Williams, and DePoorter. This paper explains how the characteristic response distributions of photoresistors can be arranged sequentially to produce a linear output.  The procedure described involved a lot of analytical calculations to determine the spacing between each photoresistor and the appropriate gain that each should be multiplied by.  However, we did not follow this analytical approach—we pursued the problem empirically.  Our approach will be explained.

The distance that should exist between each photoresistor was determined by mere judgement.  The sensors were spaced evenly to provide what we deemed to be a good reading range.  The two innermost photoresistors were placed just over the edge of each side of the tape, with the outer two being placed at the extremities (see Figure 2).

To produce a linear output the photoresistors needed to each have an individual output that looked something like the curves in Figure 3. S1, S2, S3, and S4 represent each of the four photoresistors.  To obtain the responses shown in Figure 3 each photoresitor needed to be multiplied by a weight— S1 and S2 by a positive weight, w and x,  and S3 and S4 by a negative weight, y and z.  With appropriate weights chosen the sum of the distributions would theoretically produce a linear relationship between the photoresistor output and the line follower’s location over the white line.  Figure 4 shows the sum of the weighted distributions.
In selecting the appropriate weights it was first necessary to ensure that each photoresistor read the same value when placed over the white line.  It was therefore essential to first multiply each sensor by another set of weights, a, b, c, and d.  Equalizing the photoresistor’s output made it easier to select the weights w, x, y, and z.  Putting this all together, the output equation would be of the form:

      Eq. 1 

With this linear output the control algorithm would be easily implemented.  This was the basic idea behind our line follower set up.

Weights a, b, c, and d were obtained by placing all four sensors over the white line.  Using the Handy Board we were able to read the output of each sensor.  We choose 70 to be the value that each sensor should read over the white line.  With this information each of the photoresistor outputs were multiplied by a calculated weight so that they would each read 70 when over the white line.

Weights w, x, y, and z were chosen by an iterative trial-and-error method.  To initiate the process weights w and z were arbitrarily chosen and x and y were given a value of one.  The line follower sensor was then placed over the white line such that only one photoresistor was directly over the white line at a time.  The output value, from equation 1, was recorded for each photoresistor as it was placed over the white line.  These values were then plotted to see if the four data points lied on a common line.  If they did not, another set of weights were assigned and the procedure was repeated.  This was done until the four data points lied on a relatively straight line. The weights we used for equation 1 are summarized in Table 1.   Also, Figure 5 shows the linearity of the four data points we used.
 


Table 1. Line follower weights

a
b
c
d
w
x
y
z
4.375
4.375
6.634
5.0
2.5
0.6
0.6
2.5

The output from equation 1 was not completely linear, but close enough for our purposes.  The output provided data that was good enough to implement a stable and reliable line following control algorithm.

To control the forklift using the line follower output data a proportional derivative (PD) controller was implemented.  The proportional and derivative gains were selected using the Ziegler-Nichols method.  In short, this method requires that a proportional gain be gradually applied to the control error until the system goes marginally unstable.  At this point the period of the system oscillation needs to be measured and the proportional gain at which marginal stability occurs recorded.  With this information the gain values for the PD controller can be calculated based on the Ziegler-Nichols formulas.  For more information please reference W. Bolton, Mechatronics or Franklin and Powell, Feedback Control of Dynamic Systems (see complete references in the References section). The values that we used for our PD controller are found in Table 2.  The control algorithm can also be seen here.

Table 2.  PD controller gains

Kp 2.5
Kd 0.05

Landmarks were detected using all four photoresistors.  The photoresistor outputs, S1, S2, S3, and S4 were summed such that;

         Eq. 2 

By placing all four photoresistors over the white line it was determined that the sum of the sensor values was approximately 260.  When the photoresistors were not all over the white line the value of lm was higher.  Thus, by monitoring the value of lm the forklift was able to find landmarks.

The line follower setup and control algorithm performed very well.  With the PD gains properly selected the forklift was able to follow straight lines curves, and right angles without any problem.  Furthermore, it was able to do it with great stability.  Any disturbances to the system, such as a bump, crooked tape, etc., were quickly accounted for in the control system.  Attenuation to the disturbances was also quite rapid.