Open access peer-reviewed chapter

Analysis of the Solar Tracking System for a Mobile Robot Prototype

By Dario Guilherme Toginho, Alex Archela and Leonimer Flávio de Melo

Submitted: February 19th 2019Reviewed: November 11th 2019Published: January 8th 2020

DOI: 10.5772/intechopen.90436

Downloaded: 523


Methods to detect the position of the sun and orientate a solar panel to its position are used in order to optimize the power generated. Two possible approaches are using light depending resistor (LDR) sensors, or using a GPS and equations that model the geometry between the Earth and the Sun. The main objective of this work is the proposal of a prototype system to optimize the harvesting of solar energy on photovoltaic panels. In this chapter, a mobile robot powered by a solar panel orientated by a LDR matrix and a GPS device was developed. The LDRs were used as the representation of vectors normal to a surface, where its sum resulted in the most lighted point. The GPS, in turn, provided location, date and time data, which were used in the calculations of the Sun?s azimuth and zenith, used to orientate the panel. The obtained results show that an orientated photovoltaic panel has a better performance when compared to a static panel. Possibilities and opportunities of research tend to grow for the next years with many possible works to be done in the future, both in mobile robotics and in other systems powered by photovoltaic panels.


  • photovoltaics
  • embedded
  • robotics
  • tracking
  • optimization

1. Introduction

The use of photovoltaic energy is one of the most promising alternative energy resources. Given the high fossil fuel consumption and economic and environmental impact of other sources, solar energy has become one of the most viable alternatives, given its low impact and the fact that it is renewable.

The sun provides both thermal and light energies, and in order to convert its light energy to electrical energy, photovoltaic cells are used. The cells of the panel used in this work are made of silicon. According to [1], the efficiency of large-area commercial cells is about 24%, and the upper limit of the silicon solar cell efficiency is 29%. In order to optimize the energy generated by a photovoltaic panel, instead of using it in a fixed position, methods of tracking the position of the sun and adjusting the panel accordingly are used, so the sun’s rays are perpendicular to the photosensitive surface [2].

The works of [3, 4] show systems that use light-dependent resistor (LDR) as a way to obtain the sun’s position [5]. On the other hand, the work of [6] shows an approach that allows the control of a photovoltaic cell based on its temperature, and the work of [7] shows a different design to the motors that control the position of photovoltaic panels, in order to decrease the energy used by the drivers [8].

In this chapter a method that uses both GPS and a LDR matrix is described, with the solar panel attached to a mobile robot, using ARM microcontroller device (STM32F407). Also there is a comparison of both approaches, in order to find the most efficient position for the panel and the possible applications both in the field of mobile robots and in others.


2. Solar tracking approaches

Similar to the work of [9], in this paper a solar panel powers a mobile robot, but the main difference is that the panel on the robot of [9] has two motors to move it in the x-axis and y-axis [10]. The robot used in this work has a panel that moves in the φ-axis (spherical coordinates), and the adjustment of the panel position consists in operating this φ-axis motor and adjusting the position of the robot [11, 12].

2.1 LDR approach

The LDR matrix consists of a Styrofoam half-sphere with 20 LDRs attached on its surface, each one representing a coordinate of the three-dimensional space. Figure 1 shows a 3D model representing the LDR positions.

Figure 1.

LDR surface 3D model, where the black arrows represent the position of the LDRs.

The LDRs have a voltage divider, and the microcontroller’s A/D converter reads its value. As light reaches the LDR, its resistance decreases. The design of the voltage divider was done in a way that its output voltage increases, so the more light reaches on the LDR, the higher the readings will be on the A/D converter.

However, the LDRs are sensitive not just to sunlight but also the environment’s reflected lights, and the A/D converter reads these lights with a small difference between them. In order to find which reading corresponds to the direct sunlight, a series of mathematical operations are performed, in a way that increases this difference.

When representing the LDRs in spherical coordinates ρθφ, we may change ρto the A/D converter read value. So, we can write the coordinates as Lθφθφ, where Lθφis the LDR A/D reading on the corresponding θand φcoordinates. Since the microcontroller A/D converter has a 12 bit resolution, its value range is seen on Eq. (1):


In order to find the most relevant readings, all of them are divided by the average and then squared. In this way, it is possible to obtain the most significant readings. These readings are represented by Wθφ, as seen on Eq. (2), where Lθφ´represents the average of the readings of all LDRs:


The next step to obtain the position of the sun via the LDRs is to convert the spherical coordinates Wθφθφto the Cartesian coordinate system xyzand then sum all elements. As a result, we obtain the coordinates of the position on the Styrofoam surface that represents a vector pointing towards the sunlight. The spherical coordinates to Cartesian equations can be seen on Eqs. (3)(5):


Then, the result in spherical coordinates ρfinalθfinalφfinalis given by Eqs. (6)(8), where Σx, Σy, and Σzare the sum of the respective Cartesian coordinates of all LDRs:


Having the θfinaland φfinalcoordinates, it is possible to adjust the position of the panel in such way it is perpendicular do the direct sunlight, using θfinalto adjust the position of the robot and φfinalto adjust the servomotor.

