Disclaimer: This is an example of a student written essay.
Click here for sample essays written by our professional writers.

Any scientific information contained within this essay should not be treated as fact, this content is to be used for educational purposes only and may contain factual inaccuracies or be out of date.

Dual Axis Motion Tracker with Advanced User Interface (Sunlight Tracker)

Paper Type: Free Essay Subject: Engineering
Wordcount: 9863 words Published: 18th May 2020

Reference this


Solar energy is progressing quickly as a major resource for renewable energy.  The Sun’s radiant light and heat is harnessed using a variety of ever-changing techniques such as solar heating, photovoltaic, solar thermal energy, solar architecture, molten salt power plants, and artificial photosynthesis.  Trackers direct solar panels or modules in the direction of the sun.  Throughout the day, these instruments alter their orientation to follow the route of the sun to maximize capture of energy. The use of solar trackers can boost the output of electricity by about a third, and some in some areas claim as much as 40%, Compared to set angle modules. The conversion efficiency is enhanced in any solar implementation by continuously adjusting the modules to the optimum angle as the sun crosses the sky. Although the original price of setting up the monitoring system is significantly high, the alternatives suggested over time are cheaper. This project discusses designing and building a solar tracking system prototype with a dual axis of freedom. The system utilizes the algorithm of sun-position to monitor the sun all day long. The main objective of the project is to track the sun using geographical features such as time and date and reflect the sun to predefined target for various applications.



Solar energy is clean and abundant. Solar techniques use the sun to supply heat, light and electricity. They are for industrial and domestic applications. With the alarming pace of depletion of significant conventional energy sources, such as petroleum, coal and natural gas, combined with the environmental impact of the method of harnessing these energy sources, there is an urgent need to invest in renewable energy sources that can provide sufficient energy for the future. The sun’s energy potential is enormous. (Anon, 2019) Energy is the primary driving factor when it comes to any nation’s growth. There is a huge amount of energy in the worldwide community that is extracted, distributed, transformed and consumed every day. Fossil fuels make up about 85% of the electricity generated. Resources of fossil fuel are restricted, and they are known to cause global warming due to greenhouse gas emissions. There is an increasing need for energy from sources such as solar, wind, sea tidal waves and geothermal for sustainable power supply. (Anon, 2019)

Get Help With Your Essay

If you need assistance with writing your essay, our professional essay writing service is here to help!

Essay Writing Service

Solar photovoltaic (PV) power is one of the most widely accessible resources among these kinds of energy. Due to research and development operations to enhance the efficiency of solar cells and reduce the price, this technology has been embraced more commonly for housing use nowadays. (Rcciit.org, 2019) According to the International Energy Agency (IEA), since the mid-2000s, global photovoltaic capacity has risen at an average of 49 percent per year. It is extremely anticipated that solar PV energy will become a significant power source in the future. (Rcciit.org, 2019)

(Anon, 2019) Therefore, as an important means of extending renewable energy resources, solar power is quickly becoming popular. But most of India’s solar panels are placed on a fixed surface like roof. As sun is a moving object, this strategy is not the best technique. One of the alternatives is to use a will actively following the Sun solar tracker. A solar tracker is a sensory tool constructed with a solar panel that monitors the movement of the sun across the sky and moves the panel according to the movement of the sun to ensure that the highest quantity of sunlight hits the panels throughout the day. In the design proposed, mirror is used instead of panel to reflect the sun to the panels. (Anon, 2019)

The tracker attempts to navigate the route after discovering the sunlight, ensuring that the finest sunlight is detected. Commercially, there are mechanisms for single-axis and two axis monitoring. (Anon, 2019) Previous researchers used a single axis monitoring scheme that only follows the east-west motion of the Sun. But there are two kinds of movement on Earth, the daily motion and the annual movement. The daily motion leads the sun to appear over the earth from east to west, whereas the annual movement causes the sun to tilt at an angle of 23.5 degrees while moving east west. Therefore, the solar panel’s highest effectiveness is not used by a single axis monitoring scheme. It is essential to correctly monitor the sun motion in dual axis tracking scheme. (Anon, 2019) With the sun always facing the panel, as the panel works at its highest effectiveness, the peak energy can be absorbed. The main objective of this project is to track the sun using geographical features and guide the sunlight to a target to use the energy for various applications for example charging a battery using the energy obtained by the panel.



(Anon, 2019) Extraction of usable electricity from the sun became feasible. The solar cell is a material with a semiconductor that converts visible light into direct current. By using solar arrays, a series of electrically linked solar cells, a DC voltage is generated which can be used on a charge. Solar arrays are increasingly being used as their efficiencies increase. They are particularly common in distant regions where there is no grid connection. Photovoltaic energy is the result of the sun. The technology used to convert solar directly into electrical power is a photovoltaic cell, widely known as a solar cell. A non-mechanical instrument made of silicon alloy is the photovoltaic cell.

The photovoltaic cell is the photovoltaic system’s fundamental construction block. The cells can differ between 0.5 inches and 4 inches. However, only 1 or 2 watts can be produced by one cell that is not enough for most devices. Photovoltaic array performance relies on sunlight. The quantity of solar energy obtained by the array and therefore its efficiency is considerably affected by climatic circumstances such as clouds and fog. Most PV modules are effective between 10 and 20% (Anon, 2019).

Hossein Mousazadeh et Al., [ (2011), Journal of Solar Energy Engineering, Vol.133] (Citeseerx.ist.psu.edu, 2019) The maximization of collected energy from an on-board PV array was studied and tested on a solar assist hybrid electric tractor (SAPHT) plug-in. A sun tracking system on a portable structure was built and assessed using four light-dependent resistive sensors. The experimental studies using the sun-tracking scheme showed that, compared to the horizontally set mode, 30% more power was obtained. The direct sun beams were sensed using four LDR detectors. Each pair of LDRs was segregated as a shading device by an obstruction. As an interface between hardware and software, a microcontroller-based electronic drive board was used. An energy MOSFET was used to regulate the actuators for driving each motor. The experimental findings suggested a very solid and efficient design of the scheme (Citeseerx.ist.psu.edu, 2019)

K.S. Madhu et al., (2012) International Journal of Scientific & Engineering Research vol. 3, 2229–5518, (Rcciit.org, 2019) It states that a single axis tracker monitors the sun from east to west, and a two-axis tracker monitors the sun’s daily motion from east to west and the sun’s seasonal declination. Solar power systems are concentrated using lenses or mirrors and monitoring systems to concentrate a big region of sunlight on a tiny beam. Using the photoelectric effect, PV converts light into electrical current. Solar power is the transformation of sunlight into electricity. Test findings show that the rise in monitoring solar plate energy effectiveness is 26 to 38 percent in ordinary days compared to the set plate. And it differs at any stage during cloudy or rainy days (Rcciit.org, 2019).

2.1 The Earth: Rotation and Revolution


The earth is and revolves around the sun’s planet. In addition, it rotates around its own axis as well. Thus, there are two earth motions, rotation and revolution. The earth rotates from west to east on its axis. The Earth’s axis is an imaginary line going through the Earth’s northern and southern poles. The earth finishes its 24-hour rotation. This movement is accountable for day and night happening. The solar day is a 24-hour period and a sidereal day (distant stars) is 23 hours and 56 minutes long. The 4-minute distinction is due to the reality that the position of the earth continues to change with regards to the sun. (Eie.uonbi.ac.ke, 2019).

Figure 1. Rotation and revolution

The earth’s motion around the sun is called revolution. It also occurs from west to east and takes 365 days to complete. Earth’s orbit is elliptical. The distance between the earth and the sun continues to change because of this. The obvious annual track of the sun is known as the ecliptic through the fixed stars in the celestial sphere. The axis of the Earth allows an angle to the ecliptic plane of 66.5 degrees. Because of this, with regards to the sun, the earth reaches four critical positions. (Eie.uonbi.ac.ke, 2019).

2.2 Solar Irradiation: Sunlight and the Solar Constant


Through electromagnetic radiation, the sun provides energy. At the core of the sun, there is solar fusion resulting from the intense temperature and pressure. At 600 million tonnes per second, protons are transformed into helium atoms. Because the process output has less energy than the protons that started, fusion provides rise to a lot of energy in the form of gamma rays that are absorbed and re-emitted by electrons in the sun. The complete energy of the sun can be estimated by the laws of Stefan and Boltzmann. P=4πr2 σϵT 4 W [1], T is the temperature, which is approximately 5800 K, r is the radius of the sun which is 695800 km and σ is the Boltzmann constant which is 1,3806488 × 10-23 m 2 kg s-2 K-1. The surface emissivity is denoted as ϵ. E= mc2 is transformed into energy every second because of Einstein’s renowned law about millions of tons of matter. The Earth irradiated solar energy is 5,1024 Joules per year. This is 10,000 times the current annual consumption of energy globally. (Eie.uonbi.ac.ke, 2019)



2.3.1 Elevation angle

The angle of elevation is used interchangeably with angle of altitude and is measured from the horizontal angular height of the sun in the sky. To describe the height in meters above sea level, both altitude and elevation are used. The elevation when the sun is directly overhead is 0 degrees and at sunrise it is 90 degrees. The elevation angle differs throughout the day and also depends on the location’s latitude and the day of the year. (Eie.uonbi.ac.ke, 2019)

2.3.2 Zenith angle

This is the angle between the vertical and the sun. It is comparable to the elevation angle but is measured not from the horizontal, but from the vertical. Hence the angle of zenith= 90 degrees – angle of elevation.

2.3.3 Azimuth angle

This is the direction of the compass from which the sunlight is coming. At midnight, the sun is straight south in the northern hemisphere, and straight north in the southern hemisphere. The angle of azimuth differs all day long. The sun rises straight east at the equinoxes and sets straight west irrespective of latitude. Thus, the azimuth angles at sunrise are 90 degrees and at sunset 270 degrees. (Eie.uonbi.ac.ke, 2019)

Figure 2: Angle of Sun (Images.app.goo.gl, 2019).




 In particular, the efficacy of a solar tracker and PV technology is directly linked with the quantity of sunlight to which it is subjected; its energy output depends on the quantity of light reaching the solar cell.

2.4.1 Active tracking

Active monitoring utilizes engines, gears and actuators to place the solar tracker perpendicular to the sunlight. Trackers using sensors to monitor the sun input information into the controller, which in turn drives the engines and actuators to place the tracker. There are trackers using solar maps as well. Solar maps provide data on where the sun is at distinct times of day throughout the year, depending on the place. Trackers using solar maps do not need the input of sensors to track the sun. (Web.wpi.edu, 2019)

But trackers also use both detectors and solar maps. The sensor would be used to monitor the sun during sunny weather. But the data from the solar map would be used during cloud covered times. Even in cloudy condition, tracking the sun is essential as solar panels can generate energy under cloudy circumstances.

2.4.2 Passive tracking

For moving the tracker, passive trackers use compressed gas. The difference in gas pressure is produced depending on the position of sunlight on the gas containers, shifting the tracker until it reaches an equilibrium place. Passive tracker’s benefit is that a controller is not required by the system. But passive trackers react slowly and are susceptible to wind blows. (Web.wpi.edu, 2019).




Solar Position Algorithm (SPA) (En.wikipedia.org, 2019) This algorithm calculates solar zenith and azimuth angles over the period from -2000 to 6000, with uncertainties of + /- 0.0003 degrees depending on Earth’s date, current time and place. The Sun’s position in the sky is a function of moment as well as the geographic place of observation on the surface of the Earth. As Earth orbits the Sun over a year, the Sun appears to be moving towards the fixed stars on the celestial sphere, along a circular route called the ecliptic. The rotation of the Earth around its axis appears to cause the fixed stars to move across the sky in a manner that depends on the geographic latitude of the observer. The moment when a fixed star transits the meridian of the observer relies on the longitude of the geography (En.wikipedia.org, 2019)

Therefore, to discover the position of the Sun for a specified place at a specified moment, following steps are followed.

     calculate the Sun’s position in the ecliptic coordinate system,

     convert to the equatorial coordinate system, and

     convert to the horizontal coordinate system, for the observer’s local time and location.


3.1 Solar Position Algorithm (SPA)

  1. Elliptic Co-ordinates


  • No of days since Greenwich noon terrestrial time, on Jan 1 2000

Calculate n:

n = JD – 2451545.0 where JD – Julian days.

  • Sun’s mean longitude is given by,

  • Sun’s mean anomaly is given by,

L and g ranging 0 degree to 360 degrees adding or subtracting multiples of 360 degrees as needed.

  • Sun’s elliptic longitude is given by,

  • Sun’s elliptic latitude is given by,

ß = 0.

  • R = 1.00014 – 0.01671 cos g – 0.00014 cos 2g


  1. Equatorial Coordinates

λ, ß, R – Elliptic coordinate system

  • Elliptic obliquity is given by,

α = arctan (cos ε tan λ) where α same quadrant as λ

  • Right ascension is given by,

α = arctan (cos ε sin λ, cos λ)

  • Sun’s Declination

δ = arcsine (sin ε, sin λ)

  1. Horizontal Coordinates
  • X = R cos ε cos λ
  • Y = R cos ε sin λ
  • Z = R sin ε
  1. Elliptic obliquity is approximated by,

2. Sun’s declination as seen from earth is given by,

3.2 Important formulae of SPA:

  1. Solar azimuth angle

Sin φs = – sin h cos ε/ sin Θs

  1. Solar zenith angle

Cos Θs = sin αs = sin φ sin δ + cos φ cos δ cos h

  1. If solar elevation is assumed then,

Cos Θs = sin δ cos Φ – cos h cos δ sin Φ/ sin Θs

φs – Solar azimuth angle

Θs – Solar zenith angle

h – Hour angle in local solar time

δ – Current declination of sun

Φ – local altitude

  1. Equation of time mathematical description


