Home Assistant Solar Tracker

Solar Tracker based on ESP32 with low cost actuators integrated on Home Assistant

Public Chat
Similar projects worth following
At my parents house we had solar panels for many years, but so far they were statically mounted.
While I am in Brazil visiting them we decided to increase the number of panels, since our inverter has extra power that was unused and make the panels to track the sun from east to west.

For this purpose I decided to use a ESP32 integrated with Home Assistant to provide the panel movement automation.

Home Assistant gathers the metrics from the tracker and the date and time data, this is important because the sun position calculation happens based on our location and date and time.

The esp32 works in an autonomous way, it contains a RTC module that persists the date and time and when connected via WIFI with Home Assistant it synchronizes the time.

To measure the panel angle I am using a Accelerometer as used on digital protractors.
The 3 axis acceleration data is then converted into panel angle and it is used as absolute position for the motion controller.

To be able to achieve the motion on the most affordable way we used a gate linear actuator we had spare.

I removed the old wireless gate opening controller and connected directly to a relay board.

This board is actuated by the ESP32 where one relay is used to turn the motor on and the second one to reverse the motor direction.

There are also two additional safety relays which detects the end of travel and cut the motor power on the direction where the limit was triggered.

Since we have strong wind in Brazil we added an anemometer to the controller so in the case of high winds the panels are placed at horizonal position to reduce the drag.

We also have a DHT22 to measure temperature and humidity so it is only missing rain meter and wind direction to be a weather station as well.

When we add those additional sensors I was thinking to position the panels in a way the rain could wash the panels.


ESPHome device configuration file

yaml - 5.02 kB - 03/12/2022 at 16:38



Custom component for tracker/ motion control.

plain - 4.25 kB - 03/12/2022 at 16:38



Custom component calculating gyro angle and sun.

plain - 4.26 kB - 03/12/2022 at 16:38


  • Final PCB Schematic decisions

    Vini's Lab04/29/2022 at 17:14 0 comments

    For the final PCB Design, I am adding a Spark gap and Zener diodes for input protection.

    On the prototype, I am currently using two relays to turn the motor on. In the final design, only one relay will be used to reverse the motor direction, since this relay is used only twice a day it should last forever.

    The movement relay is being replaced by a PCB solid state relay.

    The logic power supply is also being replaced from a charger adaptor to a Meanwell power supply module soldered on the PCB.

  • Project Repository

    Vini's Lab04/29/2022 at 17:05 0 comments

    I created a project repository for the source code and future PCB design.

    All project is under MIT License.

  • Generation Comparison

    Vini's Lab03/11/2022 at 16:22 0 comments

    On the chart bellow you can see our best generation day, without any clouds, before installing the tracker:

    The generation was 14,22kWh.

    On the second chart the results are with active tracking, some clouds happened so we expect even better results:

    The generation was 16,41kWh.

  • Shadows Compensation

    Vini's Lab03/11/2022 at 16:06 0 comments

    When the sun is in the extreme positions one panel can generate shadows in the adjacent one.

    For this reason I added a logic that calculates the shadow incidence based on our assembly and sun position.

    On this Grafana chart you can observe the green light being the sun position referenced to the installation position, this angle is converted from the sun's azimuth and elevation.

    The yellow light is the shadow compensation curve.

    The plateau observed between the two different curves in the blue line is caused because the travel limit.

    The blue line tracks with 2 degrees of error the sun position, this data comes directly from the accelerometer and is used by the motion control.

    The result is quite good since the motor is not using an inverter and only uses relays to start and stop.

  • Final PCB Design

    Vini's Lab03/11/2022 at 15:42 0 comments

    The system is fully functional.

    The next phase will be to substitute my prototype PCB with a proper design for the solar tracker.

View all 5 project logs

  • 1
    Install Home Assistant AddOns

    The only mandatory AddOn is ESPHome,

    Additionally is nice to have Studio Code Server for easy change in configuration

  • 2
    Code customizations

    The code was wrote around my mechanical design, don't run this code blindly with a power motor and panels connected!

View all instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates