minimal number of sensors is 3 but you better use 5 or 7 .
This is a pretty common robotics task... there must be stuff out there on the net. Search around first.I would use two photo diodes or photo resister sensors on the bottom pointed toward the canter. robtillaart says use more but I,m not sure what that would gain you, but I never built a line follower.You will need a central light source to illuminate the line, but shielded from the sensors. Connect the sensors to the analog inputs and then program the device to turn right or left trying to minimize the difference between the sensors... This is where more sensors might be better, but tougher logic. You have plenty of analog inputs so that is not a factor.When you come to a perpendicular white line the reading on both sensors will jump. you have to figure out how much. program the device to stop if it sees a big jump in both sensors, and wait 10 seconds. Then you must tell it that the the next thing it must do is go forward a certain amount so it can find the line again, or go till both sensors see a big drop, then just repeat till you hit the last white space. If the larger white space is surrounded by black space, you can tell the device to turn on the LED if both sensors drop abruptly, and they can't find the white line again. If it is not, or it is against a wall you will have to count the time it takes to cross it and use that to tell you if you are done.One way to do this is to count the time it takes to cross the other white spaces and store it. If the last white space is > twice the small spaces then stop & light up the LED.The code is pretty straight forward logic, even though there is a lot of it.I would hope they allow you to set up a prototype track so you can try out different approaches. Sounds like fun.Is there a time limit on how fast the race must be run? if not, go slow and add in a lot of averaging code to smooth out the ride and not lose the line.
If you have 5 sensors the task is to kee the white spot in sensor 3if the white spot moves away to:- 2 you must turn to the left- 1 you must turn harder to the left- 4 turn to the right- 5 turn to the right harderIf white spot is nowhere seen, start a search for the line- Archimedes curve - relative easy- Hilbert curve - more difficult but serious fun- Random - easyIf you need to be recognize crossings- multiple sensors will go white ==> that is where 5 is the minimum you need to detect that there is a lane to the left and right at the same time
you need to be able to see the line (white) and the left (black) and right (black) ==> that makes three
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16