The Use of Sensors for Monitoring the Feeding Process and Adjusting the Feed Supply Velocity in Fish Farms

Aquaculture is a growing industry, and its sustainability is crucial. One of its major environmental impacts is the uneaten feed that pollutes the water. To minimize the uneaten feed, many systems have been developed. Nevertheless, current systems can be improved by considering the fish position in the tank and the falling feed. In this paper, we propose a system based on fish presence sensors set at different tank heights and a feed detection sensor located in the drainage tubes. The fish presence sensor is based on light-dependent resistor (LDR). The calibration of these sensors is shown. When the output voltage is higher than 1.467V, we can consider that fish are present. On the other side, the falling feed sensor is based on a CMOS sensor. The calibration process is performed with 40 pictures. The summation of pixels, with brightness value between 0 and 15 in the blue histogram, is used as an indicator of feed presence. If this value is higher than 520 pixels, we can consider that there is feed in the picture. Moreover, a verification process of both sensors is done. The results of the verification confirm the calibration. Finally, the operation of the system is shown.


Introduction
Sustainability of aquaculture is a pressing matter as the demand of fish and seafood is constantly increasing.A production of 59.9 MT/year was obtained in 2010, and in 2030, it is expected to reach 85 MT/year [1].Fish farms can be implemented both in the sea and inland.Sea facilities are comprised of cages where fish are kept separated from other wildlife.Inland facilities build tanks where the conditions that affect the performance of fish are controlled.Illumination, turbidity, temperature, are salinity are an example of the factors that can influence the behavior of fish and must be monitored [2].Principally, sustainable aquaculture facilities should not disrupt the ecosystem where they are placed.Business and social factors, such as being profitable and aiding in the well-being of the community surrounding the facilities, are considered as well [3].Therefore, if only the environmental factors are considered, the key factors to evaluate a sustainable aquaculture facility are land use, water use, energy use, feed use, and freshwater seed.Moreover, diverse technological systems have been developed in order to assess the sustainability of fish farms.Some of these solutions are designed as fixed tanks and filters that measure specific values of water quality [4]; other solutions can be implemented in existing aquaculture facilities incorporating wireless functionalities that allow visualizing the information on a PC or smartphone [5].The information available on sustainable aquaculture allows implementing environmentconscious fish farms.However, although aquaculture allows providing access to food for a large part of the population, several side effects have been noticed.
Aquaculture can introduce a set of problems to the environment [6].Particularly, excess feeding is the cause of some of the side effects of fish farming.Eutrophication is an increase in nitrogen and phosphorous in the water as a result of overfeeding fish [7].Moreover, an increase in inorganic nitrogen can derive in acidification of freshwater ecosystems and survival, growth, and reproduction impairments when toxic levels are reached.This contaminated water affects not only the fish consumed by end users but can also affect the environment where said water is discarded.In addition, consumers of polluted water may develop methemoglobinemia, cancer in the digestive tract, birth defects, mutagenicity, and teratogenicity.Nausea, diarrhea, vomiting, muscular cramps, gastroenteritis, or pneumonia can be caused by algal toxins.Furthermore, the lack of consistent regulation does not contribute to the solution of these problems [8].Different countries implement different regulations, so even in places with stricter regulations, fish with toxicity problems produced in other areas can be commercialized to other countries spreading the health problems derived from it.Although guidelines have been provided in order to reduce the amount of pollution, there is a great need of implementing solutions to control the feeding process performed in fish farms [9].These solutions are not only of interest for the environment but also to the producers as reducing the amount of feed results in a reduction of the cost on their commercialization.For the detection of excess feeding, it is necessary to determine the behavior of fish in the cage during the feeding process.When fish are hungry, their behavior is to rush to the feeding area to ingest the food [10].However, when excess feeding is provided, a big part of the fish in the cage may continue with the usual behavior they have when feed is not provided, letting it drops to the bottom of the cage.This feed is not consumed later on, resulting in the pollution of the water and the subsequent dangers to the environment and human health.For that reason, detecting when feed is not being eaten is of great importance.
In this paper, we present a system that automatically adjusts the amount of dispensed feed.In order to do so, the system detects when feed reaches the drainage system.The feed detection is done using a CMOS sensor.From the data gathered by the CMOS sensor, we obtain the histograms.After analyzing them, we can find a correlation between the number of pixels with certain brightness value and the presence of feed.Moreover, the height at which fish are swimming is detected by employing light-dependent resistor (LDR) strips deployed from the top to the bottom of the cage.The fish are detected due to the changes in the incident light in the LDR caused by the fish swimming behavior.The fish covered by scales acts as mirrors, reflecting the light and some of the flashes inside in the LDRs placed in the tanks.We show the calibration and verification process of both sensors.In addition, we present the results of the simulated feeding process with our proposed system and how the feed supply velocity changes.Our system allows saving feed during feeding time and ensures that all the fish have time to eat, making aquacultural facilities more economically profitable as well as more sustainable.Although the system has been designed for fish tanks, this paper is the first step of the development of a fish feeding system that can be utilized in both inland fish tanks and sea cages.In future research, the system will be developed for sea cages as well, where the benefits of the presented system will be substantial.
The rest of the paper is organized as follows.In Section 2, the related work is presented.Section 3 details the proposed system, including the scenario description and the hardware employed to gather the data.The results of the calibration and verification process and discursion of the proposed system are presented in Section 4. Finally, Section 5 shows the conclusion and future work.

Related Work
In this section, the related work on water quality monitoring systems and fish feeding solutions is presented.
Fish behavior is a crucial factor in determining the performance of the fish in aquacultural facilities.Therefore, various researches have been performed on this matter.A fish behavior monitoring system was implemented by Papadakis et al. in [11].It employed computer vision in order to monitor 9 fish tanks simultaneously.Stock density was evaluated as a stress factor for fish in fish farms.Real-time images were provided to a remote control application.Only the experiment with the undamaged mesh obtained a significant statistical difference.Saberioon et al. performed in [12] a survey on vision-based fish behavior monitoring systems.Machine vision, thermal imaging, hyperspectral imaging, and X-rays were the technologies for fish monitoring discussed by the authors.They also divided the applications of optical sensors into preharvesting and during cultivation conditions and postharvesting conditions.Moreover, they defined five applications for optical sensors in fish monitoring systems.These applications were physical attributes, chemical attributes, fish sorting, fish quality, and food security.Armstrong et al. presented in [13] a flat passive integrated transponder antenna array that monitored fish behavior by recording the movements performed by salmon shoals.The antenna array did not incite any unusual behavior on fish.Furthermore, a 99% success rate was obtained in the experiments.They were done by varying the number of salmons in each one of the experiments.Fish growth, density, and fish behavior were monitored by Conti et al. in [14].Fish behavior was detected employing the scattering cross.If an anomaly was detected, an alarm was triggered.Moreover, first-order and second-order polynomial equations were utilized in order to monitor growth.The behavior of sardines, sea bass, and rockfish were studied to perform the experiments.Zhang et al. employed in [15] an imaging sonar called DIDSON (dual-frequency identification sonar) to monitor Chinese sturgeons.Swimming patterns and the length of over 2500 targets were studied in the experiments.Results showed a relation between the body length and swimming pattern and a 35.6% decrease in the length measured by DID-SON in comparison to manual measurements.Fish were found to swim close to the net and in circular motions.
Feeding is another important factor to owners of fish farms as excess feed increases the production cost and contaminates the water.For that reason, the number of researches on fish feeding solutions is constantly increasing.A fish feeding system that considered the behavior of fish in order to determine the best time to provide the food was presented by AlZubi et al. in [10].The hardware design included an automatic dispenser, a webcam, and an interface circuit.The camera detected the number of fish that went to the feeding area; when the fish learning index (FLI) was higher than the threshold, the system provided food.Results showed the variation of the number of times food is provided for eight days.Atoum et al. introduced in [16] a feeding system for aquaculture tanks that employs visual signal processing.The system included a decision-making process to determine whether fish are eating or not and detection of excess feed.Excess feed was detected employing two different methods, being a support vector machine-(SVM-) based refinement classifier and a correlation filter.Bórquez-Lopez et al. performed in [17] a comparison between mathematical functions and fuzzy logic (FL) feeding techniques for shrimp farming.Authors determined that dissolved oxygen influences the feeding rate the most (74%), and temperature influences it in a 26%.Moreover, they concluded that FL is the better strategy saving up to a 35% of feed without affecting growth or survival.Papandroulakis et al. presented in [18] an automated feeding system for intensive fish farms.The system considered the necessary amount of plankton that had to be distributed to each tank.Experiments were performed by applying the proposed method to four groups of sea bream and comparing it with the results obtained from two groups fed with the standard method.A reduction between 30% and 40% in labor was achieved, and the use of Artemia nauplii decreased by 40%.Garcia et al. presented in [19] a fish feeding system that employed sensors that determine when fish need feed.Sensors were deployed both inside and outside the cage.These were temperature, oxygen, displacement speed, biomass distribution placement, and pellet detection sensors for the internal part of the cage and presence and water current sensors for the outside.Covès et al. performed in [20] a set of experiments were an ondemand feeding system was employed to provide feed to 50 sea bass.The two experiments were conducted during 55 and 69 days, respectively.Moreover, a PIT tag was utilized to determine whether fish activated the trigger or not.Results showed that a 67% and 74% of the fish in experiments 1 and 2 activated the trigger at least once.Furthermore, two fish in experiment 1 were responsible for 82% of the triggers and one fish in experiment 2 was responsible of 77% of the triggers.Zhou et al. present in [21] a feeding decision system based on a neuro-fuzzy model and infrared computer vision.Fish feeding behavior was quantized employing an algorithm that obtains an index as a result by employing image texture and Delaunay triangulation.Another algorithm performed the decision of feeding or stop feeding the fish during the feeding process.It employed an adaptive network-based fuzzy inference system (ANFIS).Finally, weight gain, growth and feed conversion rate, and water quality were measured to evaluate the performance of the system.Results show a 98% of ANFIS decision accuracy and a reduction of the feed conversion rate of 10.77%.Lastly, Zhou et al. also present in [22] a near infrared fish feeing behavior system based on imaging techniques that employ the gray-level gradient cooccurrence matrix, the support vector machine, and the Delaunay triangulation.As a result, the flocking index of fish feeding behavior (FIFFB) was obtained.The obtained linear correlation of the FIFFB was 0.945 confirming that the FIFFB can be employed to quantify feeding behavior.
Most feeding management systems rely on fish behavior in order to determine whether fish are eating or not.In this paper, we present a system for automatic detection of excess feeding that determines if the feed is being dropped to the bottom of the cage.Moreover, the height of the cage where fish are swimming can also be detected by employing LED strips on the water tanks.

Materials and Methods
In this section, we show the system description.First, we describe the scenario where our system is calibrated and tested.In addition, we detail the hardware part of our system including the employed sensors, node, and connections.

Scenario Description.
In this subsection, we present the scenario where our system is proposed and where the sensors were calibrated.First, we describe the system and its operation.Then, we detail how we test the sensors for the calibration.
The proposed system is able to change the feed supply velocity according to the data gathered by the fish presence sensors and falling feed detector.The system is comprised of an automatic feeder tube, which allows changing the feed supply velocity, see Figure 1.Four different velocities can be selected: 100%, 50%, 25%, and 5% of the usual feed supply velocity.The system always starts to feed with the 100% of the velocity.During the feeding process, the velocity will decrease according to the sensor signals.The system is controlled by the Arduino which is placed in the exterior of the tank.
The fish presence sensors are placed inside a Plexiglas tube as it was presented in [2].A total of 9 sensors are located along the tank at different depths.The fish presence sensor is comprised of LDRs that are able to detect the changes in the received illumination due to the moving fish.The first LDR, LDR 1, is placed at 5 cm below the water surface.This is the area where the fish used to be during the feeding process.
The second LDR, LDR 2, is located at 30 cm from the water surface.The rest of the LDRs, LDR 2 to LDR 9, are spaced 15 cm apart.The Plexiglas tube with the LDRs is fixed to the tank walls in the same side where the feeder tube dispenses the feed.The Plexiglas tube is sealed in both extremes.
Finally, the falling feed detector is located at the bottom of the tank in the drainage tube.This sensor is comprised by a pellet detector sensor, and illumination is provided by a white LED.The first part of the drainage systems, which is usually comprised of an elbow pipe, will be changed to a T-shaped one, and a methacrylate separator will be added in one of the shorter sides.Thus, the camera can have full vision of the drainage system without changing the water flow.

