Near Infrared Sensor Setup for General Interface Detection in Automatic Liquid-Liquid Extraction Processes

This work presents a novel sensor setup for the general detection of liquid-liquid interfaces in different mixes of liquids as part of a liquid-liquid extraction device. The sensor setup is applied to a laboratory scale separatory funnel. It uses a near infrared sensor array which receives light going through the liquids inside the funnel, which are illuminated by a light source located on the other side and below the funnel. Light refracts inside the funnel and the liquids and reflects on the interface creating changing patterns in the light intensity measured by the sensor, providing a way of locating the liquid-liquid interface. Liquid mixes with different optical features, from transparent to opaque, emulsion and clean, are used to test whether different types of interfaces produce a distinguishable response on the sensor, allowing to detect interfaces in different situations that can occur as part of an Artificial Intelligence orchestrated battery chemical synthesis process. Emulsion interfaces create a discernible change in the sensor input by lowering the light intensity registered when crossing in front of the sensor making them easier to locate than with other optical techniques. The setup opens the possibility of detecting a liquid-liquid interface as it is forming and can be miniaturized to be attached to laboratory funnels as a manual aid or used with other transparent vessels in automatic solutions like liquid handling robots or pipetting robots.


I. INTRODUCTION
L IQUID-LIQUID extraction is a well known process in chemistry in which different compounds are separated by putting them in contact with two immiscible liquid solvents, usually an aqueous solvent and an organic solvent. Compounds transfer to these solvents based on their solubilities. Commonly the mix of compounds containing the compound of interest is already dissolved in the aqueous solvent, which is called the feed, so that when the organic solvent is added and mixed the compound of interest transfers from one liquid to the other. All substances involved are mixed together so that the organic solvent can come in contact with the compound of interest as much as possible. After mixing, the mixture of liquids is allowed to settle. Meanwhile, the difference in densities between the aqueous and organic parts of the mixture separates the liquids, forming an interface. The final solvent phase containing the compound of interest is usually called the extract and the other phase is called the raffinate. Liquid-liquid extraction as a unit operation lies at the heart of many chemical processes, as well as at metallurgical (e.g. extraction of cadmium), pharmaceutical (e.g. production of antibiotics by fermentation) and food industry (e.g. production of essential citrus oil) processes [1].
Among the areas mentioned is the synthesis of coating materials for electrochemical battery interfaces. Research in this area has concentrated in the formulation and discovery of battery interface materials with features that can help solve the problems of dendrite formation and rapid battery degradation. This is one of the aims of the Battery Interface Genome Materials acceleration platform (BIG-MAP, https://www.big-map.eu/). This project strives to accelerate battery interface material discovery by orchestrating simulated and experimental processes with Artificial Intelligence (AI) algorithms. As part of this orchestration, AI algorithms should be able to simulate, synthesize and test different chemical formulations for coating battery materials in the laboratory as part of automatic data collection, optimization and train-This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ ing for machine learning techniques [2]. Thus an automatic liquid-liquid extraction device capable of detecting and separating different mixtures containing liquids and liquid-liquid interfaces with different properties is needed for an AI guided experimentation system. Moreover, battery interface coating material synthesis processes make use of aggressive chemical compounds e.g. Dicholormethane that can attack different materials increasing the chances of process contamination.
Different automatic liquid-liquid extraction solutions have been devised. These range from specialized flasks that rely on the different properties of some liquids to mix and separate the substance of interest into different chambers, to mechanized solutions like mixer-settlers, extraction columns and centrifuges [3]. Microfluidic and High Throughput Systems (HTS) have also integrated the liquid-liquid extraction process in different ways: from using membranes that reject one of the liquids while allowing the other to pass, to using droplets of solvent placed in the tip of pipettes that interact with just the right amount of feed in automatic pipetting robots. Alexovič et al. make a very detailed review of dispersive and non dispersive technologies for liquid-liquid extraction in HTS setups [4]- [6].
However, existing automatic solutions are heavily customized towards specific chemical processes. This is a consequence of the emphasis of the devices in producing high volumes (e.g. mixer-settlers, extraction columns) or testing several times for the substance of interest in very low volumes (e.g. droplet methods, microfluidic devices). Customization makes sense in industrial settings as the devices and their sensors would be performing the same operation, with the same liquid solvents, time and time again [7]. Nevertheless, if the chemicals change, adjustment and reconfiguration of devices and sensors is a task that requires a great deal of human resources. Tailoring devices for different chemical flows is a process that usually takes days and requires piloting with scaled down versions of the final devices [8]. A more general approach, that could detect and separate different chemical mixes with minimal human intervention, is highly desirable.
As part of achieving such general automatic approach, first the problem of how to detect liquid-liquid interfaces with different properties with the same sensor setup must be solved. Liquid-liquid interface detection by itself is an important procedure in different areas, like oil and gas (e.g. for separating oil and water in tanks) [9] and in the detection of biological compounds [10], [11].
Among several sensor technologies used for liquid-liquid interface detection [12], one of the most used is the conductivity sensor. These sensors usually work by measuring the conductivity of the medium between two electrodes by means of measuring its electrical capacitance or resistance [13]. For detecting an interface the liquids must have a relatively high difference in conductivity (usually 1000:1). This is often the case in liquid-liquid extraction as organic and aqueous phases have different conductivities. However, electrodes must come in contact with the liquids, leading to possible contamination that can affect the electrochemical synthesis process downstream. Contactless conductivity sensors have also been developed using induction coils [14], [15], however they are not very sensitive to non conductive liquids.
Other types of sensors for liquid-liquid interface detection have been developed specially for the oil industry [16], where separating oil and water in tanks is a very important and common problem. These include ultrasonic sensors, which have increased their reliability thanks to machine learning and signal processing algorithms [9]. Nevertheless, for this purpose they also need to come in contact with the liquids [17], another disadvantage is that their precision diminishes when emulsion layers are present. Contacting the liquids is also a problem for radar sensors that make use of a waveguide to measure interfaces [12]. Differential pressure sensors and vibration paddle sensors provide mechanical ways of measuring the interface but apart from necessarily coming in contact with the liquid the first ones are affected by temperature changes and not good with liquids with close density, and the second ones are affected by turbulence as the liquids move around them. Contactless microwave sensors have also been developed recently but they have not been explored in relation to emulsions [18].
The manual laboratory process of liquid-liquid extraction relies on visual inspection of the liquid mixture and interface inside glass vessels, light sensors thus come to mind as a contactless sensor alternative. Light sensors can be installed outside of glass flasks or tubes, or other kind of transparent parts, so that the liquids do not come into contact with any part of the sensor, different substances properties can be identified by the way they absorb and reflect light, light sources and detectors, including cameras, have become smaller and cheaper; and finally, optical data analysis techniques have reached a high level of maturity in recent years [19].
Light sensors come also with shortcomings. First, they are very sensitive to varying light conditions and must be shielded from external light sources whenever possible. This prevents them from working reliably outside test and laboratory conditions [2], although this can be mitigated with calibration techniques. Another limitation is that some substances are sensitive to specific light wavelengths, e.g. ultraviolet, and can have their properties changed as a result of exposing them to light sources. Optical sensors are also limited to processes that do not prevent light in the bands measured from passing through or that do not coat the insides of the container, or leave residues through caking or fouling processes.
The main contributions of this work are the description and testing of an interface detection sensor setup able to detect liquid-liquid interfaces in mixtures with different properties for its use in a laboratory scale liquid-liquid extraction device that is part of an AI guided experimentation system. The use of a light sensor, that encompasses an array of photo detectors for different light wavelengths in the Near Infrared (NIR) range, and a novel arrangement that takes advantage of the light reflecting on the interface is investigated for its capacity to provide a distinguishable response for different interfaces with varying optical features. Different mixtures of liquids, from transparent to opaque, liquids of different colors and liquids with similar characteristics to the naked eye, are created to emulate different interface conditions that are challenging for other optical methods, e.g. emulsion interfaces. Measures are characterized, and related to the position of the interface crossing in front of the sensor in different detection stages.
Data is automatically generated using the sensor setup attached to a normal glass separatory funnel. Results show that the interfaces tested create a distinctive pattern in the light intensity measured by the sensor in different channels, that makes them detectable.
The next section presents the related work in the photoelectric sensor area, section III describes the methodology used including an analysis of the different stages that the sensor setup sees when the interface crosses in front, section IV describes and analyzes the features of the liquid mixtures used with regard to the sensor, and finally section V summarizes the conclusions to the article.

II. RELATED WORK
Light sensors have been used successfully in the detection of a vast array of different substances and phenomena. Different ways of optical transduction have been developed, from absorbance to reflectivity, to the use of fiber optics [20], and used to detect different materials or substances of interest.
McDonagh et al. [21] provides a comprehensive overview of optical sensor transducers and their applications.
Since the invention of the LED, photodetectors based on electronic devices have been developed and have diminished in size as well as increased their versatility, e.g. increasing the range of light wavelengths diodes can emit and detect. Several applications in chemistry have integrated this technology, including spectroscopy and chromatography devices [22]. Moreover, portable high performance spectroscopy and chromatography devices have been in use commercially for some time thanks to miniaturization [23]. Small detectors are also being incorporated in wearable and wireless sensor networks [24]. This is an advantage as small detectors can be quickly adapted to existing laboratory equipment for the detection of interfaces.
One of the underlying principles of operation of optical sensors is the measure of light intensity, which is later processed to obtain measures of absorbance or reflectance [22]. It is for this reason that shielding from external, non controlled light sources that can change the intensity of light is a must when using optical sensors. Other, more elaborated methods take advantage of the reflection/refraction properties of the medium and substance of interest, this is the case in fiber optic sensors [20]. Fiber optic sensors have also been used for detecting liquid-liquid phases but they must come in contact with the liquids [25] or be bundled with other transducers [26]. These principles of operation are also used to physically detect the location of objects and are well established in industrial settings [12]. Taking advantage of the optical features of interfaces and how they affect intensity measures, an optical sensor can more reliably discover the interface location under different conditions. In Vietinghoff et al. [27], for example, optical properties of interfaces in capillary tubes are used to detect different phases in the flow of a micro reactor.
Cameras and image analysis are a special case of using optical properties of different substances to detect their location and in some cases their composition [19]. Images provide spatial intensity information. Different machine vision approaches have been developed using cameras for chemical process detection [19], [28], surveillance [29] and automation [30], [31]. Interface detection has also been studied using imaging systems with different approaches, including the use of floaters [32] for specific chemical mixes and machine learning approaches like Convolutional Neural Networks (CNN) for a more general approach [19].
CNNs have demonstrated to be effective at identifying flasks, liquids and solids, as well as levels, but have struggled in reliably detecting liquid-liquid interfaces [19], [33]. In [28] Eppel et al. describe the main causes for missing liquid-liquid interfaces in machine vision approaches, weak interfaces and dispersive interfaces are part of the top causes. Bellman et al. [34] also describe how liquid transparency affects the correct draining of one of the liquid phases by a pipetting robot. Although providing more information than other light sensors, imaging approaches can in some cases provide too much information making detection more complex. This is the reason why many works involving cameras try to simplify different aspects, like using only one color for backgrounds, controlling lighting conditions, establishing regions of interest, etc. in the same direction as light shielding is used for simpler light detectors [30], [31], [33]. This makes the case for using simpler arrays of detectors, which can provide enough relevant information, but without making the problem too complex. This increases the reliability of the sensors and allows the sensor setup to detect interfaces with different optical features, by looking for changes in the light measured. Moreover, it also opens the possibility of detecting similar changes and patterns in interfaces that have not been tested before.
This work makes use of a light detector composed of an array of detectors at different wavelengths. Arrays of simple sensors have the advantage of providing varied information about what is being measured and allow detection without dealing with a high level of complexity.

III. METHODOLOGY
To be able to tap into the experience of chemists working on the battery synthesis processes in BIG-MAP, the setup used is built around lab scale separatory funnels, in this case a 250 ml Lab Scientific separatory funnel with a PTFE stop valve. The funnel is inserted in an automatic data logging device that includes the sensor setup, a seal and reduction, a light shield enclosure, an external reservoir, and dosing pumps to move the liquids around. A diagram of the device is depicted in Fig. 1.
In order to pump liquid in and out of the funnel, the dosing pumps connect the funnel to an external reservoir in the form of a 250 ml bottle. We have used 12V DC motor powered peristaltic dosing pumps with a max flowrate of 100 ml/min. The bottle and the pumps are connected using 3.2 mm internal diameter (ID) silicone tubes. One of the pumps extracts liquid from the reservoir and inserts it in the funnel from the top using another 3.2 mm ID silicone tube.
The bottom of the separatory funnel, after the valve, is sealed against a 9.5 mm ID PVC tube using PTFE tape. The 9.5 mm ID tube is connected through a series of reductions to a 3.2 mm ID tube and then to the second pump. Thanks to the seal created by this last pump and the 9.5 mm ID tube-PTFE assembly, the level of liquid inside the funnel can be automatically controlled when draining the funnel and thus the funnel valve is kept open. The last pump is connected back to the external bottle reservoir.
On the sensor setup side, a photoelectric sensor array that detects light intensity at different wavelengths in the NIR frequency range (610 nm to 860 nm) (Sparkfun Triad spectroscopy sensor, AS7265x) is used. The sensor is placed close to the bottom valve of the funnel (See Fig. 1a). Sensitivity is configured with 64x gain and an integration time of 140 ms, we refer the reader to the sensor datasheet (https:// cdn.sparkfun.com/assets/c/2/9/0/a/AS7265x_Datasheet.pdf) for more information on the optical characteristics of the different measuring channels. Due to its aperture the sensor has a detection zone extending in a cone from its center. The detection zone is warped and shrunk by the effect of the refraction of the glass walls and the liquid in different phases, making rays that come from below and front and that are reflected in the interface more likely to hit the sensor, this, of course, depends on the max angle of reflection of the interface (Fig. 3).
We have positioned the light source on the other side of the funnel, below the detection zone of the sensor. Light is produced by two identical white LEDs (450 nm-700 nm) fixed behind a light diffuser (Fig. 1b). In this way light can enter the funnel, refracting as it comes in contact with the liquids, and reflecting on the liquid-liquid interface, and finally reaching the sensor (See Fig. 3). Positioning the light source out of the detection zone of the sensor also prevents saturation. The setup is shielded completely from external light with an external frame that completely covers the funnel and sensor setup. This external shield is built as a cube with black cardboard panel sides. Corners and vertices of each face are fixed on top of each other in order to prevent any light from coming in through them, the cube shield rests flat on a table (See figure 2a), holes for protruding parts are fit tightly against the parts. Additionally, to ensure controlled light conditions all measures were performed at night time. Six channels in the range from 610 nm to 860 nm are measured, however the sensor is also capable of registering light inside the visible light spectrum with another 12 channels.
When everything is in place, previously mixed liquids are poured in the external reservoir bottle and pumped into the funnel. In there, mixtures rest for a predetermined amount of time (200 s). This time is the same for all liquids and is calculated experimentally by observing the mixtures after refilling the funnel multiple times and waiting until an interface is detectable by the human eye. The dosing pump causes only a minimal amount of mixing between the liquid phases.
The mixture is then drained 1ml at a time using the draining dosing pump in order for the interface to move in front of the sensor, creating a detectable change in intensity. This outflow rate is the same for all draining steps and for all liquids involved.
In order to test the photoelectric sensor setup, assert its limitations and determine whether a distinguishable response is produced for liquid-liquid interfaces in different cases, we use different liquid mixtures with different optical properties. These mixtures include transparent as well as opaque liquids, immiscible liquids with similar optical properties to the naked eye, liquid mixes that create interfaces as clean as possible and liquid mixes that create interfaces with emulsion.

A. Detection Stages
As the different liquid mixtures, and their interfaces, move in front of the sensor, different stages are identified from the measures collected by the sensor: 1) No interface (Fig. 3): When no interface is inside the sensor detection zone, light is scattered by the liquid, and shone into the sensor, setting an intensity threshold that depends on the features of the liquid. 2) Interface entering sensor detection zone (Fig. 4): As the interface comes into the detection zone, light will reflect into it and into the sensor increasing the intensity measured (Fig. 4a), this increase may start even before the interface enters the sensor detection zone depending on the bottom phase transparency. With an emulsion interface, light can get scattered due to the dispersive nature of the emulsion, some of this light will still increase the intensity registered by the sensor (Fig. 4b).
3) Interface in front of the sensor (Fig. 5): When the interface comes approximately to the middle of the sensor detection zone in front of the sensor, the intensity registered by the sensor increases as more light reflected in the interface lands in the sensor (Fig. 5a). The intensity registered by the sensor should come to its maximum value in this phase. In the case of an emulsion interface (Fig. 5b), light scattered by the dispersive nature of the interface could also reduce the light intensity registered by the sensor. 4) Interface exiting sensor detection zone (Fig. 6): As the interface exits the detection zone the top phase sets a threshold for the intensity measured. Before this, an emulsion interface will have lowered the intensity to a local minimum as it disperses more light than a clean interface. Air allows light to pass easier than liquids, thus a similar peak is detected for the air-liquid interface as this interface approaches the upper detection zone of the sensor, this peak will also be higher than in the liquid-liquid interface case due to the difference in refraction index (Fig. 7), which allows more light to be reflected.  As the liquid is drained from the funnel ml by ml light is measured with the sensor. A total of 140 draining steps are registered and stored for later analysis, enough to evacuate all liquid from the funnel into the external reservoir bottle.  Between ml drain steps the mixture is left to rest for 1.5 s before the next milliliter is drained. After all liquid is evacuated from the funnel, the mixture is then pumped again into the funnel, and allowed to settle for 200 s, so the process of draining and measuring can start again.

