0% found this document useful (0 votes)
24 views5 pages

Final CPS

The document discusses the design of an automatic water pumping system using a microcontroller and water level sensor. It provides the basic theory of DC motors and PID controllers which are used to control the pump speed based on the water level readings. The system aims to automate water pumping for more efficient and stable water supply.

Uploaded by

21139065
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)
24 views5 pages

Final CPS

The document discusses the design of an automatic water pumping system using a microcontroller and water level sensor. It provides the basic theory of DC motors and PID controllers which are used to control the pump speed based on the water level readings. The system aims to automate water pumping for more efficient and stable water supply.

Uploaded by

21139065
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/ 5

HCMC UNIVERSITY OF TECHNOLOGY AND EDUCATION – FACULTY OF ELECTRICAL AND ELECTRONICS ENGINEERING – CYBER-PHYSICAL SYSTEMS 1

AUTOMATIC WATER PUMPING SYSTEM


Ngô Quốc Huy - 21139020, Hà Văn Trung – 21139065

OVERVIEW --- The project aims to design and current and converts this energy into mechanical
implement an automatic water pumping system, rotation.
integrating a water level sensor and a PID Let J be the moment of inertia of the motor rotor,
controller to automate the water pumping process. B be the load coefficient, 𝜔𝑚 be the motor speed
This system utilizes a microcontroller and a water (rpm) và Em be the voltage and current supplied to
level sensor to detect the water level and control the motor, respectively.
the pump's operation. The objective of the system We define the generated torque on the motor shaft
is to provide a practical and cost-effective solution Tm as:
for automatic water pumping. This system helps
Tm = K.Im (1)
conserve water, minimize manual intervention, and
reduce the occurrence of water hammer, thereby And with R0 being the resistance of the rotor
minimizing the risk of damage to the plumbing winding, we have:
system. Em = Im.R0 (2)

INTRODUCTION From Newton’s Second Law, we have:

I
ⅆ𝜔𝑚
n rural areas or places with unstable water 𝐽 + 𝐵𝜔𝑚 = 𝑇𝑚 (3)
ⅆ𝑡
sources, the use of water pumps to supply water
From which we obtain:
for daily life and production is becoming
ⅆ𝜔𝑚 𝐾𝐸𝑚
increasingly common. However, manual operation 𝐽 + 𝐵𝜔𝑚 = (4)
ⅆ𝑡 𝑅0
of water pumps often encounters many difficulties,
especially when there is no operator present. This Using Laplace transform for the equation above,
can lead to the phenomenon of water hammer, we get the transfer function model of the DC
causing the system to not only produce unpleasant motor:
noise and vibrations but also potentially damage 𝐾
𝜔𝑚 (𝑠)
pipes and other equipment. =
𝑅0 𝐽
𝑆 (5)
𝐸𝑚 (𝑠)
𝐵
The project focus on designing and implementing 𝐽
an automatic water pumping system capable of 𝜔𝑚 (𝑠)
controlling water flow to provide a safer, more Let G(s) = and applying the Laplace
𝐸𝑚 (𝑠)
convenient, and more efficient water supply. transform to both sides of equation (5):
Combined with a PID controller, this system will
𝐺(𝑡) = 𝑎1 ⅇ −𝑎2𝑡 (6)
operate accurately, ensuring that water is supplied
𝐾 𝐵
more efficiently and stably. Where a1 = ; a2 = . To determine the response
𝑅0 𝐽 𝐽
BASIC THEORY of the motor speed in the form of either transfer
function or time function, we need to determine the
A. Direct Current Motor parameters of the motor such as the static
Direct Current Motor (DC motor) converts amplification coefficient K, load coefficient B,
electrical energy into mechanical energy. The DC moment of inertia J, and the voltage drop
motor draws electrical energy through a direct coefficient 𝑅0 . From there, we can determine the
HCMC UNIVERSITY OF TECHNOLOGY AND EDUCATION – FACULTY OF ELECTRICAL AND ELECTRONICS ENGINEERING – CYBER-PHYSICAL SYSTEMS 2