Node and Sensor Description.
In this subsection, we present the employed sensors and the selected node are described.
One of the main elements that forms this system is the control node in charge of monitoring the swimming height of the fish.As Figure 2 shows, to develop our control node, we use an Arduino Mega 2560 Rev. 3 board.This board is based on the ATmega2560 microcontroller.It has 54 digital input/output pins (where 14 of them can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware ports), and a 16 MHz crystal oscillator.In addition, the board contains 256 kB of flash memory, 8 kB of SRAM, and 4 kB of EEPROM.The board can be powered by batteries (which is our case) or with an AC-DC adapter.
The operation of the node is as follows.On the one hand, it is not necessary that the set of LDRs is always in operation; it is only required when the process of feeding fish is carried out.Therefore, when the feeder starts pouring food into the water, the node receives a signal to start monitoring.As the fish descends, the node will send different orders to the feeder in order to reduce the speed of food pouring into the water.In this way, the amount of food thrown into the water is adapted to the amount of fish available to eat it.The other important element is the OV7670 camera which controls the point in time the feed starts to reach the floor.The OV7670 camera takes pictures with a resolution of 640 × 480 VGA and presents a high sensitivity for low-light operation.Due to its low energy requirements, the OV7670 camera module is suitable for embedded portable applications.Finally, this implies a lower waste of food which entails important economic improvements in the aquaculture production.

