In this article, a vision-based control of a line-tracing mobile robot is presented. The position of the robot is determined based on the analysis of the images obtained by a ceiling mounted camera. Such an approach has some advantages compared to the more common robot mounted camera approach. The robot detection algorithm uses some well-known image processing algorithms. As the PC is common these days and the mobile robot is quite easy to build or buy, the only prerequisite is a camera. The time delay of a web camera is too large so a FireWire CCD camera is preferred for better performance. The control system presented can be an ideal educational tool for an introductory level course in image processing, image analysis, or machine vision. As the line-tracing problem is well known to everyone studying mechatronics or robotics, the approach presented in this article should be of great interest to all students in these fields, because it offers an alternative solution to the line-tracing problem. Besides that this approach makes it possible to implement a more advanced predictive control algorithm. In order to make the experiment even more interesting, an obstacle avoidance algorithm is presented as well. ß