Project Title: Speed Control of a
Conveyor Belt Using PID Controller with
ESP32 and MATLAB/Simulink
1. Objectives
1. To design a conveyor belt system using a 37GA 12V DC motor.
2. To control the motor using an ESP32 and IBT-2 motor driver.
3. To measure belt/roller speed using a Flying Fish IR sensor.
4. To model the DC motor in MATLAB/Simulink.
5. To analyze open-loop motor speed response.
6. To design a PID controller for speed regulation.
7. To compare motor speed with no load and with load.
8. To verify whether the PID controller can recover speed after load is applied.
2. Introduction
We will explain why conveyor belt speed control is important.
- Conveyor belt speed changes with load.
- Open-loop control cannot correct speed drop.
- PID controller uses feedback to reduce speed error.
- IR sensor measures speed.
- ESP32 generates PWM signal.
- IBT-2 driver controls motor power.
3. Problem Statement
What problems we can face while doing this project.
4. Course Outcome / CEP Relevance
CEP Report Part What this project covers
Modelling and Analysis DC motor transfer function, speed response, load effect
Controller Selection PID controller selected for speed regulation
Simulation and Design MATLAB/Simulink open-loop and closed-loop models
Parameter Tuning PID gain tuning for stable speed response
Sustainability Low-cost, energy-efficient conveyor prototype
Appendix / Presentation / Viva Hardware image, code, Simulink blocks, results
5. System Overview
We will explain the full system and we will add block diagram here.
Figure 1: Overall block diagram of the conveyor belt speed-control system
Reference Speed → ESP32 PID Controller → IBT-2 Motor Driver → DC Motor → Conveyor Belt
↑
↓
IR Speed Sensor ← Roller / Belt Motion
6. Components Used
We will give explanations of the components and its purpose:
Component Purpose
Microcontroller for PID calculation and PWM
ESP32
generation
37GA 12V DC geared motor Drives the conveyor belt
IBT-2 / BTS7960 motor driver Provides high-current motor control
Flying Fish IR sensor Measures roller speed
12V power supply Powers the motor
Conveyor belt frame and
Mechanical structure
roller
Jumper wires and breadboard Circuit connection
MATLAB/Simulink Simulation and analysis
7. Working Principle
8. Mathematical Modeling of DC Motor
A DC motor is a commonly used actuator in control systems. In this experiment, the
input of the system is the armature voltage V, and the output is the shaft angular speed
dθ
ω= . The motor consists of an electrical armature circuit and a mechanical rotating
dt
part. The motor voltage produces armature current, the current produces torque, and
the torque rotates the shaft.
Symbol Meaning Value
J Moment of inertia of rotor 0.01 kg.m^2
b Viscous friction constant 0.1 N.m.s
Ke Back emf constant 0.01 V/(rad/s)
Kt Torque constant 0.01 N.m/A
R Armature resistance 1 ohm
L Armature inductance 0.5 H
In SI units, the torque constant and the back-emf constant are equal. Therefore, Kt =
Ke = K is used in the model.
Motor Torque and Back EMF
Motor torque is proportional to armature current:
T =Ki
Back emf is proportional to angular speed:
dθ
e=Kω=K
dt
Mechanical and Electrical Equations
The mechanical equation of the DC motor is:
2
d θ dθ
J 2 +b =Ki
dt dt
dθ
or, using ω= :
dt
dω
J + bω= Ki
dt
The electrical equation of the armature circuit is:
di
L + Ri=V − Kω
dt
Transfer Function Model
Taking Laplace transform of the mechanical equation gives:
s(Js+ b)Θ(s)=KI (s)
Taking Laplace transform of the electrical equation gives:
(Ls+ R) I (s)=V (s)− KsΘ (s )
The transfer function from armature voltage to angular speed is:
ω (s) K
P(s)= =
V (s) (Js+b)(Ls + R)+ K 2
Substituting the given values:
0.01
P(s)= 2
0.005 s +0.06 s+0.1001
State-Space Model
Using the state variables X 1 =ω and X2 = i, the state vector is:
x=
[ ωi]
The state-space model is:
[ ][ ] [ ]
b K
− 0
d ω
[]
dt i
=
−
J
K
−
J ω
R i
+ 1 V
L
L L
y= [ 1 0 ]
[ ωi]
Therefore, the output y is the motor angular speed ω .
PID Controller Theory
The error signal is the difference between the reference speed and the actual speed:
e (t)=r (t)− y (t )
The PID controller transfer function is:
Ki
C (s )=K p + + K d s
s
2
K s + K p s+ K i
Or, C (s )= d
s
8. Load Modeling
No-load model
0.01
P1 (s)= 2
0.005 s + 0.06 s +0.1001
Loaded model
0.01
P2 (s)= 2
0.005 s +0.075 s +0.1301
Or, if using heavy load:
0.01
P3 (s)= 2
0.005 s +0.09 s +0.1601
10. Controller Selection
We will say why we are using pid controller here.
11. Design Requirements
1. The conveyor belt should run smoothly in the stable PWM range.
2. The speed should remain close to the selected reference speed.
3. Speed drop under load should be reduced using PID control.
4. Overshoot should be low to avoid belt slipping.
5. The controller should operate within practical PWM limits.
6. The system should be low-cost and safe for laboratory demonstration.
We will write numeric values like:
Requirement Target
Overshoot Less than 5%
Steady-state error Less than 5%
Settling time Less than 3 seconds
PWM operating range 35% to 50%
Speed recovery under load Should return close to reference speed
12. MATLAB/Simulink Simulation
12.1 Open-loop without load
Figure 2: Open-loop Simulink model without load
Figure 3: Open-loop response without load
12.2 Open-loop with load
Figure 4: Open-loop Simulink model with load
Figure 5: Open-loop response with load
12.3 Closed-loop PID without load
Figure 6: Closed-loop PID Simulink model without load
Figure 7: PID response without load
12.4 Closed-loop PID with load
Figure 8: Closed-loop PID Simulink model with load
Figure 9: PID response with load
13. Hardware Implementation
Figure 10: Hardware setup of conveyor belt speed-control system
14. Circuit Connection
Device Pin Connected To
ESP32 GPIO 25 IBT-2 RPWM
ESP32 GPIO 26 IBT-2 LPWM
ESP32 GND IBT-2 GND and power supply GND
12V supply positive IBT-2 B+
12V supply negative IBT-2 B-
Motor terminals IBT-2 M+ and M-
IR sensor VCC ESP32 3.3V
IR sensor GND ESP32 GND
IR sensor OUT ESP32 GPIO 32
15. Hardware Code
We will talk about the coding for esp32
16. Experimental Results
16.1 Without load
Test PWM / Controller RPM
Open-loop 35%
Open-loop 40%
Open-loop 45%
Open-loop 50%
PID Reference RPM =
16.2 With load
Test Condition RPM before load RPM after load RPM after PID recovery
Open-loop Load added Not recovered
PID Load added
17. Result Comparison
Condition Open-loop Behavior PID Behavior
No load Runs at fixed speed Tracks reference speed
Condition Open-loop Behavior PID Behavior
Load added Speed decreases Speed recovers toward reference
High load Speed drops more PWM increases to compensate
Saturation limit No correction Correction limited by max PWM
18. Analysis
19. Challenges and Trade-Offs
20. Sustainability and Safety
21. Limitations
22. Future Improvements
23. Appendix