Results and Discussion
In this section, we are going to present the results.First, we show the tests done with the camera for feed detection.Then, the calibration of a system for locating the fish in the tank is presented.Following this, the verification process of both systems is shown.Finally, we present the operation of the system during a feeding process in aquaculture tanks.
4.1.Calibration of the Feed Detection System.In this subsection, the calibration of the feed detection system is presented.We gathered 20 pictures without feed in the water and 20 pictures with feed in controlled conditions.The pictures have a size of 640 × 480 pixels.In order to obtain the histograms, the following code is used, see Table 1.
In order to find in which part of the histogram it is possible to identify the presence of feed in the water, we represent in Figure 3 the red histogram of the pictures with feed and in Figure 4, the red histogram of pictures without feed.Figure 5 presents the green histogram of the pictures with feed, and in Figure 6, the green histogram of pictures without feed is displayed.Lastly, Figure 7 presents the blue histogram of the pictures with feed and in Figure 8, the blue histogram of pictures without feed is presented.From Figures 3 to 8, we can highlight the following items.First, the histograms of the pictures without feed are much more similar to each other than the pictures with feed.This is due to the pictures without feed being almost the same.However, the pictures with feed can be very different.In some cases, as in the pictures 28, 31, 33, 34, or 35, the feed pellets cover almost the 20% of the picture.While in other cases as 21, 24, 26, 29, or 38, the pellets cover less than 1% of the picture.Thus, there is a high heterogeneity in the pictures with pellets, which will make the correct detection of pellets in the pictures difficult.The second idea that must be highlighted is that, in general terms, the red, green, and blue histograms are quite similar.This is because the main part of the picture (the PVC tube) is dark grey and the water illuminated by the LED system is light grey.In the histograms of the pictures without pellets, we find two main groups of pixels.The first one is formed by pixels with values between 16 and 157.This part of the histograms represents the PVC tube.The second group of pixels has values between 182 and 205, which represents the water   we can observe that in the pictures with feed, there are more pixels in the darkest tones, with low values of brightness (between 0 and 15) than in the pictures without feed.This pattern is found in the three colors.Nevertheless, the difference between the histogram with feed and histogram without feed is greater in the blue histograms.
The next step is to represent the summation of the pixels with lower values of brightness.The summation is done with pixels that present values between 0 and 15.The reason to select those values is due to the pictures without feed which, in general, have a low number of pixels with brightness values lower than 15.The pictures 1 to 20 represent the pictures without pellets that appear in Figures 3, 5, and 7.The pictures 21 to 40 are the pictures with pellets represented in Figures 4,  6, and 8.In Figure 9, we present the summation of pixels with low brightness values for red histograms.The summation for green and blue histograms is presented in Figures 10 and 11.In Figures 9 to 11, we present the summation of the pictures with and without feed pellets.In Figure 9, it is possible to see that the pictures 1 to 20 have a mean value of 937 pixels with brightness values between 0 and 15.The minimum and maximum values in pictures 1 to 20 are 672 (picture 6) and 1219 (picture 4), respectively.On the other hand, the mean value in the pictures 21 to 40 is 5038 pixels.Picture 31 presents the minimum value, 42 pixels.The maximum value of pixels, 41134 pixels, is found in picture 40.Now, we analyze the data from Figure 10.In this case, the mean value of pictures 1 to 20 is 285.The mean value of pixels with brightness values between 0 and 15 in pictures without pellets in the green histogram is lower than in the red histogram.The minimum and maximum values in the summation are 154 (picture 20) and 349 (picture 5), respectively.Secondly, the pictures 21 to 40 present a mean value of 14645 pixels.The minimum value is found in picture 21 with 236 pixels, and the maximum value is in picture 31 with 62594 pixels.
Lastly, we present the summation of pixels with brightness values between 0 and 15 from the blue histogram in Figure 11.The mean value of pictures 1 to 20 is 279 pixels.The maximum and minimum values in the pictures without pellets are 105 (picture 20) and 473 (picture 2), respectively.On the other hand, the mean values of pictures 21 to 40 is 18228 pixels.Picture 40 is the one that presents the lower value, 683 pixels.On the contrary, picture 31 presents the maximum value of pixels with brightness values between 0 and 15, 74005 pixels.
As the maximum differences are found in the blue histogram, we use this histogram for further analysis with statistical software [23].The first test is a descriptive analysis to confirm or diminish if the data follows a normal distribution.The data is divided into two variables.The variable A represents the data from pictures 1 to 20, and the variable B is the data from pictures 21 to 40.The descriptive analysis of  7 Journal of Sensors 4.2.Calibration of the Fish Presence Sensor.In this subsection, the calibration of the fish presence sensor is shown.This sensor is based on the use of several LDRs placed along the tank.For the calibration of the sensor, a small aquaculture tank is employed.A juvenile of Sparus aurata is introduced in the tank, and the values gathered by the LDR and the fish movement are recorded.After processing the video, we can identify the periods where the fish is in the area of the LDR.The data of the LDR during the test is presented in Figure 12.In blue, the voltage of the sensor (Vout) in each second is represented.The periods when the fish are in the area covered by the LDR are marked in red.We can see in Figure 12 that in the periods when the fish is not present, Vout is lower than in the periods when the fish is present.When fish are not present, the values are similar, but when fish are present, the values present high heterogeneity.However, they are always higher than when the fish is not present.The data shown is gathered by the LDR placed in the upper part of the tank.The data when fish are not present have a mean value of 1.390 V and a standard deviation of 0.021.The minimum value is 1.371 V, and the maximum value is 1.467 V.When the fish are present, the mean Vout is 1.624 V, with a standard deviation of 0.096.The minimum value when fish are present is 1.479 V, and the maximum is 1.853 V.As the maximum Vout in the fish presence is lower than the minimum value when the fish is present, it is possible to use this Vout to determine the presence of fish.Now, using the statistical analysis, we are going to evaluate if the values when the fish is present are different from the values when fish are not present.The first step is to assess if the data follows a normal distribution or not.We divide the gathered data into two variables; the first one, variable A, corresponds to the Vout values when the fish is present.On the other hand, the Vout gathered when the fish is not present is considered to be the data of variable B. Variable A has 46 data in total, and variable B has 55.The descriptive analysis of variable A gives resulting skewness and kurtosis values of 2.008 and 0.316, respectively.Thus, it does not follow a normal distribution.The results of the test with variable B for skewness and kurtosis are 6.3094 and 5.696, respectively.In order to evaluate if the observed differences are statistically significant, nonparametric tests must be used.With the W of the Mann-Whitney test, we can assess if the medians of both distributions are different.The obtained p value of the test is 0; as it is lower than 0.05, the test concludes that the median of both variables is different.Then, the Kolmogorov-Smirnov test is performed in order to compare the distribution of variables A and B. The result of the test is a p value of 0.037.Thus, it indicates that the distribution of both variables is different.Finally, a Kruskal-Wallis test is done to evaluate the differences in the variance of both variables.The test result gives a p value of 0. Consequently, we can conclude that the differences found in the data when the fish is present and the data when the fish is not present are statistically significant and the sensor can be used to detect the presence of fish.Based on the obtained values, we will consider a threshold value, in order to decide whether or not fish are present, a Vout of 1.467.In this case, it is not possible to increment in a 10% the maximum Vout in the pictures because the maximum Vout without fish presence is similar to the minimum Vout with fish presence.
We need to consider the effect of light attenuation caused by the water.Nevertheless, it is important to note that on the surface there is a direct light and the water presents null turbidity.Bearing this in mind, we expect low light attenuation.In addition, in other papers [2], a similar assembly with LDR in other depths, the light attenuation observed is less than  0.05 V.The values of Vout gathered by the LDR at different depths in a tank without fish are shown in Figure 13.The maximum Vout is 1.388 V at a depth of 15 cm, and the minimum Vout is 1.355 V at 135 cm of depth.On the other side, the light increases when fish presence is higher than 0.2 V. Thus, the set threshold is useful in all the cases, for all the depths.The Vout variation in one LDR (see data in the previous paragraph) due to changes in the light source, the variation in the water surface caused by the water current and fish movement, is higher than the variation caused by the light attenuation at different depths.The effect of light attenuation in tanks can be despised, but this effect will be studied in future applications in cages in the sea.

Verification Process.
In this subsection, we detail the verification process for the two sensors developed in the previous subsections.Firstly, we will show the verification process of the feed sensors and then the verification of the fish presence sensor.
For the verification of the feed sensor, 30 new pictures were used (see Figure 14).From these 30 pictures, 15 of them, from pictures 1 to 15, were taken without feed and the other 15, from pictures 16 to 30, were taken with feed.When the selection of the 15 pictures with feed is performed, pictures with a big area covered by the feed as in 21 and 28 and pictures with a small area covered by feed as in 20, 22, and 26 are sought.After applying the same methodology, obtaining the blue histogram, and doing the summation of pixels with the brightness value between 0 and 15, the data shown in Figure 15 was obtained.In Figure 15, the blue bars indicate the summation of pixels with brightness values between 0 and 15 and the orange line marks indicate the threshold value The first idea that we want to highlight is that all the pictures are correctly classified according to the preset threshold value.The pictures without feed, 1 to 15, present a mean value of 205 pixels.The maximum and minimum values are 292 pixels and 108 pixels, respectively.On the other side, the pictures with feed have a mean value of 14427 pixels.Picture 26 presents the minimum value, 3153 pixels, and picture 28 presents the maximum value, 39112 pixels.If we compare the values in the calibration and in the verification test, we can see that, in general terms, the data from the verification test follows the same distribution with the data from the calibration test.
To facilitate the analysis of the distributions of pictures in both the calibration test and verification test, we represent in Figure 16 the box-whisker graphics.Firstly, we see the representation of the data from the calibration test with and without feed and then the data from the verification test with and without feed.In this graph, we can see a summary of the data distribution.Primarily, we want to highlight that, once more, the distribution of the data from the pictures without feed in both tests is almost the same due to the low heterogeneity of these pictures.Moreover, from the distribution of the data of the pictures with feed, we want to foreground that only in the calibration test we found outlier values.The means of both tests are very similar both for the values of pictures with feed, 279 and 205 pixels, and for the pictures without feed, 18228 and 14126 pixels.In addition, the medians are similar, 251 and 218 for pictures without feed and 8393 and 9658 for pictures with feed.We can note that the medians are much more similar than the means due to the outlier values.Finally, a median test of mood is done in order to assess if the medians of the variables from the four samples are identical or not.The result is a p value of 0. Thus, we can conclude that the medians are different.Therefore, we can conclude that the verification test confirms that the proposed sensor can be used to differentiate the presence or absence of feed and the value of 520 pixels is an optimal threshold value.
Following this, we present the verification process of the fish presence sensor.We repeat the same set up as in the calibration process.The data gathered in the verification test can be seen in Figure 17.Vout values are represented in blue, and the periods when fish are present are indicated in red.The set threshold in Section 4.3, 1.467 V, is shown as a black line.In general terms, we can see that the data from the verification test confirms the conclusions of the calibration test.From the 45 gathered values, 10 of them are gathered in the presence of fish.Those 10 values have a mean of 1.615 V.The maximum value is 1.802 V, and the minimum value is 1.490 V. On the other hand, the values gathered without the presence of fish have a mean Vout of 1.368 V.The minimum and maximum gathered values of Vout are 1.388 V and 1.354 V, respectively.After comparing the values of the calibration and verification tests, it seems that the data follows a similar distribution.
With the purpose of facilitating the comparison of the distributions of the gathered Vout in both the calibration test and the verification test, we represent the box-whisker graphic of these data in Figure 18.We represent the data from the calibration test with and without fish presence and then the data from the verification test with and without fish presence.The first idea that we want to highlight is that the distribution of the data from the verification test and the calibration test gathered with fish is much more similar to each other than the data without fish.The means of the gathered Vout without fish are 1.390 V and 1.368 V for the calibration test and the verification test, respectively.On the contrary, the means of Vout with fish presence are 1.624 V for the calibration test and 1.623 V for the verification test.Moreover, the medians are also similar in the verification and calibration tests.The medians of Vout with fish presence are 1.381 V and 1.369 V, and the medians without fish are 1.607 V and 1.602 V for the calibration test and the verification test, respectively.Finally, a median test of mood is done in order to assess if the medians of the variables from the four samples are identical or not.The result is a p value of 0. Thus, we can conclude that the medians are different.Therefore, we can conclude that the verification test confirms that the proposed sensor can be used to differentiate the presence or absence of fish and the value of 1.467 pixels is an optimal threshold value.4.4.Simulation of the Feeding Process.In this subsection, we show the gathered data during a simulated feeding process.It is known that during the feeding process, the fish shoal rises to the water surface to eat [10].Thus, when the feed process starts, the fish presence will change, and this change will be detected by the presence sensors.During the first minutes, the fish eats all the supplied feed.However, not all the fish eat at the same time and in the same way.The bigger and more aggressive fish are the first to consume the feed.A few minutes later, when those fish are satiated, the rest of the fish start to eat.At this moment, part of the feed may start to fall.Therefore, it may be necessary to reduce the velocity of the supplied feed to avoid feed waste.Nevertheless, usually the feed is supplied with the same velocity all the time.Our system can detect the falling feed in order to reduce the velocity of feed supply.
For our system, the data from the feed presence and the falling feed is used.The purpose of using both data is due to the data of the fish presence indicating if they are eating or not.However, the data from the falling feed indicates the amount of eaten feed.Therefore, for an optimal monitoring, both data are needed.The data from fish presence acts as a 10 Journal of Sensors trigger for turning off the system while the data from falling feed will trigger the changes in feed supply velocity.The operation algorithm can be seen in Figure 19.
When the feeding monitoring system turns on, the first step is to define the order of the analog inputs 1 to 9, which represent from Vout 1 to Vout 9.The Vout 1 is the Vout of the LDR placed at 5 cm above the water surface.Then, the system starts to gather values from the LDRs.If the Vout 2 to 9 are lower than 1.467 V, it means that the whole shoal is in the upper part of the tank and all of them are eating.Thus, the feed velocity must be maintained in 100% and new data must be gathered to continue with the monitoring.Nevertheless, when Vout 2 to 9 are higher than 1.467 V, it means that the whole shoal is not in the upper part of the tank and not all of them are eating.To be sure if all the supplied feed is being consumed, the falling feed system is turned on at 30 s.Then, the pictures are analyzed; if none of the pictures has a summation of pixels greater than 520 pixels, it means that the feed is being consumed, no changes are done, and new data is gathered from the LDR.However, if any of the pictures present a summation of pixels higher than 520 pixels, it indicates that not all the feed is being consumed.Therefore, the feed supply velocity must be reduced to 50% of the initial velocity.Again, the data from the LDR is gathered; if the Vout 1 is higher than 1.467 V, it means that none one fish is in the upper part of tanks and we stop the feeding process.However, the expected situation is that some fish may still be eating in the upper part, resulting in the Vout 1 being higher than 1.467 V.After 1 minute, the camera system is turned on again for 30 seconds.If any of the pictures detect falling feed, the velocity of feed supply will change to a 25% of the initial velocity.
The same system described to change from 50% to 25% of the velocity is used to change from 25% to 5% of the initial velocity.The 5% speed is the slower velocity that can be offered by our system.In order to turn off the system, we use the variable of fish presence.At the moment, when the system detects that there are no fish in the upper part of the tank, the feed suppliers stop feeding.Moreover, the system sends all the gathered data, and then, the system is turned off until the beginning of the new feeding period.
The system uses fish detection as the trigger because we need to ensure that all of the fish have the possibility of eating the feed that they need in order to maximize the fish growth.And it is known that not all the fish eat at the same time.If we do not consider the fish position, our system will stop feeding before all the fish can be satiated.Thus, a decrement on the fish growth will be caused resulting in a reduction in the productivity.On the contrary, if we only use the fish position for the monitoring system, we will not be able to know how to diminish the feed supply velocity and much more feed will not be consumed.Consequently, there will be a percentage of feed waste, which will produce a reduction in the profit of the fish production.Now, we show the result of applying the algorithm to the data of a simulated feeding period, see Figure 20.We can see the data from the fish presence in Figure 20, feed presence (0 or 1), and feed velocity (100% to 0%).The data from fish presence represents the typical feeding behavior during a normal feeding process.During the first part of the feeding process, all the fish are in the upper part and the Vout of the sensors 2 to 9 give values lower than 1.467 V.Then, the fish presence in the positions 2 to 9 (fish presence 2 to 9) is equal to 0. And the fish presence in the position 2 (fish presence 1) is equal to 1 because the Vout of this LDR is higher than 1.467 V. Nevertheless, at second 450, some of the fish move to the lower part of the tank.Thus, the fish presence 2 to 9 is equal to 1.At this moment, the camera system for 11 Journal of Sensors feed detection turns on.During the first record, no picture shows a summation of pixels higher than 520; thus, the feed presence is 0. Therefore, the feed velocity remains at 100%.After 1 minute, the camera test is repeated.In this case, the pictures reveal that there is falling feed.Thus, the feed velocity decreases to 50%.At second 720, the camera detects again falling feed and the velocity is reduced to 25%, and at second 810, the feed velocity decreases to 5%.The feed period ends at second 990 when no fish are detected in the upper part of the tank.

