Solar Radiation Measurement Using Raspberry Pi and Its Modelling Using Artificial Neural Networks

The advent of solar energy as the best alternative to traditional energy sources has led to an extensive study on the measurement and prediction of solar radiation. Devices such as pyranometer, pyrrheliometer, global UV radiometer are used for the measurement of solar radiation. The solar radiation measuring instruments available at Innovation Center, MIT Manipal were integrated with a Raspberry Pi to allow remote access to the data through the university Local Area Network. The connections of the data loggers and the Raspberry Pi were enclosed in a plastic box to prevent damage from the rainfall and humidity in Manipal. The solar radiation data was used to validate an Artificial Neural Network model which was developed using various meterological data from 2011-2015.


Introduction
With the increasing energy demands and depleting fossil fuels, a primary importance has been given to the development of alternate renewable energy sources.Solar energy has emerged as the best alternative not only due to its sustainability but also because it is environment friendly and an abundant energy source [1].The applications of solar energy is endless, including agriculture, electricity generation, heating and cooling etc.A high priority has thus been assigned by many countries for solar energy harnessing and utilisation [2].A knowledge of the solar radiation incident on the surface of the earth is of utmost importance for engineers, scientists and architects associated with the design of solar energy systems [3].Various solar radiation measuring instruments such as pyranometer, pyrheliometer, UV radiometer, etc are employed for collection of incident solar radiation data at a specific location.Owing to high cost of installation and maintenance of these instruments, solar radiation measurement is not feasible in all locations.The data obtained from the stations installed with these solar radiation measuring instruments are used to formulate different models for the prediction of solar radiation in different places.
The Raspberry Pi is a credit-card sized computer(Fig.1) that originated in the Laboratory of University of Cambridge in 2006 and released by Raspberry Pi Foundation in 2012 [4].The Raspberry Pi board with a dimension of 85.60mm x 53.98mm x 17 mm, weighs only about 45g and contains a processor, graphic chip, RAM (Random Access Memory) and various connectors and interfaces for linking external devices [5].It was developed primarily for promoting programming in schools, homes and the third world countries.The cost of a raspberry pi board is only about 35$ and has the capability of a computer costing hundreds of dollars.Even though the use of Raspberry Pi in solar radiation measurement has been limited, it has been effectively used for various tasks across different fields.
Rahim et al. [6] developed a solar tracker system to determine the location of the sun in the sky.A webcam was used as the main sensor which was integrated with an image processing technique and rooted into a Raspberry Pi.The processing of the image was carried out by the Raspberry Pi inplace of a computer CPU.
Deepan et al. [7] used a Raspberry Pi for the control and movement of an artificial intelligent hand.The system was controlled by a Raspberry Pi with an attached camera module which was able to capture and mimic the natural motion of a human hand.
Divya Priya et al. [8] utilised the excellent image processing and video streaming capability of Raspberry Pi for designing and implementing a low cost and an efficient underwater vehicle which has the ability to measure parameters like temperature, pressure, speed and direction.
Ganesh V Bhat et al. [9] described the design of an Electrocardiogram (ECG) monitoring system using Raspberry Pi.A small, portable system was designed to find the malfunctioning of the heart.
Gurjashan Singh Pannu et al. [10] used Raspberry Pi as a processing chip for building a monocular vision autonomous car prototype.An ultrasonic sensor with a High Definition camera was used to provide necessary data from the real world to the car.Many existing algorithms such as lane detection, obstacle detection etc. were written onto the Raspberry Pi to provide control to the car.
No prior relevant work has been carried out on the integration of Raspberry Pi with solar measuring instruments and its measurement.This was the one of the chief driving force behind this project.

Figure 1. Raspberry Pi
ANN is an AI black box model which can be effectively utilized for estimation of non-linear functions, data sorting, optimization, model predictions, etc [11].It provides an effective way of determining associations between a number of inputs and one or more outputs which may be empirical, linear or non-linear.The ANN architecture is divided into input layer, hidden layer, output layer, connection weight and biases, activation function and summation node.This algorithm has two main stages: training (learning) and recalling (generalisation).In the training stage, network weights and biases are utilized to generate the target output by reducing the error function.A learning algorithm is used to progress through the network and it is trained by epochs.An entire cycle of all the training data existing in the network is termed as epoch.The degree of error is measured in terms of mean squared error (MSE).At the end of each epoch the MSE is determined and the modelling is continued till the error is minimised.
M. Benghanem, et al. [12] estimated the daily global solar radiation in Al-Madinah (Saudi Arabia) using various Back Propagation(BP) ANN models.Different combinations of air temperature, relative humidity, sunshine duration and the day of the year were used as inputs for modelling.The model with air temperature and sunshine duration had the best results with a correlation coefficient of 97.65 %.
Ozgür Çelik, et al. [13] developed various ANN models with Levenberg-Marquardt (LM) algorithm to estimate the solar radiation at Turkey.The models varied in terms of the number and type of input parameters, learning algorithms, number of neurons in the hidden layer, correlation between network outputs and targets.The accuracy of the developed models were tested based on statistical error analysis methods.The correlation coefficient was found to be greater than 99%.
Mohandes et al. [14] developed an ANN model for predicting the global solar radiation in Saudi Arabia.Latitude, longitude, altitude and sunshine duration were used as inputs for the model.Various models were obtained by varying the number of neurons in the input, hidden and output layers.Mean Absolute Percentage error varied from 6.5 to 19.1%.
Manipal (13.347°N, 74.788°E), located in south-west India has a hot and humid climate throughout the year.Even though the two data loggers of available at were created to be water proof, they failed to withstand the humid environment in Manipal.The data from the solar radiation devices could only be accessed from the computer which was connected to the data loggers.The main objective of the project was to connect the system with a Raspberry Pi so that the data could be accessed remotely and also to insulate the entire system from rain and humidity.The solar data obtained using the Raspberry Pi will be used to validate various AI model for solar radiation estimation in the future.

Pyranometer
It is a device which measures the global radiation data on a plane surface.Solar energy incident on a unit surface area per unit time is irradiance.The Campbell Pyranometer (CMP) series of pyranometers specifically comprises of a thermopile detector mounted on a base secured by a hemispherical glass dome.The working principle of a CMP pyranometer as mentioned by Muneer et al [15] is as follows: The thermopile reacts to the total power, unselective to the spectral distribution of the radiation absorbed.The heat produced by the absorbed radiation moves through a thermal resistance to the heat sink.The temperature difference over the thermal resistance of the disc is converted into voltage, which is read by the computer.

Pyrheliometer
It is used for the measurement of direct or beam solar radiation with a field of view which is limited to 5°.Usually, an absorber plate is located at the base of a collimating tube having precision apertures.The apertures protect the instrument and also act as a filters which pass solar radiation between 200nm -4000nm.The absorber receives only beam radiation and a small amount of diffuse radiation falling within the acceptance angle of the instrument.

Data logger
Data logger is an electronic instrument that records and reports various changes in environmental conditions over time such as temperature, humidity, solar radiation etc.The LOGBOX SD is a weatherproof data logger specifically designed to be integrated with Kipp & Zonen solar radiation instruments.Multiple instruments can be connected to it at the same time as it is an 8 channel data logger.The data collected is stored on a 512 MB SD card that is included as standard.This device has an IP 65 weatherproof enclosure and an operating temperature range from -40°C to +60°C.Table 1 shows the materials that were used for integration of Raspberry Pi with data logger system.All the measuring devices were connected to one of the two data loggers.These collect the data in a set interval (1 minute presently) and write it to RS232 and also to the SD cards placed inside them.Using a RS232 to USB adapter both the data loggers are connected to a Raspberry Pi that collects the data and transmits it to an internal server.The data can be accessed from any device connected to the university Local Area Network.The measured solar radiation data can be accessed from http://172.16.62.140/solar/data/.The Raspberry Pi unit can easily be accessed using a SSH client.In this case Putty was used as the client.
Fig. 2 shows the flowsheet depicting the connections made.For developing the ANN model, five input parameters were used namely minimum temperature, maximum temperature, average temperature, altitude and sunshine duration.The monthly average values of these parameters from 2011-2015 for Manipal were collected from National Renewable Energy Laboratory [16].The monthly average solar radiation (Kwh/m2/day) for these years was used as the output to formulate the model.The entire system is connected to two data loggers which inturn is connected to the Raspberry Pi.Table 2 mentions about the data loggers to which instrument is connected with.

Results and discussion
The entire data Raspberry Pi system was placed inside an insulated plastic box to protect the unit from extreme weather conditions as shown in Fig. 4. The box was placed few centimetres above the ground for better air circulation and to prevent direct contact with water in case of heavy rainfall.In order to sustain humidity, silica gel was placed inside the box.The level of silica gel remaining is periodically checked using the DHT22 temperature and humidity sensor.The batteries of the data loggers had started to corrode and were replaced with external grid powered voltage adapters.Instead of using a single RS232 to USB adapter two adapters are used in order to prevent interference of the two RS232 signals.The box consists of the Raspberry Pi, the two data loggers, the adapters and various components used to complete the connections.The continuous solar radiation data obtained was documented and analysed.Fig. 5 and Fig. 6 show the solar radiation trend in Manipal for a typical sunny day.According to the obtained graphs the sunrise in Manipal is around 6:30 a.m. and the sunset is close to 7:15 p.m. From Fig. 8   The performance plot is shown in Fig. 8. where the Mean Sqaure Error (MSE) decreases with the increse in the no of epochs.The Mean Absolute Percentage Error(MAPE) for the formulated ANN model was calculated to be 5.86%.

Conclusions
A successful integration of the solar radiation equipments with a Raspberry Pi was made, whereby remote access to the data was enabled.The entire Raspberry Pi -Data Logger system was placed inside a plastic container which was able to withstand the hot and humid climate of Manipal.
The solar radiation data is unavailable in many meteorological stations worldwide, mainly due to high cost of calibration and maintenance of the solar radiation measurement instruments.The difficulties involved in the solar radiation measurement has led to the formulation of various models for its prediction.An AI model was developed using various meterological data and it showed fairly accurate predictions of solar radiation at Manipal with a R 2 value of 0.945 and MAPE of 5.86%.The future work of this project is mentioned below: x Connect the Raspberry Pi over the Wifi at MIT, Manipal so that a LAN connection is not required everytime to access the data.
x Develop different ANN models by changing the type and the number of input parameters and validate each model.
x Develop different Artificial Intelligence models such as Genetic Algorithm so that the model can be explicitly expressed in terms of its input parameters.
x Determine the effectiveness of the developed models in predicting the solar radiation of places excluding Manipal.

Figure 2 .
Figure 2. Flowsheet depicting the connections made The neural network fitting tool nntool of Matlab software version 2013a was used for developing the ANN model.The model was trained using the Levenberg-Marquardt (LM) algorithm.70% of the dataset was used for training and the rest were divided equally for testing and validation.A flowchart of the modelling process is shown in Fig. 3.

Figure 3 .
Figure 3. Flowchart of the modelling process

Figure 4 .Fig. 4 .
Figure 4. Sun tracker installed with solar radiation monitoring instruments the average daily global solar radiation for a typical day in March is around 620 W/m 2 .The average daily UV radiation from Fig. 6 is around 25.28 W/m 2 .The average values are calculated for a time range of 8 a.m. to 6 p.m.

Figure 5 .
Figure 5. Variation of measured global solar radiation throughout the day The regression plot obtained is shown in Fig. 7.It is a measure of the accuracy of the formulated model.The plot describes the relation between the measured solar radiation (target) and the estimated solar radiation

Figure 6 .Figure 7 Figure 8 .
Figure 6.Variation of UV radiation throughout the day times.Kipp and Zonen's CUV5 UV Radiometer is used in this case for measuring the global UV irradiance.UVS A-T and

Table 1 .
Materials required for the integrated Raspberry Pi -Data Logger system

Table 2 .
Connections of the instruments with the data loggers