We continue to develop resources related to the COVID-19 pandemic. See COVID-19 initiatives on Appropedia for more information.

Difference between revisions of "Open source solar spectrum project"

From Appropedia
Jump to navigation Jump to search
Line 255: Line 255:
[[category:Queens Applied Sustainability Group]]
[[category:Queens Applied Sustainability Group]]
[[category:Rob Andrews Thesis]]

Revision as of 17:43, 14 July 2011

QASlogo.png This page was developed by the Queen's University Applied Sustainability Research Group. QASlogo.png

Overview and Scope

The goal for this Open Source Solar Spectrum Analyzer was to collaboratively design the mechanical and electronic controls for a direct/diffuse data acquisition of wavelength and tilt angle dependent solar flux. In this project we built and commissioned two systems (1 in Canada and 1 in Bolivia). The systems will adjust a fiber optic input from 0 to 90 degrees every ten degrees and measure global and diffuse by adjusting a shadow band in and out. These measurements occur every hour and have enough resolution to span the UV-VIS to NIR spectrum.

In order to accomplish this, Queens Applied Sustainability Group in Kingston Ontario joined up with the La Universidad Privada Boliviana in Cochabamba, Bolivia. This partnership allowed for, in addition to the different location, an insight into how international collaboration can be implemented as well as ways to increase its productivity and efficiency.

Our systems would be designed to be as similar as possible with an exception for there individual spectrometers. This will allow us to get comparable data from both sites in order to compare the geographic differences in the sun's radiation and the potential effects on solar photovoltaic output.

This page describes how to build an automated spectrometer for recording solar spectra. It includes links to CAD files, design, software etc. It list all the components with links to purchase locations, includes calibration protocols, etc. Everything that is needed to replicate the two examples at UPB and in Canada....and a link to the data streams.

Solar Spectrum Theory

The attenuation and transmission of light in the earth's atmosphere is important in many fields including: photovoltaic technology, agriculture, weather prediction and climate research. Due to the non-homogeneity of the earth's atmosphere and constantly changing solar geometry, the solar resource is variable and can have very different effects at geographically disparate sites on the planet.

Solar irradiation is composed of a spectrum of light, which can broadly be divided into ultraviolet (UV), Visible (Vis), and Near Infrared (NIR) light. The light present at the edge of the earth's atmosphere, at what is called a 0 Air Mass (AM0) is defined as the extraterrestrial insolation (Go), which is a consistently varying quantity, but generally defined as 1366.1 W/m2 for engineering applications [1]. As the extraterrestrial spectrum travels through the earths atmosphere, it is attenuated by a variety of atmospheric constituents, including in descending order of their relative effects on solar transmission for a clear (cloudless) sky: Aerosols (ie scattering), Particulates (Rayleigh Scattering), Water Vapour, Ozone, Carbon Dioxide, and Oxygen.

The level of the attenuation due to these atmospheric components is dependent on their relative concentrations and on the optical path length through which the solar irradiation passes. If the sun is directly overhead, the optical path length is said to be one air mass (AM1) as the solar elevation above the horizon decreases, the sun's irradiance must pass through a larger distance before reaching the surface, and therefore the air mass will increase. For many solar photovoltaic applications, the airmass of 1.5 (AM1.5) with an associated irradiance of 1000 W/m2 (1 sun) is considered to be a standard atmospheric condition. A summary of the atmospheric constituents which can afford this condition and for a definition of the standard AM1.5 atmosphere (ASTM G-173), a comprehensive description can be found here. For an overview of the theory of solar resource measurements, see the related page on Solar_resource_measurement_for_PV_applications. For a more in-depth overview of solar geometry, see the related page on The_Solar_Resource The spectral distribution of irradiance from the AM1.5 spectrum is shown below.

ASTM G173 AM1.5 specturm

Solar attenuation

