MULTI-CHANNEL FRY COUNTER DESIGN USING OPTOCOUPLER SENSOR

This paper describes a design of a fry counter intended to be used by consumption fish farmer. Along this time, almost all the fry counting processes are counted by manual, which is done by human. It is requiring much energy and needs high concentration; thus, can cause a high mental and emotional exhaustion for the fry counting worker. Besides that, the human capability and capacity for counting the are limited to a low number. A fry counter design in this study utilizes a multi-channel optocoupler sensor to increase the counting capacity. The multi-channel fry counter counting system is developed as a solution to a limited capacity of available fry counter. This design uses an input signal extender system for the sensor. The design is based on the interrupt combiner to accommodate multi-channel sensor used. Besides, the transmitter beam's angle is adjusted to deal with the deflection due to water surface. From the experiment, multi-channel sensor can be implemented and high accuracy level could be obtained on the counting and channel number detection, therefore, this design can be implemented and could help farmers to increase the production capacity of consuming fish.


INTRODUCTION
The development of agricultural products continues to be carried out by applying technology to increase production [1].No exception for the production of inland fisheries, supply-demand is increasing and the suppliers must be ready to increase the production.One of the problems in the fishery is the existence of several production processes that are still done manually, which are exhausting energy and costs.An example is the process of fry counting.The counting of fry that reaches tens of thousands of fries manually causes inefficiency and bad health effect to the employee.This method can also cause calculation inaccuracy and stress on the fry [2].Some researchers made a fry counter that works based on optical sensors, but the performance of the device still has some disadvantages such as less capacity and large measurement errors as shown in [3][4].The lack of capacity is caused by the limited channel due to the limited interrupt channel on the used controller, and the large measurement error is caused by the overlapping fries.The other method of fry counter is by using image processing as described in [5][6].Their method is rather complicated and has a low accuracy due to the crowd of fry.Regarding these problems, which are still following the developments of the fry counter, some improvements on the performance of fry counter should be done such as increasing the capacity and improve the detection accuracy.

Opto-coupler Sensor
The optocoupler sensor for the fry counter is designed using an infrared light transceiver system.The sensor configuration forms a straight line, where the light from the transmitter will pass to the receiver when there is no object.But if there is object in between, then the light from the transmitter will be blocked and the receiver will not receive the light.At that time the controller will increase the counter of the number of fry that passes through the sensor with one count increase.Infrared light transmitters are in the form of a LED that produces light with infrared wavelengths.As a receiver, a photo-transistor is used that will experience saturation if it receives the infrared light.In this receiver transistor, a resistor at the collector terminal needs to be added, so that it can operate because the transistor is open drain type.The schematic of optocoupler sensor is shown in FIGURE 1.
From the figure, the transmitter has a current limiting resistor R1.This resistor determines the current flowing on the LED, which then determines the intensity of the light emitted by the transmitter.If the sensor is less sensitive, it can be tried to increase the light intensity of the LED by reducing the value of R1.Resistor R2 on the receiver is a pull-up resistor to lift the receiver's output voltage when it is not receiving the light.This resistor can be valued about 10 kΩ.Whereas for R1, the value is determined by the maximum current that can be accommodated by the LED and forward voltage of the LED.The equation to determine R1 is as follows Where   is the power supply voltage,   is the forwad voltage of LED, and   is the LED's current.

Electronics System
The number of channels of optocoupler sensors is added by using input-output (I/O) expander to overcome the lack of interrupt ports on the controller [3] and limited sensors [1].This expander I/O uses an IC which has 8 pieces of I/O that can be read and written through an I2C communication device, so it does not require many interrupt ports on the controller.Here, only 2 ports are needed for I2C communication.A total of 8 I/O expanders can be combined in one I2C communication bus.Each I/O expander has its own address.Thus, the total number of I/O ports that can be installed is 64 channels, and one channel can be installed for one optocoupler sensor.This expander I/O also has an interrupt output that can give a notification if there is a change in logic state on the channel.This interruption can be connected to the controller for the counting process.The interrupt output of each I/O expander can be combined into one interrupt channel using an "OR" gate to be connected to the controller.So that only one interrupt port is needed on the controller, there are not many ports needed for interruptions especially many controllers as in [3].Besides, to issuing interrupt marks, the state of the logic port on the I/O expander can also be read to find out on what canal the fry is detected.The block diagram of the electronics system is shown in FIGURE 2. From FIGURE 2, each part of the electronic system can be seen.The optocoupler sensor consists of a pair of transmitters and receivers, as well as a comparator.The output of the sensor in the form of a digital voltage is a result of an analog voltage comparison of the phototransistor output with a reference voltage that comes from a voltage divider of Vcc/2.Digital output from the comparator usually still contains noise which can cause many interruptions.In this case, sometimes a Schmitt trigger is needed to sharpen the digital signals.The sensor output is then connected to the I/O expander port.In this case the I/O expander port functions as input.The output of I/O expander is read through the interrupt port and I2C communication by the controller.In the design of this system, two I/O expanders were used.So that the sensor can be connected as many as 16 sets.
Interrupts combiner combines many interrupt signals from I/O expander into one interrupt output that will be connected to a controller interrupt port.This merger uses the "OR" logic gate.So if there is only one I/O expander that experiences an interruption, the interrupt signal will be forwarded to the controller.Once an interruption occurs, the counter will increase and the I/O expander logic port state will be checked through I2C.The checking process must start quickly before the sensor logic output state changes again as before.All counting processes are controlled by a controller, which is built by a microcontroller ATmega328 made by Atmel.This controller has I2C communication features and 2 channels of external interruptions, so it can be used directly for this system.The results of counting the number of fry and the position of the sensor that detects the object are displayed on a 2x16 character LCD.Users can see the displayed number on the display to know the number of fries that pass through the sensor.It is seen from the flow-chart diagram that the main program only contains continuous delay routines.Port or channel readings must be done as quickly as possible after an interruption if not, the reading will experience an error because the sensor output logic state has changed again as before.Besides, checking changes on each port is also done to ensure which ports are changing.

Experiments
To evaluate this system, five different ports of I/O expander are used, thus there are also five channels of fry detection sensor involved.The top view of the mechanical system is shown in figure 4. Five channels and five sets of the sensor are depicted in the figure.To make the flowing fry-contained water, the system is tilted with 30° angle from the horizontal plane, where the inlet is made higher than the outlet.
The test is carried out as an accumulation of the performance test of the sensor sensitivity, the accuracy of the interrupt signal, and the reading of the channel number.These three factors are very important and affect the performance of the measurement system.Sensor sensitivity depends on distance, so it must be adjusted to the width of the fry detection channel.A weak signal will make the sensor unable to capture the signal properly.This situation can change the signal that should be "ON" to "OFF".Of course, this will result in reduced accuracy.The accuracy of the interrupt signal is also very influential on the accuracy of the system.Unstable interrupt signals will cause the counting to be double, triple detection, and so on, so that, it also causes a reduced level of accuracy.The channel number reading is intended to find out the sensors that are passed by the fry.So with this feature several fish storage containers can be made.The experiments of the system testing are done by passing some objects on 5 sensors as much as 50, 40, 30, 20, and 10 times on each tested sensor.The number of the objects passed on the sensor and the counting results are recorded.The channel number readings are also tested for 50, 40, 30, 20 and 10 times for each channel.The channel number reading will be recorded and analyzed.

RESULTS AND DISCUSSIONS
The test results of the system for sensor sensitivity have shown that the fry counter system can work well.In standby condition, the sensor output logic is fixed "LOW" and does not change which indicates that the receiver is quite stable and sensitive enough to the light emitted by the transmitter.But when there is an object blocking the light, the sensor output will be kept "HIGH" and remain stable which indicates that the receiver is not overly sensitive to the possibility of light that can reach the receiver due to reflection.The electronic system is shown in FIGURE 5. When an object or fry passes through the sensor, the counter on the display will increase by a number.The system did not experience failed detection e.g. over counting, which will cause the counter to increase more than a number, or vice versa, which would cause the counter not to increase with a number.This indicates the interruption system is very stable.The interrupt system can only produce an unstable signal because of a change in the digital voltage caused by a unsmooth sensor output, which in turn will cause a counter changes of more than one number because of multiple interruptions for each object passing through the sensor.
The results show the possibility of using interrupts combiner for multi-channel fry counting.
The built system in this study only used one channel interrupt in the controller, but it can accommodate five channels of fry counting.The hardware design of multi-channel interrupt is simple, but the algorithm that receives the signals must be able to process these signals that could come simultaneously [7], otherwise the controller would count only one counting or stacks due to mistake of interrupt handling.
The selection of the transmitter's angle beam is also important in this application.Too narrow angle beam will cause a very sensitive response of the sensor to the water flowing together with the fry.This beam is easily deflected by the water surface and causes the activation of the interrupt.Consequently, this will cause an error counting.Therefore, a larger angle beam is preferred to avoid easy deflection of the beam caused by the water surface.
The test results of channel number readings did not experience any errors at all.The displayed channel numbers are never different to the channel numbers where the fry passed through.This means the reading processes have good accuracy.The results of system evaluation are shown in TABLE 1. From the table, the calculation results have a small maximum error, which is 2%.This result is better than the results of the study from [3][4]8], where their errors are more than 5%.The errors in channel numbers reading do not occur at all.The errors in calculating the number of objects are mostly due to the irregular morphology of counted objects.So that one object can trigger the sensor more than once.In terms of system design, it has a fairly high level of accuracy.

CONCLUSION
Based on the results obtained from the studies conducted, it can be concluded that the design of the fry counter system that has been made has a high degree of accuracy.The maximum error that occurs in the testing process is only 2%, much smaller than the results of other studies.Errors that occur are not due to system design weaknesses but due to irregular object morphology.For this reason, further, development is needed beyond the topics discussed in this paper.The development can be in the form of adding algorithms that accommodate irregular shapes of objects.

FIGURE 2 .
FIGURE 2. Block diagram of the electronics system.
the fry counting system is made with Arduino IDE.The program works by relying on interrupt features.So, the program only waits for interruptions from the controller port, increases the counting counter in the register, and then reads on what I/O port or channel the fries are detected.The flow chart of the program is shown in FIGURE 3.

FIGURE 3 .
FIGURE 3. Flowchart of software of fry counter system.

FIGURE 5 .
FIGURE 5.The electronics system of fry counter.

TABLE 1 .
Test results of fry counter system