EOT- Time difference between apparent and mean solar time

GHA – Greenwich hour angle of actual sun

GMHA – Universal time – GHA of mean sun



4.1 Software requirements: Arduino 1.8.9 in windows 10


4.2 Hardware requirements:


  1. Stepper motor 24 BYJ – 48



Figure 3: Stepper motor 24BYJ48(Images.app.goo.gl, 2019)

An electromechanical device that transforms electrical pulses into discrete mechanical movements is a stepper motor. A stepper motor’s shaft or spindle rotates in discrete increments when pulses of electrical control are applied in the correct sequence. The rotation of the motors has several direct connections to these input pulses applied. The applied pulses sequence is directly linked to the rotation direction of the engine(motor) shafts. The velocity of the rotation of the engine shafts is directly linked to the frequency of the pulses input and the rotation duration is directly linked to the amount of pulses input. A stepper motor’s capacity to be correctly controlled in an open loop scheme is one of the most important benefits. Open loop control implies there is no need for feedback on the position.

This sort of control eliminates the need for costly systems such as optical encoders for sensing and feedback. Your location is simply known by tracking the pulses of the input phase (Eeshop.unl.edu, 2019).

 Electronic parameter specifications:

Rated Voltage : 5VDC
Number of Phase : 4
Moderating Ratio : 1/64
Step Angle : 5.625°/64
Frequency : 100Hz
DC Resistance : 60Ω±7% (25℃)
Idle In-traction Frequency : ≥500 (PPS)
Idle Out-traction Frequency : ≥900 (PPS)
Detent Torque : ≥29.4mN.m
Pull-in Torque : ≥29.4mN.m
Insulated Resistance : ≥10MΩ(500V)
Dielectric Strength : 600VAC/1mA/1s
Insulation Class : A
Rise in Temperature : ≤55K(120Hz)
Noise : ≤35dB(120Hz,No load,10cm)

  1. Esp8266 Node MCU

Figure 4: Node Mcu circuit

Node-MCU is an IoT platform open source. Which involves firmware running on Espress if Systems ‘ ESP8266 Wi-Fi module and ESP-12-based equipment. By default, the term “Node-MCU” refers to the firmware instead of the dev kits. Node-MCU firmware has been created to replace AT commands with Lua scripting to make life simpler for developers. So, using AT instructions again in Node-MCU would be redundant (Ahir, 2019).

  1. Photovoltaic module 4W and 5V:


                                                          Figure 5: PV module

Photovoltaics are best known as a method of generating electricity by using solar cells to convert photovoltaic effect energy from the sun into a flow of electrons. Solar cells generate direct current from sunlight that can be used for powering machinery or recharging a battery.

4.3 Basic Structure of the model








Figure 6: Basic structure


The diagram above is the basic prototype of how the design will be, Esp8266 Node mcu is the backbone of the system which powers both the stepper motors to perform the functionality of the tracker. Stepper motors are mounted on the mirror structure as per the movement required for the design. The mirror structure is built using mechanical components which will be discussed further. The mirror structure reflects the sunlight received to the target such as house or PV module depending on the time of the day. The photovoltaic panel is kept in parallel to the mirror to collect the solar energy.

 4.4 Mechanical components and specifications




  1. Acrylic base plate

Figure 7: Acrylic base plate

This is the base of the design which holds the whole structure fixed to a nylon shaft                                                                                                            and acts as a support. An acrylic coupling bush is used to mount it.                       

  1. Plastic nylon shaft


Figure 8: Plastic nylon shaft

    A medium size nylon shaft is mounted on the acrylic base plate and is in connection with gear so that it will turn the structure as required.

  1. Copper bush

Figure 9: Copper bush

Copper bush is used to fix the nylon shaft as it has excellent thermal and electrical 

conductivity, good strength, formidable and resistant to corrosion.                        


  1. Carbon brush




Figure 10: Carbon brush

A carbon brush is a sliding contact used to convey electrical current in an engine or generator from a static to a rotating portion and to ensure a spark-free commutation with respect to DC machines.

  1. Bevel gear

Figure 11: Bevel gear

Bevel gears are gears in which the two shafts ‘ axes intersect and the gears ‘ own       tooth-bearing faces are conically formed. Most often, bevel gears are installed on shafts 90 degrees apart, but can also be engineered to operate at other angles.

Bevel gears are often used in differential drives, which can transmit energy at distinct speeds to two axes and are also a prevalent element of hand drills and rotorcrafts. The bevel gear is placed on the acrylic base plate in between the stepper motor and the nylon shaft.

  1. Plastic spur gear

Figure 12: Plastic spur gear

