African Journal of
Agricultural Research

  • Abbreviation: Afr. J. Agric. Res.
  • Language: English
  • ISSN: 1991-637X
  • DOI: 10.5897/AJAR
  • Start Year: 2006
  • Published Articles: 6863

Full Length Research Paper

Automation in the control of a water mixer used for sanitation of bovine milking unit

Carlos Eduardo Camargo Nogueira
  • Carlos Eduardo Camargo Nogueira
  • Postgraduation Program in Agriculture Energy Engineering, Western Paraná State University, UNIOESTE, Cascavel, PR, Brazil.
  • Google Scholar
Gilberto Carlos Arnauts
  • Gilberto Carlos Arnauts
  • Postgraduation Program in Agriculture Energy Engineering, Western Paraná State University, UNIOESTE, Cascavel, PR, Brazil.
  • Google Scholar
Enerdan Fernando Dal Ponte
  • Enerdan Fernando Dal Ponte
  • Postgraduation Program in Agriculture Energy Engineering, Western Paraná State University, UNIOESTE, Cascavel, PR, Brazil.
  • Google Scholar
Rosemar Cristiane Dal Ponte
  • Rosemar Cristiane Dal Ponte
  • Postgraduation Program in Agriculture Energy Engineering, Western Paraná State University, UNIOESTE, Cascavel, PR, Brazil.
  • Google Scholar
Jair Antonio Cruz Siqueira
  • Jair Antonio Cruz Siqueira
  • Postgraduation Program in Agriculture Energy Engineering, Western Paraná State University, UNIOESTE, Cascavel, PR, Brazil.
  • Google Scholar
Samuel Nelson Melegari de Souza
  • Samuel Nelson Melegari de Souza
  • Postgraduation Program in Agriculture Energy Engineering, Western Paraná State University, UNIOESTE, Cascavel, PR, Brazil.
  • Google Scholar
Eder Soares Machado
  • Eder Soares Machado
  • Postgraduation Program in Agriculture Energy Engineering, Western Paraná State University, UNIOESTE, Cascavel, PR, Brazil.
  • Google Scholar

  •  Received: 19 August 2016
  •  Accepted: 21 November 2016
  •  Published: 16 February 2017


The milking unit sanitization is necessary after use. The processes are usually divided in steps and each one needs water at different temperatures for proper cleaning. However, to get the right temperature for each step cannot be easily achieved manually in rural properties. A hot water and cold water flow are needed. The farmer will need to properly mix the two water flows in order to reach a desired temperature for the cleaning step, and due to temperature fluctuations and flow, a constant intervention is necessary to maintain the same optimal temperature of the mixture. In this work, a mixer with automatic control of cold water flow, coupled to an electric heating system, was developed with the aim of reaching an ideal final temperature required for the sanitation of milking units, regardless of temperature variations and flow at the entrance. Two control boards were compared, the Arduino and the IOIO during the first seconds of operation of the system, the opening angle of the cold water registered is calculated from the hot and cold temperatures. After this gradual adjust in the angle was performed. The temperature was considered to be attained when it reached a maximum deviation of 1°C relative to the desired temperature. The system proved to be slightly more satisfactory with the IOIO, since the desired temperature was stabilized at lower average time, 24 s after system initialization.


Key words: Automation, sanitation, milking unit.


