Contents:

Introduction to PIC Microcontroller (PIC 18f4550)

Introduction to PID algorithm

Sensor selection

PID Controller Algorithms

Code & Tuning

SCHEMETIC and simulations

The basic purpose of this project is to develope the understanding of PID algorithm.Some of the basic things about making robot will not be covered here.For this you have to see the robotics section about making robot and other related stuff lilke motor selection motor driver etc.the core objective is to discuss the implementation of PID control system.

For code and Complete files visit the link below:

## Step 1: Introduction to PID Algorithm:

Proportional-Integral-Derivative (PID) control is the most common control algorithm used in industry and has been universally accepted in industrial control. The popularity of PID controllers can be attributed partly to their robust performance in a wide range of operating conditions and partly to their functional simplicity, which allows engineers to operate them in a simple, straightforward manner. As the name suggests, PID algorithm consists of three basic coefficients; proportional, integral and derivative which are varied to get optimal response.

**Proportional Response:** The proportional component depends only on the difference between the set point and the process variable. This difference is referred to as the Error term. The proportional gain (Kc) determines the ratio of output response to the error signal.

**Integral Response :**The integral component sums the error term over time. The result is that even a small error term will cause the integral component to increase slowly. The integral response will continually increase over time unless the error is zero, so the effect is to drive the Steady-State error to zero. Steady-State error is the final difference between the process variable and set point. A phenomenon called integral windup results when integral action saturates a controller without the controller driving the error signal toward zero. Derivative Response:

**The derivative** component causes the output to decrease if the process variable is increasing rapidly. The derivative response is proportional to the rate of change of the process variable. Increasing the derivative time (Td) parameter will cause the control system to react more strongly to changes in the error term and will increase the speed of the overall control system response. Most practical control systems use very small derivative time (Td), because the Derivative Response is highly sensitive to noise in the process variable signal. If the sensor feedback signal is noisy or if the control loop rate is too slow, the derivative response can make the control system unstable

## Step 2: Code and Circuit Diagram

Given below is the code for measuring the deviation

‘00000001’ this means robot is towards rightmost this code works in a manner that is robot is at right the deviation will be recorded negative

Getting these results PID then sums all the previous deviations and generates an integral called total error. The difference of the deviation is measured by derivative. The error calculated is then send to this code it will give the correction

These lines should run in each iteration.

For understanding How the core concept of PID works see the complete Post as i have already covered this topic in the following link: Download the code and Circuit diagram from this link: