And it’s not when you’ve got a neck on a sunny day. But when you’re a solar panel you don’t have a neck. And my solar panel is being a dick about it.
Two methods of attack in determining the sun’s position in the sky for this thing are to either use sensors to look for it, or to calculate where it should be for the given date/time/lat/long/alt. The problem with looking for it is that it’s difficult to tell where it is on a cloudy day, even with the human eye. Also, there’s a way to calculate its precise location without the use of sensors, which saves power and moving parts and precious microcontroller pins. So it’s off to do the maths to get the sun’s exact position. Let’s shift the shit out of some bits.
The most important thing in all of this is knowing what the date and time is. So I’ll need a real-time clock module. I don’t have that. I’ll get one. But right now I’m impatient and this whole getup is just breadboarded anyway. Fortunately I’m sitting in front of a tremendous RTC in this PC. As a temporary solution I will create a serial communication via usb to the microcontroller and script up a simple time server on the PC that will listen to requests from the microcontroller and provide the time in epoch seconds. Once sent to the microcontroller a simple c++ time library does the rest.
Time for the hard part… later.