Arduino Light Sensor - TSL2561 and Experiments with Infrared and Visible Light
Albert Einstein won his Nobel Prize in Physics in 1921 "for his services to Theoretical Physics, and especially for his discovery of the law of the photoelectric effect" [nobelprize.org]. The photoelectric effect, in part, describes the energetic response from photons and electrons regarding the interaction between light and materials. A photodiode is a device that employs this effect to proportionally measure light as a function of electricity. Photodiodes are used in cameras, smartphones, remote controls, heat sensors, and many other applications. Here, we investigate the TSL2561 luminosity sensor that uses two photodiodes: one in the visible spectrum and one in the infrared spectrum. The goal with the TSL2561 is to demonstrate its responsivity to particular wavelengths (colors) within the electromagnetic spectrum.
The human eye's retina sees by way of cells called photoreceptors. The two primary photoreceptors, rods and cones, allow the eye to see under both dark and bright conditions. The cones resolve bright light and give humans the ability to see colors with wavelengths from 400nm - 700nm (blue to red) [source 1, source 2]. In Table 1, the division of color by wavelength for the visible spectrum is shown.
There three types of cones in the retina: type-S (short wave, blues), type-M (medium wave, greens), type-L (long wave, reds). Figure 1 shows the perceived response of each cone and their relevance to the visible spectrum.
Understanding the behavior of each photoreceptor cone gives scientists and researchers the ability to study and approximate the response of the human eye. The normalized cone responses shown above are typical for an average human retina. The peaks and widths of each curve allow technology companies to build sensors that measure light in a similar manner. Thus, we have devices such as the TSL2561, which measures light roughly in the visible spectrum. Normally, photodiodes experience interference due to the ubiquity of infrared radiation, however, the TSL2561 overcomes this by including an entirely separate photodiode with a peak response in the infrared. This allows the infrared cross-talk to be algorithmically subtracted from the visible measurement to create a more accurate depiction of how much light a human may be perceiving.
I will be testing the response of the TSL2561 luminosity sensor by using six LEDs of various wavelengths: infrared (940nm), red (620nm), yellow (580nm), green (520nm), blue (460nm), and white (around 550nm, though it's more broadband). Using these six bands I will be able to verify the responsivity shown in Figure 2 (taken from the datasheet).
I will be using the following parts to conduct the experiment:
The experimental procedure will go as follows:
Wire each LED to the circuit
Measure visible and infrared values from the TSL2561
Evaluate Ratio of Visible/Infrared
A photo of my setup for the experiment can be seen in Figure 3.
The SparkFun hookup guide is a great resource for the TSL2561 (find it here). I chose their library (here) over Adafruit's because of the freedom to use the raw data and not just the calculated 'lux' values. The wiring diagram for the TSL2561 and Arduino Uno can be found below.
I will be using a modified version of the SparkFun example where I only use the raw values measured from the sensor, as opposed to the 'lux' values calculated by the library. The raw values will allow us to compare the visible and infrared light measured by each photodiode. By calculating the ratio between visible and infrared light, we can discern where the light falls on the spectrum based on the response of each photodiode shown in Figure 2. My Arduino code for calculating visible, infrared, and the ratio between the two can be found below:
The table below shows the calculated ratios between visible and infrared light for each LED. The trend in the data can easily be deduced, and the physical significance of this trend is obvious and expected. Since the two photodiodes peak at different wavelengths, the visible around 650nm and the infrared around 800nm, we are able to utilize their ratio and relate it to the wavelength of light being emitted. Therefore, it can be concluded that under controlled conditions, the TSL2561 is capable of discerning the color of each LED with only a measure of emission.
I conducted a polynomial fitting of the data after casting the ratios as a function of the natural logarithm. This accounts for the exponential profile of the two photodiode responses. I then plotted the fit against the data and acquired a nice expression for approximating the wavelength as a function of the measured ratio of visible light to infrared light detected by the TSL2561 luminosity sensor.
With the fit above, I was able to replicate the data with near-perfect accuracy. This means that we can insert the polynomial fit (and exponential inversion) into Arduino and actually re-do the experiment and blindly be able to determine the color of a given LED. This type of result could have massive implications in applications involving color recognition.
In the experiment executed above I demonstrated the effectiveness of a pair of photodiodes using the TSL2561 luminosity sensor. Using the Arduino Uno, I was able to calculate the ratio between the visible and infrared light emitted by LEDs of varying wavelengths. The results indicate that the TSL2561 is capable of distinguishing between colors based on the measured ratio between the photodiodes. This outcome has broad implications for makers interested in the TSL2561 as a light sensor and color detector. The experiment is also educational for students interested in learning about the photoelectric effect and how the human eye perceives light and colors. Obviously, complications can arise when dealing with light being emitted from multiple locations and direction, and therefore, the conclusions drawn above cannot necessarily be extrapolated to every situation.
Products from our Shop relevant to this project:
See more in Arduino and Physics: