Sun Tracking Solar Panel

Table of Contents

In this project, we will see a simple Sun Tracking Solar Panel circuit which will track the Sun and position the solar panels accordingly.


As the non renewable energy resources are decreasing, use of renewable resources for producing electricity is increasing. Solar panels are becoming more popular day by day. We have already read a post about how to install solar panel for home. Solar panel absorbs the energy from the Sun, converts it into electrical energy and stores the energy in a battery.

This energy can be utilized when required or can be used as a direct alternative to the grid supply. Utilization of the energy stored in batteries is mentioned in below given applications.

The position of the Sun with respect to the solar panel is not fixed due to the rotation of the Earth. For an efficient usage of the solar energy, the Solar panels should absorb energy to a maximum extent.

This can be done only if the panels are continuously placed towards the direction of the Sun. So, solar panel should continuously rotate in the direction of Sun. This article describes about circuit that rotates solar panel.

Sun Tracking Solar Panel Image 1

Principle of Sun Tracking Solar Panel

The Sun tracking solar panel consists of two LDRs, solar panel and a servo motor and ATmega328 Micro controller.

Two light dependent resistors are arranged on the edges of the solar panel. Light dependent resistors produce low resistance when light falls on them. The servo motor connected to the panel rotates the panel in the direction of Sun. Panel is arranged in such a way that light on two LDRs is compared and panel is rotated towards LDR which have high intensity i.e. low resistance compared to other. Servo motor rotates the panel at certain angle.

When the intensity of the light falling on right LDR is more, panel slowly moves towards right and if intensity on the left LDR is more, panel slowly moves towards left. In the noon time, Sun is ahead and intensity of light on both the panels is same. In such cases, panel is constant and there is no rotation.

Sun Tracking Solar Panel Circuit Diagram

Sun Tracking Solar Panel Circuit Diagram

Components in the Circuit

  • Solar panel
  • ATmega328 Micro Controller
  • Light Dependent Resistor (LDR) x 2
  • 10KΩ x 3
  • Servo Motor
  • 16MHz Crystal
  • 22pF Ceramic Capacitors x 2
  • Push Button
  • Breadboard
  • Cardboard
  • Connecting Wires

Automated Sun Tracking Solar Panel Circuit Design

The proposed system consists of ATmega328 micro controller, Solar panel, Light Dependent resistors and Servo Motor.

ATmega328 Microcontroller

ATmega328 is an AVR family micro controller. It is based on advanced RISC architecture. It is an 8-bit controller. It has 32K Bytes of Programmable Flash memory, 1K Bytes of EEPROM and 2K Bytes of SRAM. It has 23 programmable I/O pins. It supports peripheral features like two 8-bit timers, one 16-bit timer, 6 channel ADC with 10-bit resolution, programmable USART, Serial Peripheral Interface, 2 wire serial interface (I2C), etc.

Solar Panel

Solar panel is placed on a piece of cardboard (just for demonstration) and the bottom of the cardboard is connected to Servo motor. Solar panel consists of photovoltaic cells arranged in an order. Photovoltaic cell is nothing but a solar cell. Solar cell is made up of semiconductor material silicon.

Sun Tracking Solar Panel Image 2

When a light ray from Sun is incident on the solar cell, some amount of energy is absorbed by this material. The absorbed energy is enough for the electrons to jump from one orbit to other inside the atom. Cells have one or more electric field that directs the electrons which creates current. By placing metal contact energy can be obtained from these cells.


Light Dependent Resistors or LDRs are the resistors whose resistance values depend on intensity of the light. As the intensity of light falling on the LDR increases, resistance value decreases. In dark, LDR will have maximum resistance. LDR will output an analog value which should be converted to digital. This can be done using analog to digital converter.

ATmega328 has analog to digital converter internally. It has six ADC channels from ADC0 to ADC5 (Pins 23 – 28). The two LDRs are connected to ADC pins i.e. 27 and 28 in a voltage divider fashion with the help of individual 10KΩ Resistors. ADC conversion is done using successive approximation method.

Servo Motor

Servo motor is used to rotate the panel. To drive the servo motor, a PWM Signal must be provided to its control pin and hence Pin 17 (which has PWM) is connected to the control pin of the servo motor.

By connecting a battery to the solar panel, you can store the energy generated by the solar cells and this energy can be used when required. There are separate charge controller circuits dedicated to efficiently control the charge acquired from solar panels and charge the batteries.

Sun Tracking Solar Panel Image 3

[Also Read: How To Make an Adjustable Timer ]


In a previous tutorial, I have shown you “How to Burn Bootloader to ATmega328”. In this tutorial, you can understand how to upload code to the ATmega328 Microcontroller using Arduino IDE.

The code for the project is given below.


#include <Servo.h>
Servo myservo;
int ldr1 = 4;
int ldr2 = 5;
int val1;
int val2;
int pos=90;
void setup()
void loop()
val1 = analogRead(ldr1);
val2 = analogRead(ldr2);
val1 = map(val1, 0, 1023, 0, 180);
val2 = map(val2, 0, 1023, 0, 180);
if(val1 > (val2+50))
else if(val2 > (val1+50))


How Sun Tracking Solar Panel Works?

  • Assemble the circuit as described and upload the code to ATmega328 Microcontroller.
  • Power on the circuit and place the set up directly under the Sun (on the rooftop).
  • Based on the light falling on the two LDRs, the ATmega328 Microcontroller changes the position of the Servo Motor which in turn moves in the panel.

Advantages of Sun Tracking Solar Panel

  • The solar energy can be reused as it is non-renewable resource.
  • This also saves money as there is no need to pay for energy used (excluding the initial setup cost)
  • Helps in maximizing the solar energy absorption by continuously tracking the sun.

Sun Tracking Solar Panel Applications

  • These panels can be used to power the traffic lights and streetlights
  • These can be used in home to power the appliances using solar power.
  • These can be used in industries as more energy can be saved by rotating the panel.

Limitations of Sun Tracking Solar Panel Circuit

  1. Though solar energy can be utilized to maximum extent this may create problems in rainy season.
  2. Although solar energy can be saved to batteries, they are heavy and occupy more space and required to change time to time.
  3. They are expensive.

So far you came to know about the working principle of a sun-tracking solar panel. If you want to set up or install them on your home or office rooftops then we would like to share with you about Best Solar Panel Kits for Homes In 2018

This article will help you in understanding the concept of solar panel kits and guides you how to choose solar panels (vital considerations) when purchasing online. Read the complete article and choose the one that best matches your requirements.



Similar Articles & Blogs

Explore similar articles on various electronics and electrical topics – 


We saw in the previous tutorial about the binary weighted digital-to-analogue converter that the analogue output voltage is the weighted sum of the individual inputs, and that

Learn More >>

Analogue to Digital Converter

Analogue-to-Digital Converters, (ADCs) allow micro-processor controlled circuits, Arduinos, Raspberry Pi, and other such digital logic circuits to communicate with the real world. In the real

Learn More >>

Transmission Gate

The analogue switch is a solid-state semiconductor switch that controls the transmission path of analogue signals. The open and closed operations of the switch positions

Learn More >>

Binary Adder

Another common and very useful combinational logic circuit which can be constructed using just a few basic logic gates allowing it to add together two

Learn More >>

Bus Transceiver

A Transceiver can be used to provide bidirectional, input or output control, of either digital or analogue devices to a common shared data bus. Unlike the buffer,

Learn More >>

Digital Comparator

Digital or Binary Comparators are made up from standard AND, NOR and NOT gates that compare the digital signals present at their input terminals and produce an output depending upon

Learn More >>