Figure 1 - Infrared transmission spectra of solvent without (left) and with (right) oil added. The band at 3000 cm-1 corresponds to vibrations in the C-H bonds which the solvent doesn't have and is used to quantify the amount of oil in the sample. (source: patent US4164653-2)
Figure 2 - Fluorescence spectrum from different oils excited with UV light (308 nm). (source)
The problem with these methods is that the equipment needed to perform the measurement costs a considerable amount, 500-1000 USD for a second-hand Fourier transform infrared spectrometer or a second-hand fluorometer on Ebay. I had done some work on making low-cost colourimeters using LEDs before and so I thought building my own fluorometer would be a good place to start.
I started by taking my multimeter colourimeter and measuring the voltage of a green LED, using it as a photodiode. There was a signal for highly fluorescent compounds such as vitamin B12, but it was very weak and would not be sensitive to small amounts of oil. One option was to construct an amplifier circuit, however this incurs a high assembly cost. I stumbled across this instructable on how to construct a very sensitive light sensor from a TSL237 light to frequency converter, which has a photodiode along with a built-in amplifier and voltage to frequency converter: (http://www.instructables.com/id/Highly-sensitive-Arduino-light-sensor/). This light sensor is very sensitive but what is more helpful is the conversion of the light intensity into frequency - a microcontroller like the Arduino is much better at measuring a frequency than a voltage. This means you can plug the sensor directly into an Arduino and take very accurate readings by converting the frequency to an illuminance value. The sensor only costs about 3.33 USD and is probably the most accurate sensor you can buy for that price.
After finding an accurate sensor, the other problem is the use of solvents. These are hard to source, require fume cupboards and are not safe for use at home. I found a solvent-free method online to extract oil from water, from the company Turner Designs, which makes fluorometers. The procedure consists of adding a solution to the oil and water mixture, heating it until it became cloudy and then cooling it down until it became clear and the oil is dispersed throughout. Certain detergents will drop out of solution when their temperature is raised. This only works for detergents that are not charged; heating an uncharged detergent interrupts the detergent-water interactions and causes them to no longer be soluble in water, the opposite of what you would expect. We had some Triton X-100 in the lab which is a non-ionic surfactant (detergent) with a cloud point of ~65 degrees C. Triton X-100 is safe to use and very cheap to buy. I prepared a 0.1% solution of Triton X-100 and added a small amount of olive oil, which has a good light emission at the wavelength where crude oil emits light. As such, this oil could be used as a standard for crude oil measurements.
Figure 3 - Drops of olive oil floating on 0.1% Triton X-100 in water (left). Heating above the cloud point (70 degrees) (right) it becomes opaque; upon cooling it becomes completely clear.
I bought some TSL237 light-to-frequency converters from RS and used some Veraboard to solder one to some wires to attach to the Arduino. I also attached a 405 nm LED with a resistor (220 Ohms) between 0 and 5V of the Arduino. I used four layers of green cellophane which allow through ~500 nm, the peak of the emission, and block out the UV light from the LED. I found that four layers were necessary to block the UV LED to the point where it was not picked up and without any sample added the reading was the same whether the LED was on or off.
Figure 4 - Veraboard circuit which connected the light sensor and LED to wires, which plugged into the Arduino. It is attached to a laser cut colourimeter, and to my laptop.
I made use of the great Freqperiod library to measure the frequency, a software library for Arduino that is designed to measure frequencies below 20 kHz. It measures frequency in Hertz to six decimal places. There are other libraries to measure above 20kHz that means that by changing the software you can measure a huge dynamic range of light intensities. (http://interface.khm.de/index.php/lab/interfaces-advanced/frequency-measurement-library/) Most of the readings were in the hundreds of Hz. Full room lights were 20kHz while the maximum reading the sensor can do is 1000kHz (see Figure 5).
Figure 5 - Frequency vs. light irradiance (left) and response curve (right) taken from the datasheet for the TSL237 light-to-frequency converter.
Below are the readings for different samples. The filter attenuated a lot of the light. The next improvement is to buy a better filter. In fluorescence measurements large lenses are often used to collect as much light as possible. So integrating a lens could also help, however all of these additions increase the cost of the unit.
Figure 5 - Olive oil excited with 405 nm LED emitting red light. The decay of the red emission into the olive oil indicates it is saturating and absorbing all of the light before it can reach the other side of the cuvette. This leads to incorrect readings; for an accurate reading the olive oil would need to be diluted.
Measuring the stability of the reading over time gives a fairly narrow band of frequencies with a deviation of only ~0.2 Hz. The readings are stable enough to compare samples ranging from 100 - 1000 ppm. With a better filter, there is potential to detect samples of under 100 ppm.
Figure 6 - Measurement over a few minutes (inset top) with the histogram of frequency readings (top) and fitting to a normal distribution (perhaps log-normal would've been better) giving a width of 0.2 Hz.
The next step is to integrate it into an Arduino shield. The cost of something like this would come down to the price of the Arduino but because you only really need one pin to measure the frequency you could use something like the Adafruit trinket (6.95 USD) and make the whole thing for under $20. Any interest in helping to do this would be greatly appreciated as I have left all of my soldering supplies in New Zealand (I now live in Cambridge, UK).
Figure 7 - Diagram of a shield for an Arduino Micro, with an added RGB LED for optical absorption measurements on the same device. In order to take a reading, a box would be needed to put over the device, or a 3D printed holder for the cuvette could be designed.
Another interesting application is in water testing. Turbidity is an important measure of water health and my biology friends tell me it is very important as fish can't see their prey if the water is cloudy. This accurate light sensor could be used to measure turbidity. A student and I have also been working on using milk as a standard for preparing turbidity standards to calibrate the measurement. Anyway, there is more to come on this. If anyone is interested in helping out or if you have any questions, please let me know in the comments.