Aspectra, HowTo..., the technical realization

In the Aspectra Mini, the scientific process of observing, measuring spectrum of light, consists of following technical parts:

  • A. Converting the light into the spectrum.
  • B. Positioning the spectrum on the sensor
  • C. Converting the light, falling on the camera, into the intensity plot
  • D. Calibration, defining the intensity of the plot as function of lambda (light wave length)

 Each of those technical tasks has the influence on the whole process, The quality of the whole process depends from the weakest member in the chain. I'll try to describe the each part with the technical approach.

A. Converting the light into the spectrum


The spectroscope is the part responsible of converting the light into spectrum. To see the details of Aspectra's realization visit my spectroscope project on

As in every technical design, some trade-offs must be made. The most important trade off concerns the size of input hole (the slit diapragm).

The bigger the hole, we get more light but more rough, imprecise plot. And vice-versa: the smaller hole, the more precisely plot, but fewer light

B. Positioning the spectrum on the sensor

Utilizing Android phone as the sensor for spectroscopy, we must define 3 items:

  1. Axis (X or Y) Depending from the construction of the spectroscope, we get the spectrum along the x or y axis of the camera sensor. The sample spectroscope build for Nexus 5, provides the spectrum in Y axis.
  2. Direction (from left to right, or reverse) Both directions, from minus to plus and reverse are possible.
  3. Area of Interest (StartPosition, EndPosition in length axis, StartPosition, width in another axis) 

B.1. Defining Axis, X or Y .

Most of the camera sensors have longer X axis. The most common ratios of X/Y are 4/3, 5/4 or 16/9

In the most mobile devices, camera orientation is similar to device orientation: both at the same time in the portrait or landscape mode

To identify the Axis positioning of spectrum, we should make the following steps: 

  1. With the mounted spectroscope, observe the spectrum of the whichever light.
  2. Identify the position of blue and red part of spectrum.
  3. When both parts of spectrum lay on the longer camera axis, we have X axis orientation, if they lay on the shorter camera axis we have Y axis orientation.
  4. Respectively we should set the spectrum orientation in preferences of Aspectra-Mini.   

With the sample spectroscope, build for Nexus 5,  we use camera short axis as the spectrum lambda axis

B.2. To identify the direction (sign) of the x axis of the plot: 

  1. Set the proper axis in prefs

  2. With the mounted spectroscope, observe the spectrum of the whichever light

  3. Set rough the area of interest (with four lines in camera preview)

  4. remove the spectroscope

  5. observe the well defined picture with device camera. As well defined picture I mean the area with difference in the illumination between right part and left part

  6. The intensity of the plot, in the plot-fragment, should match or correspond to the brightness of the picture. F.I. If the picture on the left is dark, then the intensity shown in plot should be small on the left too. (Leave the mirror setting Off). If intensity on the plot is dark on the right, then set the mirroring in preferences On.

C. Converting the light, falling on the camera, into the intensity plot

From the whole picture, the area of interest will be read the in YUV format. We can define two axis for our AreaOfInterest: X (length) and Y (width).

Based on our settings in CameraPreviewView, we have defined four points: Xend, Xstart and Ystart and Yend = Ystart + Ywidth.

In the plot area, along the X axis we get Xlength = Xend – Xstart

Important notice: the X axis dimension is in pixels.

In Y axis: we add together all the pixel in Y direction and normalize ( max value will be 1024 for the white saturation)


The Y axis dimension in digit, from 0 (dark) to 1024 (white saturation)

To see the details of implementation, please visit the Github repository and check the source code

D. Calibration, defining the intensity of the plot as function of lambda (light wave length)

The spectrum plot, shown in App-plot-area, shows the intensity of light as the function of the camera pixel's index.

To get the plot results as the function of lambda (light wave length) the the whole system need to be calibrated.

Calibration means the assignment, relation between light wave lambda and pixel index 

The are some conditions, which must be fulfilled,  to allow calibration. The main condition is the stable montage of spectroscope with light sensor. The actual version of spectroscope (as shown for Nexus 5) doesn't allow stable build.

It is a new version of spectroscope in preparation, which allows both: the stable and universal montage on the most of the Android devices.

In the calibration phase, the color LEDs will be placed near the input of spectroscope.

On Android device, the color bar can be moved and stretched below the plot area.

The color bar will hold the lambda markers for every LED.


In the measurement phase, the color bar will be shown near the plot, as the orientation for observed results.