Solar Server

Wichit Sirichote,

Build the solar station with Ubuntu server 7.10. The daily insolation data is recorded and sent to receiver by email everyday.

A device used for measuring daily insolation has been designed using the Ubuntu Server. The total solar radiation is measured by a Kipp & Zonen CM11 pyranometer. The EMF output of 5.14 uV/W/m2 is fed to the 24-bit resolution Delta-Sigma A/D converter, LTC2400. The microcontroller circuit built with a PIC18F2550 controls the A/D converter and provides one second time base for data sampling period. The insolation is computed by accumulated summation of the converted data in a whole day. The data is saved in buffer memory and is sent to the Ubuntu Server through the serial port, ttyS0. Shell scripts have been written for receiving the data from microcontroller board and for saving the record as the text file. The scheduler is set using cron process for sending the data file as attachment of email to the receiver everyday.

1. Introduction

The terrestrial solar radiation is very important data for evaluating the performance of solar energy conversion system. We may use the pyranometer and electronic integrator for total radiation measurement. The principle of the electronic integrator is based on the use of voltage to frequency converter and the accumulating digital counter. The result is daily insolation. A typical solar radiation measuring station usually installs the pyranometer quite far from the integrator. Since the EMF output signal from the pyranometer is very small. The signal is in microvolt level. This may results more noise coupling. And the insolation value is also printed out locally. Suppose we want to make the insolation data base for wide area, we may install many stations. This makes the difficult of data collecting. This article describes the alternative method by connecting the pyranometer to the homemade high-resolution delta-sigma analog to digital converter and the use of computer software for computing the insolation including the use of internet server for sending the data by email to the receiver everyday.

2. Harware component

The hardware component diagram is shown in Figure 1. Total radiation is measured by Kipp & Zonen CM11 pyranometer. The EMF signal from the pyranomter is fed to the 24-bit Delta-sigma converter without any amplification. The converter is controlled by the PIC18F2550 microcontroller. The internal hardware timer produces one second sampling period. The converted data is saved in the buffer memory and is sent to the Ubuntu server through the RS422 serial bus. The RS422 is converted to RS232 and is tied to the serial port ttyS0 at the Ubuntu server. Shell scripts on Ubuntu is used to receive data stream and save the data as the ASCII text file to the harddisk. Everyday at 00:00, the sendmail program will be called by corntab command to attach the data file to e-mail an send to the receiver automatically.

Figure 1: Hardware diagram.

2.1 Pyranometer

The Kipp &Zonen CM11 pyranometer is used to measured the total radiation. The main specification is shown in Table 1.

Figure 2: CM11 pyranometer.

Table 1 CM11 specification

Spectral range 305-2800 nm
Sensitivity 5.14 uV/W/m2
Internal resistance 700-1500 Ohms
Response time 15 s
Nonlinearity <+0.6% (<1000W/m2)
Zero offset +7 W/m2
ISO-9060 Class Secondary Standard

2.2 Detal-Sigma converter board

The delta-sigma converter board consits of three IC chips U1, U2 and U3. The circuit block diagram is shown in Figure 3. U1 is an analog to digital converter, LTC2400, 24-bit resolution Delta-Sigma converter. The reference voltage is +2.5V. The LSB shown in the datasheet is 149nV. U2 is PIC18F2550 microcontroller running with 4MHz clock. U3 is the RS422 line driver. U1 is interfaced to the U2 using SPI port. The SCK signal is SPI shift clock used for data shifting from U1. The MISO (Master In Slave Out) pin receives 24-bit data from U1. The raw data will save to the buffer memory of U2. The timebase 100ms generated by internal timer is used to produced one second sampling period. Data will be saved as a record and sent through the TXD pin using 9600 bps asynchronous format. The serial TTL signal is converted to RS422 by U3, 75179. At the Ubuntu server, there will be a converter that converts the RS422 back to RS232 for connecting to the serial port ttyS0 again. The hardware is adapted from the PIC project board by adding the RS422 line driver.

Figure 3: Block diagram of the Delta-sigma converter board.

2.3 Ubuntu server

The Ubuntu server is built with a desktop PC. The mainboard uses the Celeron CPU, 750MHz. The board has 64MB RAM, 10GB HD, and 10Mbit/s Ethernet port. The server program is the opensource distributed as Ubuntu 7.10. We may download it from The LAMP has been installed, i.e. Linux, Apache, MySQL and PHP. Our station uses Sendmail program running on Linux kernel 2.6.22-14-server to be the MTA (Mail Transfer Agent).

3. Software

The software component has two parts, i.e. the firmware on PIC18F2550 for reading the EMF signal from pyranometer and the shell scripts on Ubuntu server for data recording and email sending. (source code and hex file).

3.1 PIC18F2550 Firmware

The firmware has been developed using c language. The main program is time triggered by internal timer interrupt. Figure 4 shows the state sequence diagram. After the initialization, the main program will wait for trigger signal from internal timer. Reading EMF from pyranometer is made every one second. The raw data is filtered using 10-point moving average and then is converted to irradiance unit.

Figure 4: State sequence of firmware running on PIC18F2550.

The insolation is computed by accumulating summation the irradiance every one second as shown in equation 1.



is summation at sample k,

is EMF signal at sample k,

is offset voltage,

s is pyranometer sensitivity.

Data stream is formulated and is sent to the Ubuntu server every one minute. Each record has 7 fields as follows.



Station: station number 0-255,
Sample: sample number,
EMF: EMF signal from pyranometer in Volt,
Irradiance: Irradiance in W/m^2,
MAX: maximum Irradiance,
Insolation: Daily Insolation, Wh/m^2.

The sample of data stream sent to the Unbuntu server every minute is as follows,


Meaning for the sample record (bold letter) is station number 255, the sample no. 780, time 9:00, EMF signal 2634 uV, Irradiance 512.4W/m^2, Maximum Irradiance 603.8 and the Insolation is 2048 Wh/m^2.

3.2 Shell Scripts

Shell scripts has two parts, i.e. data capture and file saver. The first script, CAPTURE has details as follows,

echo "Solar Station #255"
#set serial port to 9600
stty -F /dev/ttyS0 9600
# get data stream, save to file
cat /dev/ttyS0 >> data.txt

This script sets the serial port ttyS0 to receive 9600 bps data stream. The command cat will forward device file ttyS0 to the text file, data.txt. The result of this command will write the data stream to the file data.txt.

Since the capture shell script has been executed as the foreground process, so when the user logout, it will stop running. To make it continue running, we will make this process to be background process by using nohup command.

wichit@solar:~$ nohup ./capture &

The script that manages file saving and email sending is logdata script. This script is running as the background process called by cron process. It is called everyday at 00:00 with file logdata.cron.

0 0 * * * /home/wichit/logdata

We use crontab to insert the scheduler file, logdata.cron.

wichit@solar:~$ crontab logdata.cron

The script logdata has detail as follows.

#rename the file to be saved
filename=`printf "%s%s.txt" \`hostname\` \` date +%Y%m%d\``
cp data.txt /home/wichit/data/$filename
echo"------">> /home/wichit/data/$filename
echo `date` >> /home/wichit/data/$filename
mail -s fromUbuntu < /home/wichit/data/$filename

The script variable, filename has been created using the result from command printf. We will get the host name and date to be the new filename. For example, solar20080221.txt, the name station is solar, the file was recorded at 21 FEB 2008. The data file will be saved in the folder /home/wichit/data. The sample of data files recorded in the folder is shown below.

wichit@solar:~/data$ ls

solar20080216.txt solar20080217.txt
solar20080218.txt solar20080219.txt
solar20080220.txt solar20080221.txt

After the file was saved, the mail command will send it to the receiver. The example shown above will send data file, solar20080221.txt to email address with the subject "from Ubuntu". The text shown the body of email will contain the data file (shown partly)

From "wichit" <>
Subject fromUbuntu
Date Thu, February 22, 2008 00:00 am

Thu Feb 22 00:00:00 EST 2008

Download this as a file

