 software provided by Adafruit (https://github.com/adafruit/Adafruit_Python_TCS34725) and the TSL2591 software by "MaxlKlaxl" (https://github.com/maxlklaxl/python-tsl2591 ) a bit to adjust them for my purposes. I like to thank both of them for their brilliant work.
In the accompanying software package you will find examples of programs that will allow to perform measurement series and kinetics with both sensors. As I am rather new to Phyton programing, the programs require some optimization, I appreciate any help. Depending on your light source and your specific application, you may need to change the data sampling time and/or sensor gain settings of the sensors.
White, UV, blue and green LEDs run at about 3.1 V, so you may power them directly from the Pis' 3.3V output. For yellow, orange and red LEDs you need a series resistor between LED and power, otherwise they will be distoyed. If you do not want to run the LEDs permanently, you may connect them to a GPOI and switch them on and off by software.
So far I have not performed any experiments with the Arduino or Trinket, but Adafruit provides libraries and scetches for both sensors.
Step 4: Performing Measurements
The device is built to measure aqueous solutions or suspensions by placing a standard photometer cuvette between LED and sensor. I am using disposable cuvettes made from polystyrene (PS) or acrylic, and both full volume and semi-micro cuvettes work. You may get 100 such cuvettes for about 12- 20 €, depending on type and material, and you may use them several times.
So basically fill a sufficient volume of the solution/suspension into the cuvette, place it in the device watching for correct orientation, close the lid and start to measure. Given you are using a Raspberry Pi, you will have to start a Python program that allows you to perform the type of measurement (single, multiple, kinetic) you like to. Some of my programs write the data to so called CSV (Comma separated values) files you may open with MS Excel or LibreOffice Calc, Word or Writer and several other programs. This simplifies subsequent data analysis and documentation.
I have also written a simple Pygame script to show the color defined by the measured RGB values on your computer screen, so you may compare the actual and the measured colors. For various reasons they might differ a bit.
Make sure that the dye concentrations are not too high. Be aware that e.g. a bright blue solution might already be pitch black under the light of a yellow or red LED.
Step 5: Example #1: Kinetics (colorimeter and Photometer)
So far I have performed only a limited set of measurements.
An example for a kinetic measurement is the slow evaporation of carbondioxide (CO2) from sparkling water placed in an open cuvette. For this purpose, a bit of bromothymol blue was added to normal water and a small volume of CO2-enriched, "sparkling" water was added until the color changed from blue to yellow. Now the kinetics measurement was started and measurements were taken every 20 minutes for several hours. The data was automatically written to a CSV file and later analysed using LibreOffice Calc.
So what is happening? By addition of carbon dioxide to water it gets acid. As the concentration of CO2 in air is much lower than in the water, it evaporates slowly from the water, which results in a rising pH. In an acid solution bromothymol blue is faintly yellow, while under basic conditions it is bright blue. Around pH 7.0, the pKa of the dye, the color of the solution is green, due to a mixture of yellow and blue forms of the dye.
Using the RGB sensor, it is possible to detect the decay of the yellow form in the blue channel and the increase of the blue form in the red channel, while the effect on the green channel is only moderate. As you can see in the chart, over time the absorption in the blue channel decreases (i.e. less yellow dye) and the absorption in the red channel increases (i.e. more blue dye). As expected, the color changes over time indicate an approximate first order decay kinetic, values asymptotic nearing maximum or mi