2.2 GPS approach

The use of the GPS device to obtain the position of the sun is based on a set of equations that return the coordinates of the sun in the horizontal coordinate system. These coordinates are the zenith angle, the altitude angle, and the azimuth angle, and all of them are seen in Figure 2.

Figure 2.

Azimuth and altitude angle of the sun (adapted from [6]).

In this work, Eqs. (9)(11) are the same from [9]:


where θz: incidence angle (or zenith angle); δ: declination angle; α: altitude angle; φ: local latitude; ω: hour angle; A: Azimuth angle.

The declination angle δis the angle between the equator and a line connecting the earth and the sun, and it varies according to the current date. The hour angle ωis the angle that depends on the current time, representing the position of the sun above the observer.

The GPS device used is shown in Figure 3, and it provides the current time and location and, with these data, is possible to calculate the solar angles and correct the panel position accordingly.

Figure 3.

Picture of GPS device used.

It sends data on an interval of 1 second. The data received is a string that uses National Marine Electronics Association (NMEA) specification. The string contains coded phrases, and each phrase contains a specific set of information. Among the phrases, there is information containing the current location, time, and date. Figure 4 shows an example of all phrases received.

Figure 4.

NMEA specification data received through serial monitor.

The first phrase, being the one with the code $GPRMC, contains all the information required to obtain the current position of the sun. Commas separate each part of the data. After the code, the first number is 134759.00, which represents the time 13h47min59s. The second number is 2319.68361 followed by the letter S, which represents south latitude 23°1,968,361′. After that is the number representing the longitude followed by the letter W, which stands for west, so the longitude is 51°1215109’West. The next piece of information, which is 0.019, is the current speed over the surface in knots, followed by the number 170518, which stands for the date, in this case meaning May 17th of 2018.


3. Implementation

A set of PWM signals drive the motors of the robot, and its speed is proportional to the duty cycle used. The duty cycle in turn is proportional to the difference between the direction of the robot and the direction of the sun. A picture of the robot is seen in Figure 5.

Figure 5.

Picture of the mobile robot.

This difference is obtained calculating the Euclidian distance between the obtained position of the sun and the direction of either the front or the back of the robot (whichever is the nearest one) and minimizing it. As this difference is calculated using unit vectors, its range, as seen on Eq. (12), is never higher than 2:


So dis the maximum possible distance between the position of the robot and the position of the sun; therefore, d=2implies a maximum use of the motors to correct the position of the robot, and d=0means the robot is at the desired position.

However, as a control method, d=0is not used as a parameter to determine if the desired position is achieved, for it is an ideal situation. Instead, a value close to 0is used. So, for example, a possible condition to consider that the robot is in the correct position is to consider d<0.01.

Sections 3.1 and 3.2 have a detailed description of each approach used to detect the direction of the sun, and Figure 6 contains a block diagram of the system.

Figure 6.

Block diagram of the system.

3.1 LDR implementation

A half-sphere of Styrofoam was used to arrange the LDRs symmetrically, and the position of each LDR was chosen based on the manufacturing marks on its surface, having a total of 20 positions. All LDRs had a common terminal connected to a voltage source, and the other ends were connected to a multiplexer circuit. This multiplexer circuit is connected to the microcontroller, which selects the LDR and also reads its analogic value.

After the microcontroller calculates the position of the sun, it sends a signal to the motors of the mobile robot, to adjust its position in a way that its front or its back faces the sun and to the servomotor to adjust it to the proper inclination. The decision of if it is either the front or the back of the robot that should face the sun is based on which of these sides are closer to sunlight, in order to minimize the motion of the robot.

The signal sent to the motors of the robot, as said in the beginning of Section 3, is a PWM signal, proportional to the Euclidian distance in the x-y plane of the position of the sun and the front, or back, of the robot, which is seen in Eq. (13):


The value of yrobotis either 1, if the sun is closer to the front of the robot, or − 1, if the sun is closer to the back of the robot. As dldrgets closer to 0, it means the robot is getting closer to the direction of the sun.

3.2 GPS implementation

An electronic GPS device was used to obtain the required data to calculate the position of the sun, these data being latitude, longitude, day, month, year, hour, and minute. In addition, an electronic compass was used to obtain the angle the front of the robot formed with the north direction.

In order to keep the same reference as the LDR approach, the compass returns 90° when the front of the robot faces north and −90° when its back faces north. The value of the zenith angle is used as a signal in the servomotor to adjust the inclination of the solar panel. To make the robot face the sun, the Euclidian distance between its front or its back, depending on which one is closer, and the azimuth of the sun must be minimized. Eq. (14) returns this distance, where θnis the angle of the north direction and the robot:


As in Section 3.1, the value of yrobotis either 1, if the sun is closer to the front of the robot, or − 1, if the sun is closer to the back of the robot. As dgpsgets closer to 0, it means the direction of the robot is getting closer to the direction of the sun.


4. Results

4.1 LDR results

The preliminary tests on the LDR matrix were done in a darkroom with a flashlight. Figure 7 shows a picture of the position that was tested.

