This final thesis deals with the problem of selecting a line detection method for a line following robot, which are being increasingly used for the tasks of transferring products and raw materials in industry, construction and mining. When choosing a method, we need to consider the position of sensors in relation to the line, that is being followed, we also have to take into consideration, under which conditions these sensors will operate. We collected data from IR sensors, which were successively traveling above the black line, under different initial conditions. With changing the initial conditions we examined the influence of the distance between the sensors and the line, the influence of LED being turned on or off, and the influence of the ambient light on the sensors. We found, that we get the best and most accurate results with the 2.5 mm distance between the sensors and the ground, with the LED turned on and with the covered sensors. Using standard deviation we analyzed the methods of maximum values, weighted averages and square interpolation. Based on the results of data scattering, we have found that the best method for determining the position of the line, for a line following robot is the weighted average method.