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


As nonrenewable energy resources are decreasing, the use of renewable resources for producing electricity is increasing. Solar panels are becoming more popular day by day. 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. The utilization of the energy stored in batteries is mentioned in the 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 efficient usage of 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, the solar panels should continuously rotate in the direction of the Sun. This article describes the circuit that rotates solar panels.

Sun Tracking Solar Panel image - Sun Tracking Solar Panel Project using Microcontroller Circuit Schematic with explanation

Principle of Sun Tracking Solar Panel

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

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. The panel is arranged in such a way that light on two LDRs is compared and the panel is rotated towards LDR which has high intensity i.e. low resistance compared to others. Servo motor rotates the panel at a certain angle.

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

Sun Tracking Solar Panel Circuit Diagram

Sun Tracking Solar Panel Circuit Diagram- Sun Tracking Solar Panel Project using Microcontroller Circuit Schematic with explanation

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 an ATmega328 microcontroller, Solar panel, Light Dependent resistors, and Servo Motor.

ATmega328 Microcontroller

ATmega328 is an AVR family microcontroller. 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

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

Sun Tracking Solar Panel Image 2 - Sun Tracking Solar Panel Circuit Diagram- Sun Tracking Solar Panel Project using Microcontroller Circuit Schematic with explanation

When a light ray from the 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 others inside the atom. Cells have one or more electric field that directs the electrons which creates the 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 the 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 an 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 the 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 - Sun Tracking Solar Panel Circuit Diagram- Sun Tracking Solar Panel Project using Microcontroller Circuit Schematic with explanation



The code for the project is given below.

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 a non-renewable resource.
  • This also saves money as there is no need to pay for energy used (excluding the initial setup cost)
  • It helps in maximizing 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 the 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 a maximum extent this may create problems in the rainy season.
  2. Although solar energy can be saved to batteries, they are heavy and occupy more space and required to change from time to time.
  3. They are expensive.


Please enter your comment!
Please enter your name here