Abstract- This article presents a fuzzy controller applied to a The control using fuzzy logic has been widely applied in
process of pH (hydronium potential) neutralization. The recent years, in several processes [8]. Generally, the fuzzy
controller shall be applied for the pH correction in waters with control is based on fuzzy sets and logic that can be used to
soap (wastewaters) and rainwaters, aiming at the reuse of such describe the human knowledge in mathematical format [13].
but not for drinking purposes. The controller has been
A typical fuzzy controller is composed of three basic parts:
implemented from the “Mamdani” model with the analysis of
two situations, one in which only the error is considered as the fuzzy application of the input signal, an engine of fuzzy
plant’s input, and another where error and variation of error inference that deals with rules and the fuzzy reverse process
are considered for it. All simulations were performed in a that generates continuous signal for actuators. In all, two
MATLAB® Simulink environment, and tested in an distinct characteristics of fuzzy logic is that the human
experimental microcontrolled plant using a PIC 18F4550, experience can be easily integrated, so it is not necessary a
demonstrating the benefits of the fuzzy logic’s application in this mathematical model of the system and that the fuzzy logic
process. provides nonlinear relation induced by functions of
pertinence, rules and the fuzzy reverse process [9].
I. INTRODUCTION However, in spite of the whole importance of the control,
the projects should always be associated with words such as
Current Studies show that the scarcity of water has been
quality, reliability and low cost. A device that has been
much discussed. Water misuse has created many problems
widely used for the implementation of controllers in projects
throughout the world. In our planet most of it is not available
that involve low cost is the microcontroller, usually applied
for human consumption, only 0.007 % of all is drinking
for automation and process control, such as the control
water. As there is still water in large quantities on the planet,
systems for automotive engines, remote controls, office and
many people have forgotten that it is important to rethink the
residential machinery, toys and supervisory systems.
forms of use this element of vital importance.
The microcontroller is able to reduce the size, cost and
For its reuse, something is important to control the water’s
energy consumption compared to conventional
pH. The pH control plays a very important role in industrial
microprocessors. Summarizing, the microcontrollers are an
processes [10], such as neutralization of effluents,
efficient alternative to control many processes and
biotechnological processes, precipitation, and chemical
applications.
industry[11].
Many programming languages, such as, assembly, C, and
Among many applications of pH’s control, the
even Ladder, make the microcontrollers increasingly sought
neutralization process is one of the most important. This
for automation. The project here proposed, suggests an
process has important characteristics is (i) nonlinear, (ii) the
intelligent reuse of wastewaters and rainwaters but not for
sensitivity of the pH (for the addition of reagents that may
drinking purposes. Its reuse will be applied for washing of
result in a change of one or more units), (iii) the gain of the
sidewalks, watering gardens, sanitary discharges. It’s possible
process is a complicated function of the solution’s
because of the control of its hydronium potential, also known
components, making its curve unknown. In truth, the
as pH.
procedures for pH’s control are very unpredictable [8]. The
This project will show an implementation of a pH
main difficulty in the pH control is its great sensitivity to
controller using fuzzy logic. The simulations were developed
disturbances and uncertainties parameters [11]. Thus, the pH
in a MATLAB® environment and the results obtained in
processes are known by its complexity.
practice show the good performance of the fuzzy controller
In 1965, Professor L. A. Zadeh, from Berkeley University
applied to it.
(USA), suggested an alternative for the conventional theory
of sets, it was the fuzzy sets theory [7]. It is much more
flexible and similar to the theory of the possibilities. In this II. HYDRONIUM POTENTIAL (PH)
theory, the change of pertinence to the non pertinence
happens in a slow and gradual way and not sudden as in
Based on Fontes et. al [5], pH is a characteristic of various
conventional theory of sets [6]. Through this technique it is
substances, determined by the concentration of ions of
possible to control complex processes, such as, for example,
hydrogen (H+). Solutions with a pH less than 7 are said to be
the control of a robotic arm or even pH of liquid substances.
acidic, solutions with a pH greater than 7 are basic or alkaline excess of turbidity. The second reservoir contain the pH
and neutral, with a pH close to 7. sensor. It will receive the water from the first reservoir and
Based on Campos [2] the lower the pH of a substance, the liquids used to control the pH, according to the
greater is the concentration of H+ ions and lower the microcontroller.
concentration of OH- ions. It is possible to find pH values In summary, the plant operates in the following way: a
lower than 0 and greater than 14, but it is very rare, and these pump positioned in the bottom reservoir moves the water
values cannot be measured with a normal probe. from it (which in a system represents a cistern) in the
In a substance the pH varies according to its composition, direction of the top reservoir (which symbolizes the water
temperature and concentration of salts, metals, acids, bases tank). Upon receiving the first reading of the level sensor, it
and organic substances. Mathematically, the "p" is equivalent will indicate that the reservoir already has enough quantity of
to the symmetrical logarithm (base 10) of the activity of ions water to initiate the control process.
to which it refers. Basically, pH is defined as a negative The top reservoir, or control tank, contain a pH sensor.
decimal logarithm of the hydrogen ion activity in a solution. This sensor will dynamically do the reading of the obtained
For H+ ions : values, and send it to the microcontroller. From the first
reading at a pH value different from the set-point, another
water pump starts its task of inserting reducer in the water,
pH=-log10 [aH+] (1) since the wastewater and rainwater tend to have a basic pH.
The pump launches water constantly in the top reservoir,
Knowing that aH+ represents the activity in mol dm-3, in however, in case it reaches its capacity limit indicated by the
dilute solutions (below 0.1 mol dm-3), the values of the level sensor, the pump stops. In fact, the pH must be
activity is closer to the values of the concentration, allowing neutralized simultaneously to the filling of the reservoir.
the above equation is written as illustrated in equation 2: It is important to emphasize that the hardware was
developed with low-cost parts, to show that it is possible to
make water reuse with quality and inexpensively. Figure 1
pH=-log10 [H+] (2) shows a simplified scheme of the project.
From the graph obtained, and with some mathematical Fig. 5 pH Sensor
manipulations, it is possible to reach the function that In current systems, the electrodes are combined (figure 5),
represents the dynamics of the plant (equation 5). in other words, the measuring and the reference electrodes are
mounted together on the same glass body and thus can
1
G p (s) (5) decrease the size of the set and, consequently, facilitate its
912.53s 1 assembly in the process where the measurement will be
performed. The sensor is represented in the system by a first
It’s possible to notice that the dynamics of the plant is order transfer function. This function was obtained through
relatively slow, but this is due to climatic influences such as experimental tests and has a time constant of 22.78s and
temperature, relative humidity, which can influence the unitary gain, where its output is given in pH (0 to 14).
density of water, consequently altering the pH constantly.
1
G s (s) (3)
B. PH Control Process 22.78s 1
For the completion of the proposed process simulation,
the variables which would have a greater and direct influence D. Actuator
in the pH control were modeled, and with that, were obtained In the actuator block, which is the set of two small water
the transfer function in continuous time from the sensor (a pumps and liquid used to raise or lower the pH, was modeled
digital filter was used to reduce noise for the microcontroller). a transfer function to represent its dynamics, as shown by
Through MATLAB® Simulink environment, the plant and equation 4, as well as the function that represents the sensor,
controller were simulated (Figure 3). The controller operates both were obtained experimentally.
in a regulated manner so that any disturbance to the system is 8.8 10 6
eliminated. The disturbance ranges from 0 to 14 and are Ga ( s ) (4)
s
The function (4) was modeled with the ratio between the The Second controller to be implemented was a fuzzy PD,
volume and the PWM (pair of input and output of this with the goal of making a comparison between the results
actuator block), which explains the system’s integrative obtained in the fuzzy P, figures 9, 10 and 11 show the
action, thus justifying the use of a fuzzy PD controller with membership functions developed.
the scheme zero error.
V. SIMULATION RESULTS
From the Simulink, controllers were simulated. The first
one was the fuzzy P, implemented with only three rules:
1. If (Error is En) then (pH- Controlled is Acid) (1);
2. If (Error is Ez) then (pH- Controlled is Neutral) (1);
3. If (Error is Ep) then (pH- Controlled is Basic) (1).
It is possible to observe membership functions in
MATLAB® through the figures 6 and 7.
Fig. 9 Error Input of the Fuzzy PD