IV. RESULTS
As mentioned in last section, we have chosen different liquid mixtures with different optical properties for testing the sensor setup capability to detect an interface in different cases. Table I shows the six liquid mixtures used and their features. 1 Each mixture is moved through the funnel-sensor setup a total of 5 times. Fig. 9 and 10 show how each of the mixtures described in Table I   measures taken on the right. Figure 8 shows an example of a sensor measurement plot graph and how the different parts of the plot correspond to the stages of detection inside the funnel as the liquid mixture is drained and the interface makes its way down. Each labeled plot in the graph shows the average of the light intensity measured by the sensor at that channel at each ml step of the draining process for 5 repetitions. The shaded area around each labeled plot represents the 95% confidence interval of the 5 repetitions. The different stages of detection in the sensor measurement plots are identified by three vertical shaded zones: Green zone, interface entering the sensor detection zone, red zone, interface in the middle of the detection zone in front of the sensor, blue zone, interface exiting the detection zone.
We have confirmed the position of the liquid-liquid interface in each measurement, and in each repetition by using a camera placed in front of the funnel and perpendicular to the sensor and light source. For the sake of simplicity we assume the interface to be the lower surface of the dividing layer. Due to the different viscosity of some mixtures and to small errors when pumping the liquids around, the interface can appear at slightly different places in the different repetitions. This error is accounted for by offsetting all interfaces identified in all repetitions to appear on the same ml marker in each graph. Fig. 9a shows an opaque mixture of oil dyed with black oil paint and an opaque sugar solution which helps test the sensor setup for detecting interfaces in opaque liquids. It is expected that the sensor detects a small amount of light compared to other mixes and almost no increase in intensity as the interface approaches the sensor and crosses in front. In these first two phases light would be blocked or absorbed by both opaque layers which would make the drop in intensity in the third detection phase difficult to detect in the measures but would still create a distinguishable pattern in the measures. The mixture also presents an emulsion interface that disperses reflected light and close optical features between the two liquids. Fig. 9b shows that as expected the relative intensity measured for both opaque liquids is small compared to other mixtures. This is specially true for black oil for which the sensor registers the lowest relative intensity of this test. Changes for this mixture and all subsequent mixtures can be seen on the graphs mainly on the 610 nm, 680 nm and 730 nm channels, other channels can be seen to change in some of the graphs but are almost always hidden by the scale of the relative intensity changes of the other 3 channels.
A difference between the measured relative intensity for the liquids in Fig. 9a can be observed, as the sugar solution is not as opaque as the oil. A slight increase in the intensity measured can also be observed as the emulsion interface enters the detection zone of the sensor in the first detection phase. This is followed by a drop of intensity as the emulsion layer and the black oil take over. The increase in intensity and following intensity drop agrees with the description in section III-A and makes the interface noticeable in the sensor measures. In this case the drop in intensity in the third phase can also be partly attributed to the dispersive nature of the emulsion interface blocking some of the light.
The next mixture (Fig. 9c) contains vegetable oil and water colored with yellow ink, which makes the two phases appear very similar to the naked eye. Even the presence of an emulsion interface is not always easy to see under some light conditions. With this mixture we expect not a big difference between the two interfaces in terms of relative intensity measured. However, relative intensity is expected to increase due to light being reflected in the emulsion interface and to drop at the end, as the interface goes through the detection phases described in III-A, making the interface detectable.
The corresponding light intensity measures can be seen on Fig. 9d. Measures start with high values as the yellow inked water shines more brightly than normal water. Relative intensity follows the same pattern described in III-A: it first rises slightly as the liquid-liquid interface approaches the sensor and drops as it crosses the middle of the detection zone and the emulsion layer blocks some of the light, making the interface apparent. Afterwards, intensity rises slightly to a new value set by the light shone by the oil. Fig. 9e shows also vegetable oil but this time mixed with normal water creating a small difference in color between the two phases. The color difference also makes the emulsion interface between the two more easily detectable to the naked eye and is expected to create a difference in the intensity measured by the sensor. This, added to the increase and drop in intensity described in section III-A, will mark the interface location in the measured data. Additionally, less light is expected to be reflected on the emulsion interface in the first two detection phases compared to other mixtures as it appears darker to the naked eye.
The sensor measures (Fig. 9f) show a similar case to Fig. 9d but in this case water does not shine as brightly. The drop in intensity that marks the place where the emulsion interface is can be observed near the 100 ml mark. Fig. 9f also shows an exception to the expected increase in intensity, that can be attributed to the emulsion interface appearing darker in this mixture compared to other mixtures (Fig. 9e). Nevertheless, the interface location is noticeable in the measured data as expected. Fig. 9c shows the case in which two transparent liquids, mineral oil and water, create an emulsion interface. Compared to the opaque mixture the sensor is expected to register higher relative intensity measures. Furthermore, the emulsion interface appears brighter in this case than in other mixtures thus a higher increase in intensity is expected to be detected by the sensor when the interface crosses in front of it. This would make the interface more apparent in the data measured.
Similar to the other interfaces and the behavior described in section III-A, intensity also increases as the liquid-liquid interface approaches the sensor. A more distinctive peak is observed in the graph in the first detection phase as a consequence of the emulsion layer being brighter than in other mixtures. Intensity then drops and rises again slightly to the level shone by mineral oil. Fig. 10c shows again a mixture of mineral oil and water, but in this case as two transparent liquids that create a clean interface with almost no emulsion. A clean interface is expected to disperse less light than an emulsion interface leading to a more noticeable increase of measured intensity in the first detection phase, making the interface stand out in the data. Fig. 10d shows the expected increase in intensity as the water and mineral oil interface enters the first detection phase, however there is not a drop in intensity in the 610 nm channel as distinctive as in the emulsion interfaces case. Contrary to our original expectation the measures settle in the new liquid value smoothly in this channel when the interface exits the detection zone making the interface more difficult to locate in the data compared to the emulsion interfaces. This can be attributed to the clean interface allowing more light to go trough at this wavelengths. Additionally, the relatively small difference in refractive indexes also helps more light cross instead of being reflected. Nevertheless, a drop in intensity Fig. 9. On the left photos of the different mixtures that create emulsion interfaces, with the interface in front of the sensor detection zone, on the right the corresponding light intensity measures taken by different channels of the sensor in 5 repetitions of the draining process: (a and b) Black oil paint and sugar solution, (c and d) Vegetable oil, dishwasher soap, and yellow inked water (Lighting has been purposefully altered in the photo in order to see the interface), (e and f) Vegetable oil, dishwasher soap, and water, (g and h) Mineral oil, dishwasher soap, and water. Each plot on the graph shows the mean value and the 95% confidence interval for each channel of the sensor. Green vertical zone, interface entering the sensor detection zone; red vertical zone, interface in the middle of the detection zone; blue vertical zone, interface exiting the detection zone; grey zone, no interface inside the detection zone.
can still be seen in the 680 nm channel, making the interface detectable in the data.
Lastly, Fig. 10a shows a mixture of mineral oil and green inked water. In a similar way to the emulsion interface mixtures this colored water clean interface mixture allows us to observe whether color affects the detection of an interface by the sensor setup. The difference in color is expected to only produce a difference in the intensity registered by some channels compared to the non colored clean interface case.
Unsurprisingly, measures behave in a similar way to the measures taken from the mixture with non colored water (Fig. 10b). The green color in the water cre- Each channel on the graphs shows the mean value and the 95% confidence interval. Green vertical zone, interface entering the sensor detection zone; red vertical zone, interface in the middle of the detection zone; blue vertical zone, interface exiting the detection zone; grey zone, no interface inside the detection zone. ates a small difference in the relative initial intensity measured compared to the non colored water, but the interface is still noticeable. Table II summarizes the observed results.