The attenuation of the solar resource in the atmosphere effects both the integrated (broadband) value of irradiation, as well as its distribution within the spectrum. Generally, an increase in Air Mass will tend to shift the spectrum towards "red" (Infrared), as can be observed due to the red sky at morning and evening. An increase in cloud cover will tend to shift the spectrum towards the "blue" (Ultraviolet), an effect which might be noticed when receiving a sunburn on a cloudy day. As can be seen in the above figure, the attenuation of irradiation also depends on the source of the irradiation. Direct & circumsolar refers to that irradiation which is not scattered in the atmosphere, and is specular in nature, meaning that it is directional and will form shadows when blocked. The Diffuse irradiation is irradiation which comes from the sky dome, and can be though of as isotropic (coming equally from all parts of the sky dome), however for advanced irradiation modeling, this assumption is not valid. It can be thought of as that irradiation which illuminates the area inside of a shadow, and is formed from scattered light. Therefore, it can be seen from the clear-day AM1.5G spectrum that there is relatively little scatter in the atmosphere, resulting in a small amount of diffuse irradiation, focused towards the ultraviolet section of the spectrum.

Beyond AM1.5

It should be noted at this point, however, that the assumption of AM1.5 spectra is not a valid one for the majority of atmospheric conditions, and the spectrum can vary widely over the day and year as atmospheric constituents and solar geometry changes. As an example of this, two days are shown below, which both contain 400W/m2 of broadband irradiation. One is a clear, sunny day at high air mass, and the other is a cloudy day at low air mass.

Cloud clear comparison.jpg

Because the performance of photovoltaic devices is characterized by a spectral responsiveness, the variation in spectral distribution between both spectra of equivalent broadband irrandiance can effect the performance and modeling of a photovoltaic device. The ground based measurement of solar spectral composition at geographically disparate sites will allow a more in-depth analysis of the solar resource, and will aid in the selection and design of photovoltaic technologies which can most effectively utilize solar irradiation of varying spectral compositions.

Design and Construction

Fig 1: Initial Design Mockup

The initial design was created in a 3D Modeling program called SolidWorks. This professional grade program was chosen due to the authors familiarity with it, however, any multitude of Open source programs could have been used (For a complete list of open source CAD packages see [1]. This allowed the specific tolerances and dimensions to be determined before construction actually began.

As much as possible the goal was to use common materials and sized for at much of the design as possible in order to improve the feasibility for the average person to be able to find the correct supplies. In keeping with this we chose to use simple aluminum square tube as well as simple aluminum pipe.

The design needed to be able to hold a fibre optic cable as the input to the spectrometer as well as be able to move a shadow band in and out of place to create the diffuse readings. The whole system would be mounted outside either on the side of a building or on a pole and as such had to be ridging and self supporting. The boxed structure provided this rigidity at low cost. A full list of drawings can be found here

The shadow band and the motion of the spectrometers fibre optic cable is controlled with 2 small Stepper motors. These are bolted to the frame and are connected to the shadow band and optical fibre rod by collars. These motors are powered by a Motor driver board and Arduino board. The motor driver board can drive two steppers at the same time and plugs directly on top of the Arduino making it a great solution. The board

The choice of the Arduino package was made due mainly to the open source nature of the project along with the simplicity and ease of use in coding and implementation. The Arduino package is robust and can be used in many applications and the low cost is a great bonus. We will talk more of the software in the electronics section.

For the actual construction we sent off the plans to our school shop where they could purchase the materials and put the system together quickly and easily. They was done due to our time restrictions, but in actuality the project was quite simple and could be built by any handy person in their garage over a weekend.

Electronics and Controls

There is more material on the software and electronics side than there is on the actual mechanical building side. To get the system to function properly it is necessary to run the Motor Control, The spectrometer Measurements, Data storage as well and the Solar Calculations all in sync with each other.

Fig 1: Arduino Dev Board

The first Major part of the system and possibly the most important is the spectrometer. It has to be able to take measurements of the sun in direct and diffuse radiation profiles as well as have enough resolution to detect small changes in the solar spectrum. One particular model is a full spectrum 200-2500nm Avantes Spectrometer capable of measuring the absolute Irradiance within the spectrum. In this way we are able to measure the total Solar Irradiation between 200 and 2500nm, a small portion of the UV range as well as some of the Infrared spectrum. This spectrometer need to be connected to a computer in order to store all the data that is collected. A simple USB connection is made between the two and data is transferred freely.

The more complicated electronic system is that of the Motor controls. In order to get dual independent control it was necessary to use a variety of tools. Firstly, a dual motor driver which was able to piggy back on an Arduino and individually control two stepper motors. This arduino would make all the important calculation about solar position and send that to the motor driver board to convert to a positional location for each motor. Below is the code used to move the steppers and to calculate the solar position. [2]

Stepper Driving Code

//zenith stepper driver motion
//Matthew De Vuono
//May 24-2011

//this code merges the zenith calculations with the stepper motion in
//order to get the stepper to move the shadowband to the correct zenith based on the 
//results from the code. The steppers will move in 10 degree increments to 90degrees.
//includes code to initialize the position of the stepper motor for location calibration.

#include <AFMotor.h>
#include <Wire.h>
#include "Chronodot.h"

Chronodot RTC;

const float pi = 3.14592654;

AF_Stepper motor1(200, 1);     //'1' for M1 and M2 or '2' for M3 and M4
AF_Stepper motor2(200, 2);
long previousMillis = 0;      // will store last time LED was updated
long interval = 58;           // interval at which to blink (milliseconds)
int montharray[13]={0,1,2,3,4,5,6,7,8,9,10,11,12};
int hourarray[25]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
              19,20,21,22,23,24};    //hour (1-24)
 //array to hold the values to find day of year
