raspberry pi camera: spectral response curves (grating properties)

UPDATE: Since, I found the spectral response curves (in the visible spectrum) of both v1 and v2 raspberry pi cameras. You can find the digital response curves on my projects page.

As described previously, a diffraction grating splits light in it’s wavelength components (intensities). However, the angle of the diffracted light as it ‘exits’ the diffraction grating is dependent on the number of slits (grooves) in the grating. To correctly align any sensor (parallel) with the grating and register the diffracted light a little math is required.

For a diffraction order m, given an incident beam of light at angle $sin_{\theta_i}$,  a given wavelength $\lambda$ and a slit density d; a diffracted beam will exit at an angle $sin_{\theta_d}$ according to:

$d [ sin_{\theta_i} - sin_{\theta_d}  ] = m \lambda$

or in function of the ‘exit’ angle:

$\theta_d = asin(\frac{m \lambda} {d} + sin_{\theta_i})$

Using this relationship we can calculate the incident angle at which the the exiting light at a given wavelength will be orthogonal to the grating (or parallel to a sensor), or alternatively the angle at which the detector should be placed.

Using the above equation I ran an analysis for a set number of incident angles and wavelengths to extract the overall diffraction properties for a 300 lines/mm and 1351 lines/mm grating (a professional Thorlabs grating and DVD grooves respectively). Optimal grating angles, where the diffracted light exits orthogonal to the grating (going straight into a sensor) is calculated to be ~12 and ~67 degrees for (300 and 1351 lines/mm respectively). I’ll be using a 300 lines/mm grating at a 12 degree angle.

300 lines/mm grating

1351 lines/mm grating

raspberry pi camera: spectral response curves (intro)

UPDATE: Since, I found the spectral response curves (in the visible spectrum) of both v1 and v2 raspberry pi cameras. You can find the digital response curves on my projects page.

In the previous post I described my project to democratize phenology monitoring. From a purely scientific point of view adding citizen science cameras to the PhenoCam network would increase the coverage, however to truly replace the current StarDot cameras in more than a citizen science project I need to characterize the spectral response of the raspberry pi camera’s imaging sensor.

The spectral response of any imaging sensor (or most of them anyway) is determined by the formula used on the microlenses in the bayer filter. In practice every imaging sensor is monochrome, it’s only by adding this bayer filter, a checkerboard of tiny red/green/blue filters alternatively overlaying all pixels, that you can extract color from your imaging sensor.

Sadly, most spectral responses of the imaging sensors are corporate secrets. I’m unsure why, but I assume that knowing the spectral response of the filters tells something about which process is used and how. This being said, this doesn’t mean you can’t measure it!

Measuring the spectral response of a sensor is generally done using a monochromator, a light source which emits a particular wavelength, and a spectrometer, a device to measure the intensity of that light source in function of wavelength. Here the monochromator emits light of a known wavelength which is simultaneously measured by the spectrometer and the imaging sensor. The spectrometer provides a true intensity measurement at this wavelength while the imaging sensor provides an intensity measurement for every bayer filter colour at this particular wavelength. If we cycle through all wavelengths the output of such an analysis are spectral response curves, showing the sensitivity of each bayer filter component colour across all wavelengths. Although this methodology is sound, finding a monochromator is rather hard. Yet an alternative approach exists.

A monochromator uses a diffraction grating to split a known light source into it’s component wavelengths. This same diffraction grating is not selective and at any given time outputs all light components only at a slightly different angle. The monochromator only passes the desired wavelength, as shown below (left image).

So, in theory we could use a diffraction grating to do all the work for us without the intermediary and elusive monochormator! However, the transmission properties of a grating are wavelength dependent. This is the reason why in an ordinary (monochromator / spectrometer) setup you need to measure the true intensity as well as the image sensor response simultaneously. The only way to calculate the spectral response curve of the sensor is to factor in the wavelength dependent transmission properties of a grating. For most classroom gratings these properties are not described, but when ordering from an optical instrument builder they are!

In short, given a known light source (characterized using a spectrometer), a cheap but characterized grating it is possible to get a crude approximation of the spectral response of any imaging sensor using one image (well two actually as you need to calibrate the relative location of the spectrum - using a CFL light for example)!

Next step, designing a grating housing (a cheap spectrometer) for this task.



PhenoPi: low cost phenology monitoring

Most of my research revolves around green leaf phenology, or the study of seasonal changes in vegetation. These changes can be observed visually by looking at vegetation (are there leaves or not?). However, for the sake of convenience and consistency it’s far easier to setup a network of sensors. This is exactly what has been done by Prof. dr. Andrew D. Richardson at Harvard University.

Everyone loses with a sharing economy

Some things in life are free, yet fewer things remain each day. Erosion of altruism, acts of kindness and true sharing has in large part been facilitated by the recent buzz around the “sharing” economy. In a sharing economy, or collaborative consumption, owners rent out goods or time they are not using in a peer-to-peer fashion. A common premise is that when goods and services are shared, the value of those goods may increase, for the business, for individuals, and for the community.The sharing economy allows people to offer rides through a service such as Uber and Lyft. Using AirBnB an unused room can be a source of income. While TaskRabbit makes it possible to offer a pair of helping hands while cleaning. More recently there has been as steady increase in services such as education and consultancy through sites such as udemy and HourlyNerd.

Disruption and (de)regulation

On the surface it seems promising, being hailed as ‘disruptive’ to entrenched businesses such as the taxi service and hotel industry, stirring on innovation. Although the short term advantages for consumers are all too obvious, lower taxi fares and cheaper rooms, the long term impact on society might be less rosy. Here the disruptive nature of these companies goes well beyond just innovating. More often than not these initiatives are successful because they avoid proper regulation protecting both parties as well as legally due taxes. Although AirBnB has been forced to pay tourist taxes in a growing number of cities ((Working together to collect tourist taxes - AirBnB )), the fact that renting out a room stays largely unregulated still provides an unfair advantage compared to local official businesses but also allows abuse.

Countless AirBnB mishaps can be found on the internet; such as the comedian coming home to an orgy, rooms turning into brothels and houses being trashed (( AirBnB renter claims he returned home to an orgy - NY Post )) (( Violated traveler lost faith )) (( Hookers using AirBnB apartments for sex sessions - NY Post )). Due to a lack of screening not only are clients a potential treat to a service provider’s property, service providers are also a potential treat to clients. Uber has gotten a bad rep recently by increasing number of sexual assault cases by drivers (( Uber driver Arrested in Los Angeles rape case - The Daily Beast )) (( Uber X driver accused of rape )) and accidents (( Uber driver kills pedestrian - ABC news )). The freedom and lack of regulations which makes these services competitive can also turn into a hazard for both the service provider as well as their clients.

Social upheaval

More damaging than the direct dangers are the indirect consequences of the sharing economy. Within a sharing economy, every item in your household or every idle minute turns into an opportunity cost. Things sitting on a shelf, or time not spend working equals a loss of additional income. All of the sudden, where people used to share equipment and time, now they find or offer these ‘services’ through an app, paying or providing for what was otherwise a free community service. As the demand for these ‘sharing’ services is rising it leaves me with one question: Where did we lose our personal connection to our next door neighbours to the point where we need to use the internet to borrow a hedge trimmer?

Even if people used to pay for certain services, for example baby sitting, the price of these services was governed by local economics. Services were offered through word of mouth and prices were set relative to the local market. Yet, the networked nature of the sharing economy opens up the whole market to service providers far outside local communities. This creates a race to the bottom in hourly wages due to an ever expanding supply of service providers. Combined with a still rotten economy, people will cut corners everywhere cutting into hourly wages, further weakening the financial position of the middle class and working poor (( The distributive implications of the sharing economy - Forbes )).

The promise of upward social and economic mobility through the sharing economy is therefore broken from the onset. Even worse, it has the potential to cannibalize current full time jobs. Landing people with a ‘job’ without social protection, benefits or fixed hours and a steady income (( Corporate America Is Using the Sharing Economy to Turn Us Into Temps - New Republic )).

True sharing and social-economic empowerment

As the sharing economy is making it easy to find ‘shared’ goods and services it makes us ever more distant from the same goods and services we would have otherwise enjoy for free, at the cost of true sharing. The sentiment might be changing with more and more people acknowledging the social and economic implications of the ‘sharing economy’ (( The sentiment on sharing is shifting - TechCrunch )) with the potential to move from commodity to commons.

Moving commodity to commons has been happening for a long time. However, it wasn’t covered with the verbal fluff or bad habits of ‘the sharing economy’. Before Udemy made everyone a professor (( Here comes professor everybody )) there was the major push for towards Massive Open Online Courses (MOOC), mainly provided by major universities. Similarly, plenty of online tutorials can be found on YouTube, made by enthousiast and professionals. For example, countless people dedicate their free time mapping the planet. Often beating Google in accuracy and update frequency during disaster relief (( OpenStreetMap Response to Typhoon Haiyan / Yolanda )). These services, as well as plenty others provided by the open source software community allow people to use, software, data and knowledge free of charge. These true sharing initiatives are not limited to the software world be extend into the physical world by services such as Peerby which facilitates the borrowing of things in your neighbourhood (without charging for it) or Hacker spaces which provide free or low cost access to (specialized) tools.

As always, technology can be used for good as well as for bad. While venture capital clearly benefits from the sharing economy, with Uber being valued at $40 billion (( Uber valuation comes with uber problems - TechCrunch )), the final gains for the service providers might erode over time. At the same time, these commercial services eat into the social fabric that makes people borrow stuff from neighbours without a fee. I hope with time a true sharing economy will prevail.



© 2018. All rights reserved.

Powered by Hydejack v7.5.1