Arduino Line Follower With PID and 90 Degree Turns

by maomarest in Circuits > Arduino

59324 Views, 91 Favorites, 0 Comments

Arduino Line Follower With PID and 90 Degree Turns

IMG_20160921_222642.jpg

This is my line follower with PID and arduino.

It does 90 degree turns.

I will show you how i build it.

Have fun!

First of All the Result

IMG_20160921_222654.jpg
IMG_20160929_180610[1].jpg
IMG_20160929_180621[1].jpg
IMG_20160929_180631[1].jpg
IMG_20160929_180643[1].jpg

Materials

1000_1_micro_metal_gearmotor_hp__pololu_1595__00[1].jpg
0J620.1200[1].jpg
0J1128.600x480[1].jpg
0J1133.600x480[1].jpg
13845-02[1].jpg
ArduinoNanoFront_3_lg[1].jpg
circuito-impreso-universal-72-x-95mm[1].jpg
21334[1].jpg

Connections Between Arduino Nano and Line Sensor

basico+vel[1].jpg

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(-)

Connections Between Arduino Nano and Motor Diver

TB6612FNG_arduino_hookup[1].png
IMG_20160929_191646[1].jpg
IMG_20160929_191655[1].jpg

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.

Connections Between Motor Diver and Motors

TB6612FNG_arduino_hookup[1].png
IMG_20160929_192508[1].jpg
IMG_20160929_192520[1].jpg

Its very simple,

Just follow the connections of the image and thats it.

Chasis

IMG_20160929_191857[1].jpg
IMG_20160929_191833[1].jpg
IMG_20160929_191839[1].jpg

I made it from a square of acrylic with a motor tool, you may use CNC or other techniques.

The bot have foamy to protect the sensors from the external light.

Code

illu_what_is-board[1].png
PID2[1].jpg

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.

Downloads