amplification coefficient and time constant of the generates a control signal proportional to the
motor model. input error at the sample time.
The DC motor uses permanent magnets with a 2. Integral Component (I): This is the integral of
constant magnetic field. The relationship between the error over the sample time. Integral control
motor speed and voltage is mapped by equation adjusts the control signal to reduce the error to
(4). Because of the fast mechanical response of the zero, reflecting the total instantaneous error
motor, we use the proportional voltage control over time or the accumulated past error. Smaller
method to adjust the speed of the DC motor, which sample times indicate stronger integral control
is the Pulse Width Modulation (PWM) method. action, corresponding to smaller deviations.
3. Derivative Component (D): This is the
The average value of the voltage on the load is derivative of the error. Derivative control
calculated by the formula: produces a control signal proportional to the rate
𝑇𝑜𝑛 Duty cycle of change of the input error. Longer time
𝑈𝑡 = 𝑈𝑚𝑎𝑥 = Amplitude x (7)
𝑇𝑜𝑓𝑓 Period indicates a stronger derivative control range,
corresponding to a faster response to input
We see that the voltage value on the load depends
changes.
on the ratio γ = Duty cycle/Period. Therefore, for
each pulse cycle, we can adjust the Duty cycle to The PID control law is defined as:
control the voltage [1]. 1 𝑡 ⅆ𝑒(𝑡)
𝑢(𝑡) = 𝐾𝑝 (ⅇ(𝑡) + 𝑇 ∫0 ⅇ(𝜏) 𝑑𝜏 + 𝑇𝐷 ) (8)
ⅆ𝑡
B. PID Controller
Where 𝑢 is the control signal and e is the control
PID stands for Proportional Integral Derivative, a
error (e=ysp−y). The control signal is the sum of
common feedback loop control mechanism used in
three components: Proportional (P), Integral (I),
industrial control systems. This controller is
and Derivative (D). The transfer function of the
widely applied in closed-loop control systems and
PID controller is:
systems with feedback signals.
𝑈(𝑠) 1 1
The PID controller calculates the error, which is 𝐺𝑃𝐼𝐷 (𝑠) = 𝐸(𝑠) = 𝐾𝑝 + 𝐾1 𝑠 + 𝐾𝐷 𝑆 = 𝐾𝑝 (1 + 𝑇 𝑠) (9)
𝑖
the difference between the measured value of a
process variable and the desired setpoint value PRODUCT REQUIREMENTS
determined by the designer or user. By adjusting The product must be able to adjust the pump speed
control values, the system minimizes the error and according to the water level in the reservoir. When
achieves more accurate operation, thereby the water level rises, the pump speed should
enhancing performance. gradually decrease. Conversely, when the water
level falls, the pump speed should gradually
increase.
The specific design requirements for the
Automatic Water Pumping System model are as
follows:
A. Sensor module capable of measuring water
level.
B. Microcontroller capable of reading sensor data
Fig 1: Principle of Operation Diagram and equipped with libraries for quick
programming.
The PID controller combines three components: C. Display screen to show the water level.
1. Proportional Component (P): This is the D. Module control DC Motor.
proportional adjustment method, which E. Water pump motor with low power and small
size, suitable for model conditions.
HCMC UNIVERSITY OF TECHNOLOGY AND EDUCATION – FACULTY OF ELECTRICAL AND ELECTRONICS ENGINEERING – CYBER-PHYSICAL SYSTEMS 3

SYSTEM SPECIFICATIONS 1. Water Level Sensor Module:


The technical requirements for the Automatic Operating Voltage: DC 3-5V
Water Pumping System model are as follows: Operating Current: 20mA
A. Water Level Sensor: Output Signal: Analog
Dimensions: 62 x 20 x 8 mm. Dimensions: 62 x 20 x 8 mm
Operating Voltage: DC 3 - 5V. 2. ESP32 Microcontroller:
Operating Current: 20mA. Operating Voltage: DC 5V
Output Signal: Analog. Memory: 448 Kbyte ROM, 520 Kbyte SRAM,
B. Microcontroller: 6 Kbyte SRAM on RTC
Operating Voltage: DC 5V. 3. OLED Display SSD1306:
Memory: 400 - 500 Kbyte ROM, 400 - 600 Diagonal Size: 0.96 inch
Kbyte SRAM. Display Size: 26 x 19 mm
Additional Features: Should include libraries to Driver IC: SSD1306
support rapid programming.
Matrix Type: Passive
C. Display Screen:
Resolution: 128 x 64 pixels
Type: LCD or OLED display suitable for
showing water level information Display Color: Blue
Resolution: Sufficient to clearly display the Interface Type: I2C
water level data Overall Dimensions: 30 x 28 x 4 mm
Interface: Compatible with the microcontroller Operating Temperature: -30 ~ 70°C
(e.g., I2C, SPI)
Operating Voltage: 3.3 ~ 5VDC
D. Motor Control Module:
4. Motor Control Module L298N:
Model: L298N or equivalent motor driver
Main Control Chip: L298N
Operating Voltage: Compatible with the DC
motor voltage (e.g., DC 9V) Logic Voltage: 5 VDC

Current Capacity: Sufficient to handle the Power Supply Voltage: 5~35 VDC
operating current of the DC motor Logic Current: 0~36 mA
Control Interface: Compatible with the Control Current: 2A (MAX single H-bridge)
microcontroller (e.g., PWM control) Storage Temperature: -20℃ to +135℃
E. Water Pump Motor: Maximum Power: 25W
Weight: 20 - 50 grams Dimensions: 43 x 43 x 27 mm
Operating Voltage: DC 9V 5. Mini Submersible Pump Motor:
Operating Current: 40 - 100mA Weight: 25 grams
Speed: 2000 - 10,000 RPM Power Supply: 3-5VDC
SYSTEM MODULE DESIGN Current: 100-200mA
A. Material Flow Rate: 1.2-1.6L/min
HCMC UNIVERSITY OF TECHNOLOGY AND EDUCATION – FACULTY OF ELECTRICAL AND ELECTRONICS ENGINEERING – CYBER-PHYSICAL SYSTEMS 4

Dimensions: 42.6 x 23.9 mm


6. Mini Water Reservoir:
Dimensions: 14 x 11 x 7 cm
Material: Plastic.

B. Operation Desciption
This model uses the ESP32 MCU to read and
collect water level data from the water level sensor.
Then, through the PID controller, the ESP32
automatically adjusts the pump speed to match the
water level. This specific user requirement aims to
minimize pressure, prevent water waste, and avoid
damage to the water piping system.
Activity of the model through the following block
diagram:

Figure 2: Block diagram of the model.

C. Architecture Design Fig 4: Software Activity Flowchart.


Hardware Interface Block Diagram: At the start, the ESP32 will read data from the
water level sensor. If a value is detected, it will
convert this value into a sensor ratio. This ratio is
then set as the input for the PID controller, which
regulates the motor speed through the L298N
motor driver, inversely proportional to the sensor
value.

IMPLEMENTATION RESULTS
The system model successfully automated the
adjustment of the water pump speed into the
reservoir without human intervention. Throughout
the research and model completion process, the
team gained extensive experience in teamwork,
Fig 3: Hardware Interface Block Diagram. utilizing Overleaf for report presentation, and
acquiring valuable technical knowledge.
D. Detailed Design
Activity Flowchart: OBSERVATIONS AND EVALUATIONS
The developed system model met the previously
set design and technical requirements. The sensor
demonstrated stable water level signal reception,
while the pump, and ESP32 operated reliably.
HCMC UNIVERSITY OF TECHNOLOGY AND EDUCATION – FACULTY OF ELECTRICAL AND ELECTRONICS ENGINEERING – CYBER-PHYSICAL SYSTEMS 5

The integrated PID control algorithm effectively


adjusted the pump speed such that when the water
level approached the higher sensor threshold (near
full), the pump speed decreased; and when the
water level approached the lower sensor threshold
(near empty), the pump speed increased.
However, when deploying the system in a real-
world model, further research and improvements
on the water level sensor, PID algorithm, and
microcontroller optimization are necessary. These
enhancements will ensure stable and efficient
system operation in real-world environments,
meeting the specific requirements and conditions
of the application.

Figure 5: Automatic Water Pump Model.

REFERENCE
[1] M. M. Basil, "System Identification Algorithm
for Systems with Interval," Volume 18 February
2012

You might also like