Spur gears can be used to raise or reduce a specified object’s torque or energy. The stepper motor used for rotation on the mirror frame is 5v DC and requires more power to move the load hence the gear is required.

  1. Mirror with size 6MM.

Chapter 5: System design and build



Fig 13: Structural view of system.













Figure 14: Circuit connections

The model is designed as shown in the figure above. Acrylic base plate is used as the foundation for the model where the whole structure is constructed on top of it. A plastic nylon shaft is mounted on the base plate. A stepper motor is placed on the base plate, grooves are made to fix the stepper motor using the screws. A bevel gear is used in between the stepper motor and nylon shaft for horizontal rotation of the motor. Mirror of size 6MM is placed on a frame made of plywood and is put on top of the nylon shaft using a coupler as shown in the diagram.

The other stepper motor is connected to the mirror frame using spur gear for vertical rotation of the mirror frame. Carbon bush is placed for the smooth and spark free rotation.  Esp8266 Node-Mcu module is the backbone of the model which controls the flow of the system. 4 digital pins are used to give input to the stepper motor. For connection of node-mcu to stepper motor ULN2003 motor driver module is used, and the circuit connection is made as shown in figure 2. After all these connections are made the code is developed in the Arduino 1.8.9 software and tested.



5.1 Stepper motor calculation


Gear ratio = 64

Stride angle = 5.626 degrees

No of steps for 1 revolution = 4096 steps

So, the number of steps of motor based on azimuth angle and the values are checked in increments of 20: 4096*20/360 = 228 steps.


5.2 Flow of system using SPA algorithm


SPA algorithm is used to execute the functionality of the system. In the code user will input the current month, day, time and latitude and longitude of the current location to locate the position of the sun of current location. ESP 8266 is used to connect to a Wi-Fi network which will help user to connect to a web server page.

When the esp8266 connects to a wi-fi network an Ip address is displayed on the console.

Using the IP address, it is run on the browser to display the web page to the user.

When the user enters submit button of sun then the esp8266 sends signal to the motor to rotate the mirror frame in the direction of the sun, as it moves to the sun’s position the azimuth angle and elevation angle of the sun is displayed on the console. If the intensity of solar rays is high, then the mirror reflects the solar rays falling on it to a Photovoltaic panel which is kept in an angle parallel to the structure. However, the reflection depends on the time of the day, as the sun moves from east to west it won’t be possible to always reflect the sun rays on to the panel. But can be used in various applications such as reflecting light to shady areas or reflecting light to a house to keep it warm.


5.3 Interface view


Figure 15: User interface











Chapter 6: Experimental work and results



  • The main functionality of the system was to detect the position of the sun using geographical features and move the mirror towards the direction of sun and reflect it to a target. It was seen that the reflection of sunlight onto target required sunlight with higher intensity. Higher the intensity the better the system performed.
  • There was not much loss of energy when sunlight was reflected from mirror to the panel, the efficiency was reduced about 5-8%. However, the model developed used convex mirror, to get better results and efficiency for larger solar systems concave mirror would be a better choice as it can increase the efficiency of about 10-15 %.
  • The reflection from mirror was poor when it was even partly cloudy hence the system requires minimal light for it to work. So, the system would not perform so well in cloudy weather.


  • Initially my design included the use of light dependent resistor as another

functionality by keeping the bulb light source next to the structure. But the use of LDR along with the main functionality was not feasible to make it work in sync with the sun detection feature.

  • This experiment was performed for both the functionalities separately and compared. It was possible to detect the sun elevation and azimuth angles successfully.
  •  LDR functionality was tested using Arduino Atmega328 using two ldr’s across the mirror with bulb as a light source, which resulted in bad outcomes because the LDRs were not very susceptible to a small change in angle from the source of light. The light source had to be kept very close for effectiveness.
  • As LDR was not a good choice, as it would affect the main functionality, the design had some changes, i.e. to create a web server so that user can interact with the system by submitting a button in the web page .Once the submit button is clicked by the user the location of the sun is detected.
  • For the purpose of web server i thought of using a wi-fi shield to interact with the web server but using Esp8266 Node-Mcu module was better as it would be a good match to my requirements.





Chapter 7: Code


#include <math.h>

#define pi    3.14159265358979323846

#define twopi (2*pi)

#define rad (pi/180)

#define EarthMeanRadius     6371       // In km

#define AstronomicalUnit    149597870      // In km

#define Pin1 D5

#define Pin2 D6

#define Pin3 D7

#define Pin4 D8

// Load Wi-Fi library

#include <ESP8266WiFi.h>


// Replace with your network credentials

const char* ssid     = “vodafone-5A9C”;

const char* password = “AX9AKXETV64UXQ”;


// Set web server port number to 80

WiFiServer server (80);