The Brazilian herd for the production of milk is estimated to be 40 million animals, 27% of the total herd. Of these, 14 million are for cow milking (LEDIC, 2000). Such production  is  necessary  since   the   average   Brazilian consumption is 130 L per year, still below the recommended by the WHO, which is 175 L per year (SANTO, 2001).
The sanitization of milking units is with hot water, because the high temperature facilitates the removal of dirt in places difficult to reach. The optimum water temperature depends on the type of equipment to be cleaned, as well as of the brand, in addition to the phase of activity, following the manufacturer's specifications. This temperature, in case of milking units, is around 30 to 80°C. If the water does not reach the ideal temperature, cleaning cannot be effective, and if the temperature exceeds the upper limit, there may be damage to the equipment, causing losses.
For a proper cleaning of milking equipment, a few steps are necessary (MILKPARTS, 2002):
1. Pre-rinse: After milking, the equipment must be placed in the milk jar, and dipped in 5 to 10 L of water at 45°C. Thus, the milk that was left in the equipment will be drained into the milk jar.
2. Chlorinated alkaline cleaning: With 10 L of water at 80°C, the chlorine must be diluted in water. This step provides the removal of fats and proteins. During the passage of water through the equipment, it must be dipped and removed so it enters some air in the hoses, generating turbulence and increasing cleaning efficiency. This action must be made until the water cools to 50°C.
3. Rinse: This step must be repeated with the water at 30°C, so that the resulting detergent in the hoses is eliminated.
What many farmers use for water heating is a system with electric resistance or a Liquefied Petroleum Gas heater (SANTOS, 2002). These two systems, in most models, allow a good control of the temperature, from manually or automatically adjusted thermostats. In contrast, the costs of these systems are very high. Other farmers use water heating systems with solar energy. Although this system is cheaper, the method does not allow a precise control of water temperature, as this depends on factors such as room temperature and solar radiation.
The sun is considered an inexhaustible source of energy, greatly exploited by man. However, the use of solar energy is not yet made in significant scale in relation to other energy sources (Roger, 2004). The total amount of solar energy that reaches the atmosphere outside Earth is about 35,000 times greater than that consumed in the planet, according to STOUT data (1980).
A complete system of solar water heating is basically composed by solar collectors, heat reservoirs of accumulation and components that include an auxiliary energy source and a hot water distribution network, and are sized to provide enough hot water for the consumption points, at desired temperature and flow rate, as specified in project (Fossa et al., 2008; Chaguri, 2009; Sousa, 2009). The solar collectors can be flat or concentrators, in accordance with the purpose (Baptista, 2006; Costa, 2007; Lafay, 2005). Currently, the most used collectors are flat closed, most used worldwide, and the vacuum tubes flat, with growing market due to the excellent performance in cold climate regions (Rosa, 2012).
In general, the use of solar energy for water heating requires a low initial investment and very little spent on maintenance, being an optimal solution in the medium and long term.
To control the temperature in a manner that it would not be more expensive, for the heating project solar energy, the combination of two volumes of water at different temperatures, is used as an alternative in the correct amount to achieve the desired temperature. This is a complex process to be performed by the farmer, since some calculations are required to reach the correct mixture.
The development of a system that controls the mixing of water at different temperatures in order to obtain a desired final temperature can be financially feasible. A controller available for sale, and used for initial projects, is the Arduino. The Arduino system is a microcontroller capable of interacting with the outside through input and output devices, such as sensors and motors, respectively. It can be programmed for tasks such as measuring water temperature and control motors responsible for opening and closing registers, the program being written in Arduino Programming Language, with the use of IDE Arduino Development Environment (Arduino, 2014).
Another similar system is the IOIO, which is a board of input and output of data with several digital and analog connections. The ones with input can be connected to temperature sensors, water flow, luminosity and many others that are needed. This board is only an interface, so do not have the capability to run a program to interact with peripherals. The program has to run on a server with the operational system Android, as a mobile phone, which can run Java language with high complexity API. The communication of the board with the phone is via USB or Bluetooth (Ytai, 2011).
In this context, the present work proposes the development and evaluation of an automatic system for mixing hot and cold water, using the Arduino and IOIO platforms, in order to get water at the desired temperature for the sanitation process of a mechanical milking unit.


The work was developed at the State University of Western Paraná, Campus Cascavel (PR) with Latitude 24°59' South, Longitude 58°23' West and average altitude of 785 m above sea level. The average annual temperature is 23°C (Brasil Channel, 2001).
The following items are described as the main equipment that were used or developed.
The boiler equipment is responsible for storing hot water without large losses of temperature. This is basically formed by the reservoir, which stores the water efficiently to minimize heat  losses,  and an electrical resistance, responsible for simulating a solar water heating system. A Solar Life brand boiler with the following features was used: Stainless steel 304, 200 L, low pressure, 3000 W auxiliary heating resistance.
The mixer is the equipment developed to receive two water flows at different temperatures, having as output a single flow of water at the desired temperature. To be able to perform this function, the mixer is formed by several components, some specific of IOIO board, others of the Arduino board and other common to both. The mixer scheme details are shown in Figure 1.
Each mixer item is detailed:
A1: Cold water inlet;
B1: Hot water inlet;
A3: Cold water temperature sensor;
B3: Hot water temperature sensor;
A4: Registry for cold water flow control;
D: Controller engine for the A4 registry;
C1: Junction of cold and hot water flows;
C2: Section to cause turbulence;
C3: Final temperature sensor;
C4: Water outlet for use in the sanitation of the milking units.
Besides the common hydraulic devices, such as pipes  and  diverse connections, some other mixer components deserve attention and are described subsequently.
Two types of temperature sensors have been used in each one of the three points shown in the previous Figures A3, B3 and C3 one compatible with Arduino and the other with the IOIO. The first is the DS18B20 waterproof model, and the second is the NTC 10KTermopar model.
To control the flow of water, a sphere registry for cold water was used. The model used is metal with ¾ inch diameter.
To trigger the sphere registry, the servo motor brand Blue Bird, BMS-I530MG model was used. The main features of this servo motor are: Operating voltage between 4.8 and 7.4V dimensions 55 x 30 x 60 mm, 200 Ncm torque and opening of 141°. These features allow the servo motor to be used for opening and closing the water registry, from 0 to 90°.
The electrical power supply of the entire mixer was performed through a Bestapress source, model BP-503. It receives 127 or 220 V input and provides an output of 5 and 12 V.
The IOIO board used has, in addition to the input and output connections, also an input for power supply, as well as a USB connection, which in this work was used to attach the Bluetooth device, responsible for communication with the Android server. The language used for development of the software was Java. The Android server used was of a cell phone model Philco phone 530. This phone has support for human interface devices and platform for development of new software, besides a mini SD card attached, which was used to store the values of temperature  and  water  flow at every second.
For the solution with Arduino, the model Mega 2560 was used. This model was chosen due to the amount of entries and sufficient communication outputs for connecting all sensors and motors.
The information collected for temperature and water flow is stored in a mini SD card. This card has been attached in a shield in order to be recorded and read.
The information of water flow and temperature of each sensor, as well as temperature selected by the user, were displayed on a LCD display 16×2 model.
Mixer system details are presented in Figure 2.
The equipment was installed at the place of the experiment. Cold water was obtained through a water tank without any temperature control, stored in the external environment, with a capacity of 100 L and refilled by public water network. The hot water was obtained through an electrical resistance installed in the boiler, controlled by a thermostat, aiming to simulate a solar water heating system. The maximum temperature verified in the boiler was 95°C.
The two water inlet flows, hot and cold, are directed to the mixer that, to the user command, will provide water at the desired temperature. This mixer has a temperature sensor for hot water, other for cold water, and another for mixed water. A water registry is responsible for controlling the flow of cold water, and the  hot  water flow has free passage. Finally a servo motor is responsible for opening or closing the water registry, in order to control the temperature of the mixed water. To increase the efficiency of the mixing, an uneven part of the pipe causes turbulence inside the pipeline (C2). Soon after the turbulence, the water passes through another temperature sensor, which should indicate the final temperature selected by the user. The control of the final temperature is made from the activation of the servo motor connected to the registry, being executed by the Arduino and IOIO controller boards. These two types of controllers were compared about the efficiency in controlling the final temperature of the water, as follows: At the beginning of the process, from the temperature data collected from the sensors, the registry opening angle is calculated and positioned at a point considered optimal to achieve the desired temperature. Thereafter, the water temperature is constantly adjusted through the automatic opening and closing of the cold water registry until it is stabilize at the desired temperature. Thus, the most efficient controller is considered the one that presented less time for stabilization of this temperature. A flowchart of the control system is presented in Figure 3 and the experiment structure is presented in Figure 4. 
Turnaround time
The time between change in the registry angle and change in temperature  has direct effects on the system performance, and this depends on several factors, such as sensor response time, distance between the registry and the temperature sensor, heat loss, among others. In this work, final response time was investigated, which represents the time interval that occurs for stabilization of the desired temperature, after the beginning of adjustments in the registry angle.
The algorithm used to adjust the registry opening angle and, consequently, the desired temperature setting, is the same for Arduino and IOIO. This runs at every second, as well as all other functions of the mixer, such as temperature reading of the sensors, and SD card record. Also, at every second, the change is made in the registry angle, based on a function that determines the value of change.
The definition of the initial angle of opening the registry was made considering three methods: for the first, the angle is established at 45°; the  second,  the  angle  is  calculated  using  an equation set from the ratio of hot and cold water flows; and the third, the angle is calculated using an equation set from the temperature data of the hot, cold and desired water, collected in previous experiments. These equation adjustments were performed with the software Matlab R2012a. The methodology that presented lower error in the initial angle calculation was adopted in the final algorithm to test the Arduino and IOIO platforms.


From the temperature data of hot and cold water collected from the system, the opening angles of the cold water registry were calculated, so that the desired water temperature is reached. The system performance was evaluated for the Arduino and IOIO, using each one of the three methods applied in the stabilization of the temperature, which establishes the initial opening angle of the registry.
Starting angle at 45°
The first algorithm was developed with initial fixed angle at 45°, because, disregarding the temperatures of hot and cold water, this is the intermediate position between 0 and 90º.
Starting angle based on the flow ratio
The second algorithm was developed by varying the opening angle of the registry in 10 by 10°, from 0° (fully open registry) until 90° (fully closed registry), obtaining multiple flow data. It was verified that the maximum flow of hot water was 18 L min-1 (obtained with the registry angle at 90°, where there is no cold water flow), the maximum flow of cold water was 29, 30 L min-1 (obtained with the interruption of the hot water supply), and the maximum flow of hot and cold water together was 33, 16 L min-1 (obtained with the registry angle at 0°). From all the flow data collected, the relations between the flow of hot and cold water were calculated. Using the software Matlab R2012a, the best equation that relates the opening angle of the registry, with the relation of flow rates presented below was adjusted: 
Where:  f(x) = Angle, degrees; x = relation between the flow of hot and cold water, dimensionless;
R2 = Determination coefficient.
Starting angle based on the temperatures collected
The third algorithm was developed from the water temperature data (cold,  hot  and  desired), collected after the stabilization of the desired temperature, and the registry opening angle data. In a similar manner, the previous method was adjusted, using the software Matlab R2012a. The best equation that relates the opening angle of the registry with the relation between the flow of hot and cold water is presented as follows: 
Where: f(x) = Angle, degrees; x = relation between the flow  of hot  and cold  water, dimensionless;   R2 = Determination coefficient.
In this case, the flow relation (value of x) was calculated from the temperature data collected, using the 1st Law of Thermodynamics, considering the occurrence of a mixture of fluids with different temperatures. The equation is presented as follows (Moran, 2011):
Where:  QAQ = Hot water flow, L s-1; QAF = Cold water flow,  L s-1;   =  Desired  water  temperature, °C;  = Cold water temperature, °C;  = Hot water temperature, °C.
Comparison between the real and calculated opening angles
From the two equations adjusted to calculate the initial opening angle of the registries and the collected temperatures of hot, cold and desired water, the opening angles were calculated and compared with the real angles obtained in the experiment. Calculating the standard deviation of the errors of the real angles obtained in the experiment and calculated by the equations, the values of 4.5 and 6.2 respectively for the Equations 1 and 2 were obtained. It was therefore verified that Equation 1 had the lowest standard deviation, and therefore, was applied to the final algorithm to define the initial angle of registry openings. From this parameter, the comparison tests between the Arduino and IOIO response times were performed.
Comparison between the temperature stabilization times
The response time for the stabilization of the desired temperature were obtained considering two different situations of interest: initial angles fixed at 45º, or initial angles calculated by Equation 1, considered as  the equation that presented the best angle adjustments. The calculations were made for both the Arduino and IOIO. It was verified that the use of Equation 1 greatly decreases the system response time, given that it provides the algorithm with an initial opening angle of the registry next to the real value, minimizing the number of iterations needed for temperature stabilization. The average values obtained for the stabilization times, using the angle at 45º and the angle obtained by Equation 1 were, 64.7 and 31.6s for Arduino, and 46.0 and 24.1 s, for IOIO respectively.
Taking into account the better performance of Equation 1, the data collected with Arduino and IOIO, for the desired temperatures of 60, 70 and 80ºC, are presented in Figures 5 to 8. These three temperatures were chosen to make the simulation and comparison of the systems, in order to verify which one presents better performance. However, the developed water temperature control system could be used for any other temperatures, within the range set for cleaning (from 30 to 80°C) (Milk Parts, 2002). For all tests performed, the average boiler temperature was around the maximum temperature controlled by the thermostat (95°C). Figures 5 and 7 shows respectively that for Arduino and IOIO, the outlet temperatures, over time, will converge to the desired temperatures. Figures 6 and 8 displays respectively for Arduino and IOIO that the registry opening angles, over time, will converge to the correct opening angles, which cause the outlet temperatures to be equal to the temperatures  desired.  It  is  important to emphasize that the initial angle, calculated by Equation 1, is presented for t = 2s.
It is evident that the final result  of  the  two  systems  is very similar; what differs is the oscillation that occurs in the adjustment of the outlet temperature and the opening angle  of   the   registry;  however  it  did  not  significantly influence the final result.


The results demonstrate that the required temperatures are reached within a few seconds after system startup and kept stable in the course of operation. This was possible by the success achieved in the stages of construction for the simulation of a solar heating system, the hydraulic unit, and its efficient control through IOIO and Arduino. The stabilization of the outlet temperature is linear in order to achieve the desired temperature without large oscillations (less than 1°C). The average time of stabilization of the outlet temperature was 31.6 s for Arduino, and 24.1 s for IOIO. The calculation of the initial angle of registry opening, based on the temperatures of hot, cold and desired water, quite sped up the arrival process at the desired temperature. Thus, the use of these systems (Arduino and IOIO) to control water temperature used for cattle milking units was shown to be very promising.


It is suggested to verify the influences of the temperature sensors response time, and the distance between register and sensors, in the results obtained in the experiment. 


The authors have not declared any conflict of interest.


ARDUINO (2014). Arduino. 



Baptista ASC (2006). Análise da Viabilidade Econômica da Utilização de Aquecedores Solares de Água em Resorts no Nordeste do Brasil. COPPE/UFRJ.


BRASILCHANNEL (2001). São Miguel do Iguaçu - PR. Accessed in July, 15, 2014.


Chaguri JJJ (2009). Sistemas prediais de aquecimento de água: parâmetros de dimensionamento e gerenciamento. Universidade de São Paulo.


Costa RNA. (2007). Viabilidade térmica, econômica e de materiais de um sistema solar de aquecimento de água a baixo custo para fins residenciais. Universidade Federal do Rio Grande do Norte.


Fossa JA, Santos EM, Junior JC, Fagá MTW (2008). Perspectivas tecnológicas para instalações internas de gases combustíveis em clientes residenciais. Cátedra Do Gás.


Lafay JMS (2005). Análise energética de sistemas de aquecimento de água com energia solar e gás. UFRGS.


Ledic ILG (2000). O grande trunfo da nossa pecuária leiteira. Editora Peirópolis.


MILKPARTS (2002). Manual de instruções ordenhadeira. 


Moran MJ, Shapiro HN (2011). Princípios de termodinâmica para Engenharia. Centro Federal de Educação Tecnológica Celso Suckow da Fonseca - CEFET/RJ. 6 ed.


Roger H (2004). Energia e Meio Ambiente. Editora Cengage Learning Editores.


Rosa FN (2012). Aplicabilidade de coletores solares com tubo evacuado no Brasil. UFRG.


Santo BRE (2001). Os caminhos da agricultura brasileira (2nd ed.). Orton IICA / CATIE.


Santos EM (2002). Gás natural: Estratégias para uma energia nova no Brasil. Editora Annablume.


Sousa AGL (2009). Desenvolvimento de software para projeto de sistemas centralizados de aquecimento solar de agua. Rio de Janeiro.


Stout BA (1980). Energia para a agricultura mundial. Itália: FAO.


YTAI (2011). IOIO Documentation.