I bought a tracking module ("Tracking" from 37 Arduino Sensor-> Tkkrlab) and I fixed it in front of my robot (Mini DFRobotShop Rover Kit (Arduino Uno)).
I tried a very simple programm where the tracking module measures if the underground is black or white and if it is black he should drive in a straight line. It worked. But I am not sure how to make a programm which makes the robot drive back on the black line if he drove off.
Have you any ideas of doing this? To make the robot drive on the black lines (turns included)?
Please help me.
So you want to do a line follower robot. Correct?
Well, I have actually recently built one that uses IR sensors and PID control. Here is the post for it on Arduino Project Hub: Elliot the Line Follower Robot | Arduino Project Hub This post will walk you through how I built this, but it is NOT a full tutorial.
So, to build an effiecient line follower robot you are going to want to use at least 3 tracking sensors (IR sensors). Doing this will allow the robot to better know its surroundings, and will be able to generate an error based on the readings of the sensors. Nextly, you're going to want it to use PID control. Now, this control system can be slightly confusing for someone who is new to robotics, but defenitly can be learned. In the post I have attached the code I wrote, so you could take a look at that to see how PID control works.
I'd be happy to help you with this project, so feel free to ask more questions