Friday, March 25, 2016

Seeing ultraviolet in the sky

Reading about bee vision a couple years ago started me thinking: How is it possible for bees to know the position of the sun, even on a cloudy day?

From what I remember, the theory at the time was that bees are able to measure the polarization of sunlight and can use that to deduce the position of the sun. Although it seems that light scattering from multiple layers of clouds might muddy the polarization, apparently scientists studying bee behavior think that bees use polarization even on the cloudiest of days. You can measure the polarization of light from the sky yourself using a radial arrangement of polarizing filters or by building a fancy polarization camera.

However, another interesting aspect of bee vision is that bees are able to see ultraviolet light.  This made me wonder: Could bees determine the sun's position, even on cloudy days, by looking for the strongest source of UV light?

The scattering of UV light by clouds is a complicated phenomenon. Forrest Mims III and others have reported on a counterintuitive effect whereby UV exposure at ground level might be more intense on a cloudy day than on a clear day. We know that shorter wavelengths of light, such as UV, are scattered more by clouds than longer wavelengths of light, such as visible and IR light.  The question is whether this scattering obscures the position of the sun.

Time to measure things. I started with the GUVA-S12SD UV-B sensor breakout available from Adafruit. This sensor provides an analog voltage output that is some fraction of the input voltage: the more UV that falls on the sensor, the more voltage it will output.  I knew I wanted to measure the relative UV intensity coming from different quadrants of the sky, to try to triangulate the position of the sun, so I decided to use four sensors.

Wiring four UV-B sensors

I designed a custom mount for the four sensors that would hold them at a specific geometric relationship to each other, and a friend 3D printed them for me.

Plastic mount for UV sensors
I mounted the sensors by pushing them through the plastic mount from behind, and used a single screw to hold each sensor in place.  I reused an aluminum project box to hold everything.



I wanted to continuously log the sensor data throughout the day, so I used the ArduLog-RTC, which is essentially an Arduino UNO that will log data to a microSD card and can timestamp the measurements with a (battery backed-up) real time clock.

All the stuff that goes in the box

I used a 3S LiPO battery with a 3.3V converter wired to the ArduLog-RTC. This also supplied power to the four sensors. I wired the four analog outputs of the sensors to four analog inputs (A0-A3) on the ArduLog-RTC.  I've uploaded the basic logging code to github. (If you're unsure how to program the ArduLog-RTC: I used a serial TTL connection by soldering header pins to the six thru holes on the left side of the board--TX/RX etc -- connecting an FTDI cable to those pins, and programming using the Arduino application).

Packaged device

I took the device outdoors and oriented it using a compass so that the sensors pointed roughly NE, SE, SW, NW.  Then I started collecting data.

The logged data looks something like this CSV:

20160325 09:18:37,116,48,62,110
20160325 09:18:47,117,48,62,111
20160325 09:18:57,117,48,62,111

That is, a timestamp followed by the analog voltage measured at each sensor. For scale: the maximum value is dictated by the voltage supplied to the sensors, which would be about 3.3V, corresponding to a measurement of 330. The minimum value is zero when no UV light is falling on the sensor.

Here's a plot of the data from a single-day's measurements:

A few interesting things to note from this plot:
  • It appears sens3 and sens0 point substantially more eastward than sens2 and sens3. This is consistent with the actual physical arrangement of the sensors.
  • The peak values for sens0 and sens3 are measured around noon
  • There are some low-intensity measurements at the beginning and end of the day: my guess is that there is no direct sunlight falling on the sensors during these periods (due to shadowing from surrounding trees and structures), so we're measuring the UV light scattered by the sky during these periods. 
  • Other than noise at the beginning and end of the day (possibly caused by obstructions), the measured UV intensity seems to rise and fall smoothly.  This seems to be consistent with a mostly cloudless sky throughout the day. 
  • There is a very small UV signal measured as early as 4:30 AM -- hours before the 6:56 AM sunrise.  Perhaps this is caused by UV scattering by fog or clouds?
  • The sensors that are facing more northward (sens0 and sens1) measure more intense UV than the two sensors facing more southward.  At first glance this doesn't make sense, since I would expect southward-facing sensors to detect more intense UV.  I need to verify that sens0 and sens1 are facing NE and NW respectively-- if they are, then there might be some odd angle-of-view effect happening here. 

Measurements from an intermittently cloudy day

On 20160328 multiple large clouds passed between the detector and the sun, and the effect on the sensors looked like this:
It appears that clouds cause a large dip in intensity, though the relationship between the four detectors remains about the same. 

Next Steps

  1. Accurately measure the max voltage supplied by the power supply (so we know what the UV measurement range should be)
  2. Mount the measuring device up high to avoid some shadows caused by obstructions 
  3. Measure UV on a substantially cloudy day
  4. Calculate the position of the sun based on the measured relative UV intensities, and match that against the logged time. 


No comments:

Post a Comment