V. CONCLUSION
This work describes a NIR photoelectric sensor setup capable of general detection of liquid-liquid interfaces in liquidliquid extraction processes. The sensor setup takes advantage of light being shone and reflected on the interface and the refraction properties of liquids. Different mixtures are tested in an automatic data collection device to assert whether different types of interfaces in liquids with different optical properties produced a distinguishable response in the sensor measures, and thus the capacity of the sensor to detect interfaces in different mixtures. These liquids included transparent and opaque, clean and emulsion interfaces, and colored phases.
It was shown from measures obtained from mixtures with emulsion interfaces that as the interface enters the detection zone and gets to the middle of it, intensity in some of the NIR channels (610 nm-680 nm) increases (Fig. 9b, 9d, 9h) and then drops as the interface goes past the sensor. This is mainly due to the interface reflecting light and making the liquid appear brighter as it comes into the detection zone. After it crosses, the reflected light no longer hits the sensor and, at the same time, the dispersive nature of the emulsion interface helps block some of the light (Section III-A). This makes all emulsion interfaces produce a distinguishable change in the measured relative intensity of light, something that is still a challenge with other types of optical approaches. In particular, the completely different appearances between the emulsion interfaces tested would make it difficult for a camera detection algorithm based on color to detect the interfaces, nevertheless in the setup presented all cases create a noticeable pattern in the sensor measures.
In the case of having a clean interface (Fig. 10), the same increase in intensity as the interface enters the sensor detection zone can be observed, however as the interface crosses in front of the sensor and exits the detection zone, there is a smooth transition to the new liquid intensity measure in the 610 nm channel, making more difficult to detect the interface compared to the emulsion case. This is due to the interface allowing more light to go through. Still, other channels (e.g. 680 nm) provide enough information to distinguish the interface in the data. Clean interfaces also make it difficult for camera based approaches to detect different interfaces.
The changes in measured intensity for clean and emulsion interfaces are found in every repetition of data collection with the automatic device and sensor setup and the different mixtures, and thus we conclude that enough information is provided to find an interface in all different mixtures tested.
An automatic interface detection algorithm can look for these changes and determine when an interface is approaching, in front, or after the sensor. Even in the case of not seen before substances, as long as there is a difference between the refractive indexes of the two liquid phases and thus the possibility of the interface reflecting light towards the sensor detection zone, a change will appear in the measured intensity.
The main limitation of the setup comes, consequently, when looking for interfaces in liquids with the same refractive index as changes would be undetectable. Another limitation appears on the side of transparency: when trying to detect an interface between opaque liquid phases with light blocking characteristics, in a case similar to the black oil phase of Fig. 9b, light would not be able reach the interface inside the funnel. Enhancing the sensor setup to detect liquid mixes with opaque layers includes exploring different light wavelengths that can go through (some light wavelengths still show a detectable intensity change while the opaque liquid is in front of the sensor in figure 9b), and using a sensor and light source placed on top of the original sensor that could be activated independently in the case that the opaque layer is at the bottom of the mixture.
Yet, as long as the opaque liquid is paired with a liquid that lets light through the interface should be detectable in the change of light intensity measured by the sensor.
The precise separation of the liquids is affected by the volume handled by the external pump controlling the level. Smaller volume steps can lead to a more precise location of the detected interface. The smaller steps would lead to an expansion of the x axis on graphs on figures 9b, 9d, 9f, 9h, 10b, and 10d which in turn leads to smoother changes in the data. This can help better differentiate features of some interfaces, for example the clean interfaces, in which the peaks identifying the interface would appear further away from the start of the liquid-air interface peak. This is not unique to this type of sensor but appears in general when using sensors that move with respect to the medium they are measuring, and it is usually decided by a trade-off between the achievable resolution and the time the measuring process takes.
We also select the interface location in the lower surface of the layer dividing the two liquid phases, but as seen with emulsion interfaces, this layer can be thick and thus other parts of it can be selected as the interface.
Different approaches can be used for an automatic interface detection algorithm that relies on the data collected by the sensor setup presented, including thresholding algorithms that use derivatives of the data, change detection algorithms and more elaborated machine learning approaches as has been the case with ultrasonic sensors [9]. Applying different signal processing and artificial intelligence techniques can also help determining other features of the interface like the size of the emulsion layer and more specific liquid properties based on light transmission measurements. This is the subject of our immediate future work, which also includes connecting the sensor setup as a detection module, with an automatic mix-ing module to create a fully automated general liquid-liquid extraction system. The sensor setup described also opens the possibility of detecting a liquid-liquid interface as it is forming. This would help determine the time different mixtures take to separate in a more practical way. Nowadays this time is usually calculated theoretically, thus usually a fixed time is used to determine that an interface has formed which is corrected manually as the process nears the calculated time.
Extending the sensor setup to find forming interfaces implies covering the whole length of the funnel with sensors. This can be accomplished by using a strip of sensors going up the funnel wall and a corresponding, adjustable, light source on the other side. Sensors detection zones must overlap enough to correctly locate the interface. The general sensor setup can also be miniaturized so that it can be attached to funnels without having to completely shield the glassware, making it useful as an aid to the manual separation process. Finally, a miniaturized sensor can be adapted to other automatic solutions, for example, liquid handling robots or pipetting robots.