0% found this document useful (0 votes)
42 views19 pages

Diy Project

This document summarizes a DIY group project to build a PID controlled self-balancing system. The system uses a PID controller to balance a toy vehicle on a limited straight line path. The document outlines the team members and their roles, lists the parts and costs, describes the circuit and mechanism, explains how the PID controller works, shows the code, and discusses applications and challenges of the project.

Uploaded by

tagore T
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views19 pages

Diy Project

This document summarizes a DIY group project to build a PID controlled self-balancing system. The system uses a PID controller to balance a toy vehicle on a limited straight line path. The document outlines the team members and their roles, lists the parts and costs, describes the circuit and mechanism, explains how the PID controller works, shows the code, and discusses applications and challenges of the project.

Uploaded by

tagore T
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

DIY GROUP

PROJECT
PID Controlled Self
Balancing System

The system aligns the toy vehicle


using PID controller which is free
to move on a limited straight line
path.

1
OUR TEAM
21CE10002 ABHIRUP PAL HARSH KHASBAGE 21CS10029
Coding and
Circuit Designing
Development of logic

21CS30006 ANISH DATTA PABBULETI SAI CHARAN 21CS10049

Assembly of parts, PID controller theory research


hardware work and presentation

21CS10009 ARITRA CHAKRABORTY THIRUPATHI YUVARAJU 21BT10032

Coding and PID controller theory research


development of logic and presentation

2
1
PARTS AND
COST

3
PARTS AND COST

₹250
ULTRASONIC ₹60
SENSOR BREAD BOARD
(✕2)
SERVO ARDUINO JUMPER
MOTOR UNO WIRES
₹250/- ₹800 ₹150

TOTAL COST: ₹1510


4
2
CIRCUIT AND
MECHANISM

5
CIRCUIT

6
HOW IT LOOKS

Ultrasonic Sensor

Movable Joints

Servo Motor

Bread Board

Arduino UNO

Ultrasonic Sensor
Block for User

7
3
PID CONTROLLER

8
PID DIAGRAM

9
HOW IT WORKS

The system works by measuring the distance of the cube and the distance of the
vehicle from one end by two sensors. The distance of the vehicle is the Process
Variable (PV) which is desirable to be equal to the distance of the cube (setpoint).

The difference of these distances is computed to be the error and the PID controller
calculates the amount of rotation of the servo motor required to decrease the error to
0 (zero) to align the vehicle to the cube.

10
PID CONTROLLER

The PID algorithm consists of 3 parts that contribute to the output which is fed again to the input. These
three parts are :

1) P which stands for Proportional : This term accelerates the output towards the desired value
depending on the error between them.
2) I which stands for Integral : This terms remembers the past by integrating over the error as time
passes so that noises are suppressed eventually.
3) D which stands for Derivative : This term predicts the future by measuring the rate at which the
output accelerates towards the desired value so that there are no offshoots and reduced
oscillations.
All these terms are associated with their respective gains which determine how much each term affects
the response of the system under varied conditions.

11
CODE

12
CODE CONTINUED

13
CODE EXPLANATION
● The distance of the cube from one of the sensor is taken by the function measure_2() on trigPin2 and
echoPin2 and that of the cart is taken by the function measure_1() on trigPin1 and echoPin1.
● The move_servo() function takes an integer in its parameter and maps it to move the servo accordingly.
● setup() function sets up the circuit and connects the servo to the arduino uno. It also takes two initial
inputs from the two ultrasonic sensors.
● loop() is the main part and here we implement the PID controller. Distance of the cube is taken as input
and filtered using the previous input in setup(). Same is done for distance of the cart from the sensor.
● Next we find the error as the difference in these distances.
● Using this error and previous measurements we find P, I, D terms. Kp, Kd and Ki are respective gains
which have to be tuned to make sure that the algorithm works as expected.
● D is filtered to reduce noise because it is very sensitive to noise.
● U is found in radians and till it’s inside the movable range of the servo, the I term is computed as
saturation is false. Once system settles down saturations turns on thus making the I term count.
● U is changed to degree.
● U is mapped to the corresponding value of the servomotor.
● The servomotor is moved till error is more than some threshold value which is 0.02 here.
● The current values of I, D, P, setpoint is stored for use as previous in the next iteration.

14
4
APPLICATIONS

15
PRACTICAL USES OF PID
● Self driving vehicles can be made much less jerky and more responsive using these PID
controllers.
● Calculating the distance of the line where the vehicle originally moves and where it should, we can
create an offset angle using PID that instructs the wheels when to steer and by how much.
● One of the practical uses is in drone stabilization and many more areas.

16
CHALLENGES FACED

● Friction in wheels of toy car, resisting its movement even on significant tilting of plank.

● The arm length of the servo motor was not long enough to produce a significant angle range in the
plank to overcome the friction of toy car. To solve this, multiple arms had to be screwed together.
● Manual PID tuning is not an easy task as it needs trial and error method which is time consuming.

VARIATIONS OF WORKFLOW

● Manual tuning is a traditional way and instead we could have used auto tuning in MatLAB.
● The tracks on which the vehicle moved could have been made more smooth.

17
OUR PROGRESS

WEEK 1 WEEK 2 WEEK 3 WEEK 4

We browsed through We understood the working of Wooden framework Final model


possible project ideas, the PID algorithm and how to assembled and parts made and
and decided on PID tune circuits. Circuit was also assembled, code for PID code tested
controlled self balancing designed. Components were was developed. and controller
system. ordered and they arrived this tuned.
week only.

18
THANK YOU

19

You might also like