technology workshop craft home food play outside costumes
Arduino line follower with PID and 90 degree turns
by mestrada3 on September 22, 2015
Table of Contents
Arduino line follower with PID and 90 degree turns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Intro: Arduino line follower with PID and 90 degree turns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Step 1: First of all the result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Step 2: Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Step 3: Connections between arduino nano and line sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Step 4: Connections between arduino nano and motor diver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Step 5: Connections between Motor diver and motors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Step 6: Chasis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Step 7: Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
http://www.instructables.com/id/Arduino-Line-Follower/
Intro: Arduino line follower with PID and 90 degree turns
This is my line follower with PID and arduino.
It does 90 degree turns.
I will show you how i build it.
Have fun!
Step 1: First of all the result
http://www.instructables.com/id/Arduino-Line-Follower/
Step 2: Materials
1. 2 Pololu Micro Metal Gearmotor HP 6v
2. 2 Pololu Micro Metal Gearmotor Bracket Pair - Black
3. 2 Pololu Wheel 32×7mm Pair - White
4. 1 SparkFun Motor Driver - Dual TB6612FNG (with Headers)
5. 1 QTR-8RC Reflectance Sensor Array
6. 1 Arduino Nano
7. 2 cells 7.4V 1000Ah Li-Po Battery
8. 1 Of this
9. Acrylic
10. Screws
11. Nuts
12. Foamy
http://www.instructables.com/id/Arduino-Line-Follower/
http://www.instructables.com/id/Arduino-Line-Follower/
Step 3: Connections between arduino nano and line sensor
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(-)
http://www.instructables.com/id/Arduino-Line-Follower/
Step 4: Connections between arduino nano and motor diver
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.
http://www.instructables.com/id/Arduino-Line-Follower/
Step 5: Connections between Motor diver and motors
Its very simple,
Just follow the connections of the image and thats it.
http://www.instructables.com/id/Arduino-Line-Follower/
Step 6: Chasis
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.
http://www.instructables.com/id/Arduino-Line-Follower/
Step 7: Code
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.
File Downloads
PIDmejor3.ino (3 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'PIDmejor3.ino']
http://www.instructables.com/id/Arduino-Line-Follower/
Related Instructables
Autonomous
2pi Line High Line Following DIY Sumo Combat Arduino based
Follower by performance Arduino Robot Multipurpose Robot with Desktop Line
markmoran Line follower by boyles35 Robot Follower -
Pneumatic
Robot by (Sumobot, Flipper - How to jolliBot by
newtonis Spybot, jollifactory
Mazebot, by kmmarlow
Bluetooth...) by
treyes4
Advertisements
Comments
http://www.instructables.com/id/Arduino-Line-Follower/