Figure 7.

Photo of the first LDR sample with the coordinate of each LDR.

Then, with each LDR connected to the A/D converter, the data were collected and processed in order to obtain the light position on the surface. In Table 1, written in the color red are the values read by the A/D converter, with the range mentioned on Eq. (1), for each LDR on its respective position in Figure 7, and NA (not applicable) represents the positions where there are no LDRs.

LDR spherical coordinatesφ=22.5φ=45φ=67.5

Table 1.

Raw readings of the a/D converters with range from 0 to 4095.

Then, the values from Table 1 are used as argument to Eq. (2), and as the next step, Eqs. (3)(8) are used.

Using the data of Table 1, the average is calculated, and the value Lθφ´=1789.5is obtained. So, all values in Table 1 below 1789.5 will become 0, and the remaining ones will be subtracted and then squared.

The sum of these values as vectors equals the resulting position (ρfinalθfinalφfinal), which is seen as the blue arrow in Figure 8. The spherical coordinates obtained are (24.952508o, 38.555257o, 97.442222o). However, in Figure 8, the ρcoordinate was reduced in order to fit in the figure.

Figure 8.

3D model of the collected data and its result on the surface.

Table 2 shows a set of 10 samples of Figure 7 on a 1 second interval, in which n = 1 is the sample plotted in Figure 8. The table also includes the mean value of the samples and the standard deviation.

Sample time (seconds)φ coordinate [o]θ coordinate [o]
Std. deviation ofφ[o]0.068990
Std. deviation ofθ[o]0.855672

Table 2.

LDR samples over 10 s.

4.2 GPS results

The GPS was tested under the following conditions:

  • Local: Londrina State University

  • Time: 13h48min

  • Sample time: 1 s

The GPS device received its fix data in the default interval of 1 second, and for each sample, an altitude angle and an azimuth angle were calculated. Table 3 shows the solar angle data and its mean values and standard deviations.

Sample time (seconds)Altitude α[o]Azimuth A[o]
std. deviation ofα[o]0.003493
std. deviation ofA[o]0.019659

Table 3.

GPS samples over 10 seconds.

4.3 Power results

Three test scenarios were executed. One is where the solar panel is fixed and the other two where the sun is tracked, one using LDR and the other using the GPS. The sampling period was 5 minutes.

In Figure 9 it is possible to observe the power generated by the panel on each scenario. The LDR and the GPS approaches have shown a very similar performance compared to each other, and both of them demonstrated to be much better than a fixed panel, having a gain of approximately 30%. The yellow line in the figure represents what would be the ideal maximum generated power by the panel, considering the average solar irradiation nearby the site and the surface area of the panel. The LDR approach as the GPS has shown an efficiency of 80% compared to the ideal maximum power.

Figure 9.

Power samples of the three tested scenarios.


5. Conclusion

During the data collection, the LDR matrix has showed to be very sensitive to noise, so it presented a higher deviation. On the other hand, the GPS data had a much lower deviation. However, during the data collection, it took a certain amount of time to get a fix and obtain the current date, time, and location.

Besides the solar panel orientation, i.e., for applications in the mobile robotics, the GPS device provides navigation data that may be useful, which is an advantage. However, if the device takes too long to get a fix or loses the fix, the data will be null or delayed. So, in order for a mobile robot to obtain full-time orientation, both the GPS and LDR approaches may be used together.

For other applications, such as a panel on a fixed position, the latitude and longitude are fixed, so there is no need for a GPS device, just a real-time clock (RTC) device, which eliminates the GPS fix time issue and also has a lower cost compared to the LDR approach.

Having all things considered, the LDR is a low-cost method to track the position of the sun; however, it is more affected by noise. The sun-earth equations have shown problems only when depending of a GPS device to provide data; otherwise, it is the most precise approach.

© 2020 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution-NonCommercial 4.0 License, which permits use, distribution and reproduction for non-commercial purposes, provided the original is properly cited.

How to cite and reference

Link to this chapter Copy to clipboard

Cite this chapter Copy to clipboard

Dario Guilherme Toginho, Alex Archela and Leonimer Flávio de Melo (January 8th 2020). Analysis of the Solar Tracking System for a Mobile Robot Prototype, Reliability and Ecological Aspects of Photovoltaic Modules, Abdülkerim Gok, IntechOpen, DOI: 10.5772/intechopen.90436. Available from:

chapter statistics

523total chapter downloads

More statistics for editors and authors

Login to your personal dashboard for more detailed statistics on your publications.

Access personal reporting

Related Content

This Book

Next chapter

Some Reliability Aspects of Photovoltaic Modules

By Titu-Marius I. Băjenescu

Related Book

First chapter

Lidar for Biomass Estimation

By Yashar Fallah Vazirabad and Mahmut Onur Karslioglu

We are IntechOpen, the world's leading publisher of Open Access books. Built by scientists, for scientists. Our readership spans scientists, professors, researchers, librarians, and students, as well as business professionals. We share our knowledge and peer-reveiwed research papers with libraries, scientific and engineering societies, and also work with corporate R&D departments and government entities.

More About Us