ESP32 Sun Tracking

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
Jerry1234
Posts: 3
Joined: Mon Jul 11, 2022 12:30 am

ESP32 Sun Tracking

Post by Jerry1234 » Mon Jul 11, 2022 12:45 am

I have copied a Python Sun Tracking program and converted it to micropython on ESP32, it gives me azimuth and elevation to the sun throughout the day in real-time based on lat/long. I’m trying to take that code and build a very small tracker with a very small solar panel attached,
I was wondering would a 35kg servo motor or a closed loop stepper motor be more powerful, how hard would it be to write the code for a stepper motor to track the sun in 10 degree increments?

Thank,
Jerry

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: ESP32 Sun Tracking

Post by jimmo » Mon Jul 11, 2022 2:24 am

Jerry1234 wrote:
Mon Jul 11, 2022 12:45 am
I was wondering would a 35kg servo motor or a closed loop stepper motor be more powerful, how hard would it be to write the code for a stepper motor to track the sun in 10 degree increments?
It depends on what type of stepper motor you're using, you can get really huge ones!

In general though "servo" and "closed loop stepper" are functionally the same thing. A servo using a PWM interface is very simple to control... it depends what interface your closed loop stepper uses (could be serial or something else).

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: ESP32 Sun Tracking

Post by pythoncoder » Mon Jul 11, 2022 8:58 am

This crops up periodically with people proposing an assortment of solutions with variable levels of complexity. I think there are ways to simplify these things - I might even build one to prove the point. Azimuth/elevation isn't necessarily the ideal coordinate system.

The following comments apply to the northern hemisphere - adjustments for the southern are fairly obvious.

Firstly, consider an Equatorial mount. The sun moves clockwise along the ecliptic with a rotation period of 24 hours. Further, at noon, it is due South regardless of season. So one part of the problem is rotating the equatorial mount at a constant rate. To avoid it pointing at the ground you might want to set limits so that the mechanism stopped once it reached a low angle in the west and reset to a low angle in the east but basically you're building a clock. A limit switch would ensure that the mechanism remained calibrated.

The other part of the problem is adjusting the plane of the equatorial mount as the seasons progress. This motion is extremely slow. I've not done the sums but it's possible that a linear approximation may be close enough. Failing that, a sine wave. All you need to know are the maximum and minimum noon elevation at your latitude.

Given that both motions are slow, you could use a high degree of reduction gearing. The torque magnification would mean you could use quite small stepper motors. Reduction gearing would also avoid the possibility of wind loads moving the mechanism.

Just a few random thoughts, unsullied by actual experimentation...
Peter Hinch
Index to my micropython libraries.

User avatar
scruss
Posts: 360
Joined: Sat Aug 12, 2017 2:27 pm
Location: Toronto, Canada
Contact:

Re: ESP32 Sun Tracking

Post by scruss » Mon Jul 11, 2022 4:57 pm

The way that several tracker manufacturers manage position is distressingly simple. They have two tiny solar cells mounted at 90 degrees to one another at the top of the rack. By hunting the position and following the path that has the highest output from the small guide cells, the tracker will tend to follow the optimal path without needing to know the latitude and longitude of the installation. It also has the advantage of correcting for reflection or shade that might make your site be something other than theoretically perfect. I've seen demos that will track the sun and return a fairly good estimate of the site's position by back-calculating from the track.

My information might be a little old: I haven't designed a solar installation for more than a decade, and the projects I worked on tended to use fixed racking or (at most) single-axis trackers.

Post Reply