We can download the data shown in the email body to the client PC for analyzing and graphing with spreadsheet software easily.

4. Experimental Results

4.1 Offset Voltage

This experiment ties the pyranometer to the delta-sigma converter board without the amplifier. And the data is recorded at night time. We measured the offset voltage generated by thermoelectric effect at the pyranometer itself, wiring junction, and the internal offset of the delta-sigma converter. This offset voltage will be used to subtract the EMF reading during sunshine. Figure 5 shows the drift of the offset voltage from 0:00 to 05:00. The measured value is increased linearly from 670uV to 690uV. Our pyranometer has the sensitivity of 5.14uV/W/m^2. We will use the average value of 680uV or in the irradiance unit, 132.2W/m^2 to subtract then.

Figure 5: Offset voltage during night time.

4.2 Accumulation period

This experiment studies the different of summation period between one second and one minute. Since the delta-sigma converter board computes the insolation summation every one second, whereas the data stream is sent to Ubuntu server every one minute. We select the radiation profile recorded on the16 FEB 2008 to be tested for both cases. Figure 6 shows the sample profile on the 16 FEB 2008. Mathematically, if the EMF signal is constant, integration by accumulating summation will give no different. However if the EMF signal has fluctuation, the result may difference.

Figure 6: Profile of irradiance on 16 FEB 2008.

The experimental result is shown in Figure 7. Graph D is the result from the delta-sigma converter board for one second accumulation. The final value is 6971 Wh/m^2. Graph C is from offset accumulation, the value is 1619 Wh/m^2. Graph E is result from offset subtraction D-C. The result for one second accumulation is 5352Wh/m^2. Graph B is computed using spreadsheet software for one minute data, the result is 5397Wh/m^2. We found that the value of one minute summation is higher than one second, 45Wh/m^2.

Figure 7: Computed insolation on 16 FEB 2008.

We have recorded on the day with higher fluctuation of irradiance. The sample profile is shown in Figure 8.

Figure 8: Profile of irradiance on 26 FEB 2008.

The analysis is the same as profile shown in Figure 6. We found the final value of insolation for one second summation is 3602Wh/m^2 and for one minute is 3685Wh/m^2, higher than one second, 83 Wh/m^2.

Figure 9: Computed insolation on 16 FEB 2008.

4.3 Irradiance profile and daily insolation

This experiment takes the data that received from Ubuntu server to plot the irradiance profile and compute the insolation. The site of the station is located at Korat, Norteastern of Thailand, 15N latitude, 102E longitude. Figure 10 shows the sample of measurement on the high insolation day. The insolaton is 6192Wh/m^2, peak-hour is 6.2Hrs and the maximum irradiance is 930W/m^2. The next day on 22 FEB 2008 also high insolation shown in Figure 11. The insolation is 6254Wh/m^2, peak-hour is 6.3Hrs and maximum irradiance is 921W/m^2.

Figure 10: Profile of irradiance on 21 FEB 2008.

Figure 11: Profile of irradiance on 22 FEB 2008.

5. Conclusion

The solar station used for daily insolation measurement built with the Ubuntu server and the delta-sigma converter has been described. We have explained the operation of the converter board and shell script that receives and sends data file by email. The experiments studied the offset voltage, the difference of period summation. We found one minute summation gives higher insolation than one second. The higher fluctuation of irradiance, the higher different between one minute and one second. The station can be developed to provide more input channel, more internet access channel via HTTP and FTP.


  1. W.Thongtungsai, B.Damrongsakd, and W.Sirichote, “ Dual Channel Printing Integrator,” 2 nd ASEAN Renewable Energy Conference, Proceedings Vol.1, pp.36-44, 1997.
  2. M.K.Mayes, “How to Use the World’s Smallest 24-bit No Latency Delta-Sigma ADC to its Fullest Potential,” Linear Technology AN80-1, July 1999.
  3. Ashfaq A.Khan, “ Practical Linux Programming,” Charles River Media Inc., Hingham , Massachusetts , 2002.

Copyright 2008 by Wichit Sirichote
17 May 2008