My 1st line follower

stan74

Senior Member
By popular demand..well erco :)
I think it's been done before. A simple line follower...well there's different ways and I tried a 6 sensor array and it's pee poor but almost funny to watch.
OK the array http://www.hobbytronics.co.uk/qtr-8rc-sensor?utm_source=google&utm_medium=googleshopping&utm_campaign=googlebase&gclid=Cj0KEQiAtK3DBRCBxt-Yxduq5p4BEiQAbFiaPbzGVBIJ41UlQmfQ_4Xn3MdTIs0JcM7PvXaEZ9mgIgkaAlOa8P8HAQ
Well I tried the "time capacitor discharge" method but used erco's "quick and dirty method"
The continuous servos don't really work slow,that's my excuse.
https://youtu.be/txIOZrravKg https://www.youtube.com/watch?v=3E7wK7x8IBc
Oh,the code I'm playing with
Code:
[color=Green];6 sensor,dual continuous servo line follower[/color]
[color=Navy]#picaxe [/color][color=Black]20m2[/color]
[color=Blue]setfreq m4
symbol lservo[/color][color=DarkCyan]=[/color][color=Blue]b.6
symbol rservo[/color][color=DarkCyan]=[/color][color=Blue]b.7
symbol [/color][color=Purple]reflec[/color][color=DarkCyan]=[/color][color=Purple]w0[/color]

[color=Blue]servo lservo[/color][color=Black],[/color][color=Navy]134 [/color][color=Green];default speed[/color]
[color=Blue]servo rservo[/color][color=Black],[/color][color=Navy]166[/color]
[color=Black]main:[/color]
[color=Purple]reflec[/color][color=DarkCyan]=[/color][color=Purple]pinsb[/color]
[color=Green];if reflec=33 then servopos lservo,134:servopos rservo,166:pause 200:endif:goto main ;sensor 2 and 5-must be junction-keep going forward straight[/color]


[color=Blue]if [/color][color=Purple]reflec[/color][color=DarkCyan]=[/color][color=Navy]3 [/color][color=DarkCyan]or [/color][color=Purple]reflec[/color][color=DarkCyan]=[/color][color=Navy]1 [/color][color=DarkCyan]or [/color][color=Purple]reflec[/color][color=DarkCyan]=[/color][color=Navy]2 [/color][color=Blue]then servopos lservo[/color][color=Black],[/color][color=Navy]100[/color][color=Black]:[/color][color=Blue]servopos rservo[/color][color=Black],[/color][color=Navy]154[/color][color=Black]:[/color][color=Blue]goto [/color][color=Black]main:[/color][color=Blue]endif [/color][color=Green];left fastest,right slowest[/color]

[color=Blue]if [/color][color=Purple]reflec[/color][color=DarkCyan]=[/color][color=Navy]6 [/color][color=DarkCyan]or [/color][color=Purple]reflec[/color][color=DarkCyan]=[/color][color=Navy]4 [/color][color=Blue]then servopos lservo[/color][color=Black],[/color][color=Navy]120[/color][color=Black]:[/color][color=Blue]servopos rservo[/color][color=Black],[/color][color=Navy]158[/color][color=Black]:[/color][color=Blue]goto [/color][color=Black]main:[/color][color=Blue]endif [/color][color=Green];left faster,right slower[/color]

[color=Blue]if [/color][color=Purple]reflec[/color][color=DarkCyan]=[/color][color=Navy]4 [/color][color=Blue]then servopos lservo[/color][color=Black],[/color][color=Navy]132[/color][color=Black]:[/color][color=Blue]servopos rservo[/color][color=Black],[/color][color=Navy]168[/color][color=Black]:[/color][color=Blue]goto [/color][color=Black]main:[/color][color=Blue]endif
if [/color][color=Purple]reflec[/color][color=DarkCyan]=[/color][color=Navy]12 [/color][color=Blue]then servopos lservo[/color][color=Black],[/color][color=Navy]134[/color][color=Black]:[/color][color=Blue]servopos rservo[/color][color=Black],[/color][color=Navy]166[/color][color=Black]:[/color][color=Blue]goto [/color][color=Black]main:[/color][color=Blue]endif [/color][color=Green];same           [/color]
[color=Blue]if [/color][color=Purple]reflec[/color][color=DarkCyan]=[/color][color=Navy]8 [/color][color=Blue]then servopos lservo[/color][color=Black],[/color][color=Navy]136[/color][color=Black]:[/color][color=Blue]servopos rservo[/color][color=Black],[/color][color=Navy]164[/color][color=Black]:[/color][color=Blue]goto [/color][color=Black]main:[/color][color=Blue]endif                  

if [/color][color=Purple]reflec[/color][color=DarkCyan]=[/color][color=Navy]24 [/color][color=DarkCyan]or [/color][color=Purple]reflec[/color][color=DarkCyan]=[/color][color=Navy]16 [/color][color=Blue]then servopos lservo[/color][color=Black],[/color][color=Navy]142[/color][color=Black]:[/color][color=Blue]servopos rservo[/color][color=Black],[/color][color=Navy]180[/color][color=Black]:[/color][color=Blue]goto [/color][color=Black]main:[/color][color=Blue]endif [/color][color=Green];right faster,left lower   [/color]

[color=Blue]if [/color][color=Purple]reflec[/color][color=DarkCyan]=[/color][color=Navy]48 [/color][color=DarkCyan]or [/color][color=Purple]reflec[/color][color=DarkCyan]=[/color][color=Navy]32 [/color][color=DarkCyan]or [/color][color=Purple]reflec[/color][color=DarkCyan]=[/color][color=Navy]16 [/color][color=Blue]then servopos lservo[/color][color=Black],[/color][color=Navy]146[/color][color=Black]:[/color][color=Blue]servopos rservo[/color][color=Black],[/color][color=Navy]200[/color][color=Black]:[/color][color=Blue]goto [/color][color=Black]main:[/color][color=Blue]endif [/color][color=Green];right fastest,left slowest[/color]
[color=Blue]goto [/color][color=Black]main[/color]
[color=Green];servopos lservo,134:servopos rservo,166:goto main ; no pins lit[/color]
 

stan74

Senior Member
The usual photos,heath rob,tyres swapped. The sensor is fussy about height. The track was paint not uniform tape so calibrating was silly. Still..SAM_1400.JPGSAM_1401.JPG
 

erco

Senior Member
Just beautiful, stan74! Thanks for posting more info here. Plywood is a great chassis material. Cheap, strong, stiff, commonly available, and easy to cut.

Chassis geometry is a huge factor. Your sensors are very close to your wheel axis. If you move your sensor forward (or wheels back) you would sense and maneuver very differently. Might be better, might not, depending on the course. Only experimenting will tell.

Definitely your first line follower, but not your last! :)
 

stan74

Senior Member
To me it's fun..I do have other leejure activities but this is cheap in the winter. brrrr. Get a working chassis and your off. The same as turning leds on and off but with more imagination. Picaxe is suited for robot stuff. Top!
 
Top