int monthdoy[13] = {0,0,31,59,90,120,151,181,212,243,273,304,334};   
float latitude = 43;    //user changes per location
float longitude = 76.3;    //user changes per location
float meridian = 75;    //user changes per location
float phi;    //initialize latitude in radians
int buttonstate = 0;
const int buttonpin = 2;

void setup() {
  // initialize serial output
    motor1.setSpeed(10);  // 10 rpm 
    motor2.setSpeed(10);  // 10 rpm  
    pinMode(13, OUTPUT);
    buttonstate = digitalRead(buttonpin);
    pinMode(buttonpin, INPUT);    
    phi = (latitude*pi)/180;     //latitude to radians
void loop()
 DateTime now = RTC.now();
 int time = now.minute();

 if(time = 00);            //the instances for the program to run, in this case every minute
    //motor 1 initialize
    if (buttonstate == LOW) {     
    // move motor 
    motor1.step(1, FORWARD, SINGLE);  
    else {
    //motor 2 initialize     
    if (buttonstate == LOW) {     
    // move motor 
    motor2.step(1, FORWARD, SINGLE);  
    else {
    //run sensing program
    for(int i=0; i<10; i=i++)
      motor1.step(5, FORWARD, DOUBLE);
      digitalWrite(13, HIGH);   // set the spectrometer on
      delay(250);              // wait for a second
      digitalWrite(13, LOW);
      motor1.step(50, BACKWARD, DOUBLE);
    //check and import clock values from rtc clock
     int hour = now.hour();          //from clock
     int day = now.day();        //from clock
     int month = now.month();      //from clock
     //calculating the day of year
     int doy = monthdoy[month] + day;
     //declination calculations
     float ratio = (284.0+doy)/365*360;
     float ratiorad = ratio*pi/180.0;
     float decdeg = 23.45*sin(ratiorad);
     float dec = decdeg*pi/180;
     //calculating solar time
     int Bdeg = (doy-1)*(360/365);
     float B = Bdeg*pi/180;                 //dividing E by 60 gives it in a fraction of an hour
     float E = (229.2*(0.000075+0.001868*cos(B)-0.032077*sin(B)-0.014615*cos(2*B)-0.04089*sin(2*B)))/60;
     float solartime = hour + 4*(meridian-longitude)/60+E;
     //solar hour calculation
     float omegadegrees=(solartime-12)*15;
     float omegarad =omegadegrees*pi/180;
     //Zeith calculation in radians
     float zenith =cos(phi)*cos(dec)*cos(omegarad)+sin(phi)*sin(dec);
           zenith = (acos(zenith))*180/pi;
    float result = ((90-zenith)/1.8);
    int angle = result;
    motor2.step(angle, FORWARD, DOUBLE);
    for(int i=0; i<10; i++)
      motor1.step(5, FORWARD, DOUBLE);
      digitalWrite(13, HIGH);   // set the spectrometer on
      delay(250);              // wait for a second
      digitalWrite(13, LOW);
    motor1.step(50, BACKWARD, DOUBLE);
    motor2.step(angle, BACKWARD, DOUBLE);

Spectrometer Code

In order for the spectrometer to take a measurement at the correct time it is necessary to have a connection between itself and the Arduino with which the Real Time Clock and main control system is located. In order to control it, the spectrometer has a D-Sub 26 connector on the back which is used to trigger Save Spectra, Save Dark and Save Reference.

On the Arduino board when a spectrum is meant to be measured it sends out a short TTL HIGH pulse to Pin 6 of the Dsub Connector. This triggers the spectrometer to Save Spectrum and store to computer memory.

A simple example of the TTL HIGH triggering for the spectrometer

//Matthew De Vuono
//May 30/2011
//Spectrometer triggering, TTL HIGH 

void setup() {
  // put your setup code here, to run once:
  pinMode(7, OUTPUT);
  Serial.println("Sending Signal!");
  Serial.println("Signal high"); 
  digitalWrite(7, HIGH);   // set the trigger on
  Serial.println("Signal low");
  digitalWrite(7, LOW);
  Serial.println("Signal Sent");

void loop() 


Calibration and Verification

When the spectrometers were purchased they both came fully calibrated in the spectral response, that is, when they detected 300nm light the light was actually 300nm. However, only the one spectrometer was calibrated for absolute irradiance. This meant that we had to determine a way to calibrate this spectrometer without having to purchase thousands of dollars worth of equipment. Since we had one calibrated unit we came up with a method ourselves.


It was possible to use our calibrated spectrometer to take detailed measurements of an ELH Halogen Projector bulb. These bulbs have a good spectral range and are consistent in terms of output over 24 hours of on time (losing <1%). We set the bulb up at a specific distance from the spectrometers sensor and allowed the bulb to reach steady-state in temperature and output. We then measured the Voc and Isc of a test solar cell in order to set parameters that could be reproduces later in order to redo the test. A full spectrum of the light was then taken from the bulb and we have now created an excel file with the spectral and Intensity data for this particular Halogen Light. With these two parts it is possible to create a file that will, when placed onto the non-calibrated spectrometer, allow it to be calibrated.

In order to ensure the bulb is at the same brightness here and over there in Cochabamba we are going to use the data provided for the solar cell in terms of Voc and Isc as well as distances. It will be necessary to place the bulb a certain distance from the cell and change the power going to the bulb until the Isc and Voc is the same as what was measured. This will ensure that the temperature, irradiation and power of the light and test cell is all the same.

Once the data is taken and the graphs matched the calibration will be complete.

Parts list

Operation Protocol

Open Data Access


  1. C.A. Gueymard, The sun’s total and spectral irradiance for solar energy applications and solar radiation models, Solar Energy. 76 (2004) 423-453.
  2. J.A. Duffie, W.A. Beckman, Solar Engineering of Thermal Processes, 2nd ed., Wiley-Interscience, 1991.