4.5.
Comparison with Current Systems.Currently, the systems to optimize automatically the feed supply in fish farms are very different from each other.First, we found systems with the purpose of determining the best moment to feed as in [10,17].Other systems are for on-demand feeding [20] or are used for feeding with plankton [18].There is one paper that uses falling feed as the only measure to decrease the feed velocity [19].Finally, there is other proposed system [16] that uses a combination of fish presence and falling feed for adjusting the feed velocity.Nevertheless, they use an overhead camera to determine the position of the fish.Thus, this system is not able to differentiate when the fish are in the upper part of the tank and are eating feed or when they are in the lower part of the tank and they are not eating.
The sensors and algorithm presented in this paper suppose an improvement of the current methods for adjusting the feed supply to the fish needs.Moreover, the low cost of the employed components facilitates the possibility to implant this system in aquaculture tanks.

Conclusions
In this paper, a system for automatic adjustment of feed supply velocity for aquaculture monitoring has been shown.The system is comprised of a fish detector sensor based on multiple LDRs and a falling feed sensor based on a CMOS sensor.The sensors shown in this paper can be used to improve the efficiency of the aquaculture feeding process.The sensors are comprised of simple electronic components and can be connected to an Arduino node.The calibration has been shown, and the threshold values for detecting fish and feed presence have been found.Moreover, a verification  test was done in order to ensure that the threshold value set in the calibration are acceptable.Both verification processes show that the calibrations were done correctly.In addition, we show the operation of the proposed system during a simulated regular feeding process.
As future works, we want to test our fish presence sensor with other fish species.Moreover, we want to test the system for larvae fish, considering no systems are developed to adjust the feed due to the small size of fish and the small size of feed.In addition, we plan to use other light sources as color LEDs to illuminate the drainage to differentiate pellets from faeces.The possibility to use different light sources to differentiate substances in the water has already been for turbidity [24].In addition, the minimization of the nodes and available sensors is facilitated to monitor the vital sings of fish as it was already done with other animals [25].The inclusion of similar systems for fish monitoring will help to improve the fish welfare.

Figure 1 :
Figure 1: Proposed system for feed supply.

Figure 5 :
Figure 5: Green histogram of pictures without feed. ,

Figure 11 :
Figure 11: Summation of pixels with brightness values between 0 and 15 in the blue histogram.

Figure 13 :
Figure 13: Effects of light attenuation in the Vout of the LDR at different depths.

Figure 14 :Figure 15 :
Figure 14: Employed pictures for the verification test.

Figure 16 :
Figure 16: Box-whisker graphic of summation of pixels with brightness values between 0 and 15 in calibration and verification test.

Figure 20 :
Figure20: Result of applying the algorithm to the data of a simulated feeding period.

Table 1 :
Code for obtaining the histograms.