This is my line follower with PID and arduino.
It does 90 degree turns.
I will show you how i build it.
Have fun!
Acrylic
Screws
Between Arduino nano and line sensors (Pololu QRT8-RC)
Its similar like in the image, but i usea another pins.
Now,
Arduino---|---Sensor
D2----------|--------8
D3----------|--------7
D4----------|--------6
D5----------|--------5
D6----------|--------4
D7----------|--------3
D8----------|--------2
D9----------|--------1
5V----------|-------Vcc(+)
Gnd(-) ----|-------Gnd(-)
The conection its similar like its shown in the image.
I varie the original circuit to fit with the arduino nano, so i use ports A's not D's.
Arduino------|-----Motor diver
D10 ----------|-----PWM A
A5------------|------IN2 A
A4 -----------|------IN1 A
A3------------|------STANDBY
A2------------|------IN1 B
A1------------|------IN2 B
D11-----------|-----PWM B
5V------------|------Vcc(+)
Gnd(-)-------|------Gnd(-)
VM its a special case, beacuse it goes to the positive (+) of the battery, like in the first image.
Here you can download the complete code.
I use PID derived from the theory of control.
You may ajust the values of Kd, Kp, and maybe the base motor speed.
Those values were found experimentally, so you may try diferent values.
This is my line follower with PID and arduino.,It does 90 degree turns.,,I will show you how i build it.,Have fun!