int Steps = 0;

//Input Variables ——————— Time has to be in UT (UNIVERSAL TIME)! NO TIME ZONES OR SUMMER TIMES ——–

int Year = 2019; //year

int Month = 8; //month

int Day = 16; //day

float Hours = 19; //hour

float Minutes = 59; //minutes

            float Longitude = 52.67; //enter longitude here

float Latitude = -8.57; //enter latitude here

int StepperUsingAzimuth = 0;



//Program Variables

float ZenithAngle;

float Azimuth;

float RightAscension;

float Declination;

float Parallax;

float ElevationAngle;

float ElapsedJulianDays;

float DecimalHours;

float EclipticLongitude;

float EclipticObliquity;


// Variable to store the HTTP request

String header;


// Current time

unsigned long currentTime = millis();

// Previous time

unsigned long previousTime = 0;

// Define timeout time in milliseconds (example: 2000ms = 2s)

const long timeoutTime = 2000;


void sunPos(){

  // Auxiliary variables

  float dY;

  float dX;


  // Calculate difference in days between the current Julian Day

  // and JD 2451545.0, which is noon 1 January 2000 Universal Time



float JulianDate;

long int liAux1;

long int liAux2;

// Calculate time of the day in UT decimal hours

DecimalHours = Hours + (Minutes / 60.0);

// Calculate current Julian Day

liAux1 =(Month-14)/12;

liAux2= (1461*(Year + 4800 + liAux1))/4 + (367*(Month

– 2-12*liAux1))/12- (3*((Year + 4900

+ liAux1)/100))/4+Day-32075;


// Calculate difference between current Julian Day and JD 2451545.0

ElapsedJulianDays = JulianDate-2451545.0;


// Calculate ecliptic coordinates (ecliptic longitude and obliquity of the

// ecliptic in radians but without limiting the angle to be less than 2*Pi

// (i.e., the result may be greater than 2*Pi)


float MeanLongitude;

float MeanAnomaly;

float Omega;


MeanLongitude = 4.8950630+ 0.017202791698*ElapsedJulianDays; //Radians

MeanAnomaly = 6.2400600+ 0.0172019699*ElapsedJulianDays;

EclipticLongitude = MeanLongitude + 0.03341607*sin (MeanAnomaly)

+ 0.00034894*sin(2*MeanAnomaly)-0.0001134

-0.0000203*sin (Omega);

EclipticObliquity = 0.4090928 – 6.2140e-9*ElapsedJulianDays

+0.0000396*cos (Omega);

// Calculate celestial coordinates (right ascension and declination) in radians

// but without limiting the angle to be less than 2*Pi (i.e., the result may be

// greater than 2*Pi)

float Sin_EclipticLongitude;

Sin_EclipticLongitude= sin (EclipticLongitude);

dY = cos (EclipticObliquity) * Sin_EclipticLongitude;

dX = cos (EclipticLongitude);

RightAscension = atan2(dY,dX );

if (RightAscension < 0.0) RightAscension = RightAscension + twopi;

Declination = asin(sin( EclipticObliquity )*Sin_EclipticLongitude );


  // Calculate local coordinates (azimuth and zenith angle) in degrees


float GreenwichMeanSiderealTime;

float LocalMeanSiderealTime;

float LatitudeInRadians;

float HourAngle;

float Cos_Latitude;

float Sin_Latitude;

float Cos_HourAngle;

GreenwichMeanSiderealTime = 6.6974243242 +


+ DecimalHours;

LocalMeanSiderealTime = (GreenwichMeanSiderealTime*15

+ Longitude) *rad;

HourAngle = LocalMeanSiderealTime – RightAscension;

LatitudeInRadians = Latitude*rad;

Cos_Latitude = cos (LatitudeInRadians);

Sin_Latitude = sin (LatitudeInRadians);

Cos_HourAngle= cos (HourAngle);

ZenithAngle = (acos(Cos_Latitude*Cos_HourAngle

*cos (Declination) + sin (Declination)*Sin_Latitude));

dY = -sin (HourAngle);

dX = tan (Declination)*Cos_Latitude – Sin_Latitude*Cos_HourAngle;

Azimuth = atan2(dY, dX);

if (Azimuth < 0.0)

Azimuth = Azimuth + twopi;

Azimuth = Azimuth/rad;

// Parallax Correction


*sin (ZenithAngle);

ZenithAngle= (ZenithAngle //Zenith angle is from the top of the visible sky (thanks breaksbassbleeps)

+ Parallax)/rad;

ElevationAngle = (90-ZenithAngle); //Retrieve useful elevation angle from Zenith angle



int findStepperMotorSteps (int azimuthValue) {

int steps = 0;

if (azimuthValue >= 0 && azimuthValue <=20) {

steps = 228;


else if (azimuthValue > 20 && azimuthValue <=40) {

steps = 456;


else if (azimuthValue > 40 && azimuthValue <=60) {

steps = 684;


else if (azimuthValue > 60 && azimuthValue <=80) {

steps = 912;


else if (azimuthValue > 80 && azimuthValue <=100) {

steps = 1140;


else if (azimuthValue > 100 && azimuthValue <=120) {

steps = 1368;


else if (azimuthValue > 120 && azimuthValue <=140) {

steps = 1596;


else if (azimuthValue > 140 && azimuthValue <=160) {

steps = 1824;


else if (azimuthValue > 160 && azimuthValue <=180) {

steps = 2052;


else if (azimuthValue > 180 && azimuthValue <=200) {

steps = 2280;


else if (azimuthValue > 200 && azimuthValue <=220) {

steps = 2508;


else if (azimuthValue > 220 && azimuthValue <=240) {

steps = 2736;


else if (azimuthValue > 240 && azimuthValue <=260) {

steps = 2964;


else if (azimuthValue > 260 && azimuthValue <=280) {

steps = 3192;


else if (azimuthValue > 280 && azimuthValue <=300) {

steps = 3420;


else if (azimuthValue > 300 && azimuthValue <=320) {

steps = 3648;


else if (azimuthValue > 320 && azimuthValue <=340) {

steps = 3876;


else if (azimuthValue > 340 && azimuthValue <=360) {

steps = 4104;


return steps;


void setStepperMotorPosition(int receivedAzimuthSteps){

int i = 0;

while (receivedAzimuthSteps! = 0) {

switch(i) {

case 0:

digitalWrite (Pin1, LOW);

digitalWrite (Pin2, LOW);

digitalWrite (Pin3, LOW);

digitalWrite (Pin4, HIGH);


case 1:

digitalWrite (Pin1, LOW);

digitalWrite (Pin2, LOW);

digitalWrite (Pin3, HIGH);

digitalWrite (Pin4, HIGH);


case 2:

digitalWrite (Pin1, LOW);

digitalWrite (Pin2, LOW);

digitalWrite (Pin3, HIGH);

digitalWrite (Pin4, LOW);


case 3:

digitalWrite (Pin1, LOW);

digitalWrite (Pin2, HIGH);

digitalWrite (Pin3, HIGH);

digitalWrite (Pin4, LOW);


case 4:

digitalWrite (Pin1, LOW);

digitalWrite (Pin2, HIGH);

digitalWrite (Pin3, LOW);

digitalWrite (Pin4, LOW);


case 5:

digitalWrite (Pin1, HIGH);

digitalWrite (Pin2, HIGH);

digitalWrite (Pin3, LOW);

digitalWrite (Pin4, LOW);


case 6:

digitalWrite (Pin1, HIGH);

digitalWrite (Pin2, LOW);

digitalWrite (Pin3, LOW);

digitalWrite (Pin4, LOW);


case 7:

digitalWrite (Pin1, HIGH);

digitalWrite (Pin2, LOW);

digitalWrite (Pin3, LOW);

digitalWrite (Pin4, HIGH);



digitalWrite (Pin1, LOW);

digitalWrite (Pin2, LOW);

digitalWrite (Pin3, LOW);

digitalWrite (Pin4, LOW);



if(i>7) {



if(i<0) {






delay (2000);



void setup () {


// Initialize the output variables as outputs


pinMode (Pin1, OUTPUT);

pinMode (Pin2, OUTPUT);

pinMode (Pin3, OUTPUT);

pinMode (Pin4, OUTPUT);

// Connect to Wi-Fi network with SSID and password

Serial.print(“Connecting to “);


WiFi.begin(ssid, password);

while (WiFi.status()! = WL_CONNECTED) {

delay (500);



// Print local IP address and start web server


Serial.println(“WiFi connected.”);

Serial.println(“IP address: “);




void loop () {

WiFiClient client = server.available();   // Listen for incoming clients

if (client) {                      // If a new client connects,

Serial.println(“New Client.”);     // print a message out in the serial port

String currentLine = ““;             // make a String to hold incoming data from the client

currentTime = millis();

previousTime = currentTime;

while (client.connected() && currentTime – previousTime <= timeoutTime) { // loop while the client’s connected

currentTime = millis();

if (client.available()) {             // if there’s bytes to read from the client,

char c = client.read();             // read a byte, then

Serial.write(c);                    // print it out the serial monitor

header += c;

if (c == ‘ ’) {                    // if the byte is a newline character

// if the current line is blank, you got two newline characters in a row.

// that’s the end of the client HTTP request, so send a response:

if (currentLine.length() == 0) {

// HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)

// and a content-type so the client knows what’s coming, then a blank line:

client.println(“HTTP/1.1 200 OK”);


client.println(“Connection: close”);


// turns the GPIOs on and off

if (header.indexOf(“GET detector/sun”) >= 0) {

sunPos(); //Run sun position calculations

StepperUsingAzimuth = findStepperMotorSteps(Azimuth);



// Display the HTML web page

client.println(“<!DOCTYPE html><html>”);

client.println(“<head><meta name=”viewport” content=”width=device-width, initial-scale=1”>”);

client.println(“<link rel=”icon” href=”data:,”>”);

// CSS to style the on/off buttons

// Feel free to change the background-color and font-size attributes to fit your preferences

client.println(“<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}”);

client.println(“.button { background-color: #195B6A; border: none; color: white; padding: 16px 40px;”);

client.println(“text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}”);

client.println(“.button2{background-color: #77878A;}</style></head>”);

// Web Page Heading

client.println(“<body><h1>SUNLIGHT DIRECTOR</h1>”);

client.println(“<p><a href=”detector/sun”><button class=”button”>SUN</button></a></p>”);



// The HTTP response ends with another blank line


// Break out of the while loop


} else { // if you got a newline, then clear currentLine

currentLine = “”;


} else if (c != ‘ ’) {  // if you got anything else but a carriage return character,

currentLine += c;      // add it to the end of the currentLine




// Clearthe header variable

header = “”;

// Close the connection


Serial.println(“Client disconnected.”);







The main objective of this project was to track the sun using geographical features and guide the sunlight to a predefined target which was designed and implemented. The mirror moves towards the sun’s location and if the intensity of sunlight is high then reflects it to the panel for various small applications. The efficiency was moderate as not too much energy was wasted when sunlight was reflected to the panel. The system proposed is compact and low cost compared to other tracking systems. The designed system is easily usable and reliable. Overall, the system is low cost prototype with user interface for small-scale applications. There is scope for larger systems to be developed to use the solar energy efficiently.



Future work



The objective of the project considering the resources available were met. The reflected sun on panel can be used to charge a battery or measuring the heat collected on panel using a temperature sensor. Also, remote controlled apps can be developed to perform specific functionality with ease. Solar power can be used for a variety of reasons. Power (photovoltaics) or heat (solar thermal) can be generated. Solar energy can be used to generate electricity in areas without access to the power grid, distil water in regions with restricted supply of clean water, and power satellites in space. Solar power can also be incorporated into building materials. There is a scope for larger projects involving dual axis which can make use of solar energy more efficiently and looking forward to future advancements in this field.


1)     Anon, (2019). [online] Available at: https://www.researchgate.net/publication/317162432_Arduino_based_Dual_Axis_Smart_Solar_Tracker [Accessed 29 Aug. 2019].

2)     Rcciit.org. (2019). [online] Available at: http://rcciit.org/students_projects/projects/ee/2018/GR1.pdf [Accessed 29 Aug. 2019].

3)     Anon, (2019). [online] Available at: https://www.academia.edu/28085264/Design_and_Implementation_of_a_Dual_Axis_Solar_Tracking_System [Accessed 29 Aug. 2019].

4)     Citeseerx.ist.psu.edu. (2019). [online] Available at: http://citeseerx.ist.psu.edu/viewdoc/download?doi= [Accessed 29 Aug. 2019].

5)     Eie.uonbi.ac.ke. (2019). [online] Available at: https://eie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/SOLAR%20TRACKER%20FOR%20SOLAR%20PANEL.pdf [Accessed 29 Aug. 2019].

6)     Web.wpi.edu. (2019). [online] Available at: https://web.wpi.edu/Pubs/E-project/Available/E-project-010713-112634/unrestricted/Dual-Axis_Tracker_Report.pdf [Accessed 29 Aug. 2019].

7)     En.wikipedia.org. (2019). Position of the Sun. [online] Available at: https://en.wikipedia.org/wiki/Position_of_the_Sun [Accessed 29 Aug. 2019].

8)     Eeshop.unl.edu. (2019). [online] Available at: http://eeshop.unl.edu/pdf/Stepper+Driver.pdf [Accessed 29 Aug. 2019].

9)     Ahir, A. (2019). What is NodeMcu Esp8266 Specification? – AHIRLABS. [online] AHIRLABS. Available at: https://www.ahirlabs.com/2017/10/21/what-is-nodemcu-esp8266/ [Accessed 29 Aug. 2019].


Cite This Work

To export a reference to this article please select a referencing stye below:

Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.

Related Services

View all

DMCA / Removal Request

If you are the original writer of this essay and no longer wish to have your work published on UKEssays.com then please: