I recommend arranging your sensors like the following:
Thickness of Line
<--------> /\
| | / \
| * * | ||
| | || moving
* | | * || direction
| | ||
| * * | ||
| | ||
This allows you to detect many conditions. Let's say the sensors receives 1 if on black area and 0 if on white. Let's look at some of the configurations that may happen and their interpretations. I will use |
, -
, /
and \
to indicate the borders of the actual line:
You are completely lost:
0 0
0 0
0 0
moving on straight line:
| |
| 1 1 |
| |
0 | | 0
| |
| 1 1 |
| |
The line turns right:
0 0
------------------
0 | 1
|
| 1 1 |--------
| |
The line turns left:
0 0
------------------
1 | 0
|
--------| 1 1 |
| |
Gap ahead:
|________|
0 0
________
0 | | 0
| |
| 1 1 |
| |
Gap behind:
| |
| 1 1 |
| |
0 |________| 0
0 0
________
| |
leaning out of the line from the left:
| |
0/ 1 /
| |
0 / /0 or 1
| |
/ 1 1 /
| |
you are being teased:
1 1
1 1
1 1
There are many other variations you can think of. As one of the examples shows, this also gives you the ability to detect when you are leaning out of the line so you can come back smoothly (without having to turn back on the line sharply). Given this, following the circle shouldn't be a problem at all regardless of whether it's green or black.
Detecting color with grey-scale sensors is possible, but probably not what you are looking for. In your specific case, a value that is far from both 0 and 1 (say from 0.2 to 0.8 or something like that) would depict your color, which is only one. You should still pay attention that if only one of the sensors is showing such a value, for example 0.5, it is likely that you are just going out of the line and it's measuring a half white/half black location.
If you really want to detect the actual color you have to do the following:
- Use three grey-scale sensors instead of one at each location.
On each of the three, mount a color filter; one green, one blue and one red. Color filters are as simple as colored transparent pieces of plastic:

Read the three RGB values and convert them to HSL (Hue-Saturation-Lightness).
- Base your decisions on the calculated hue. I say only on the hue because the environment lighting very easily changes your observed saturation and lightness so they are not very reliable.