Trigger on arriving home - problem

I agree, most of my lights are actioned on solar elevation as it’s more consistent, but harder to code for some, hence the minutes offset. Find an elevation (or declination and go with it). it will get messed around sometimes with heavy cloud cover but far easier and cheaper to deploy than lux sensors.

I like your graph and it is impressive, but you have to bear in mind that light incidence will follow a near sinusoidal response given solar position (modified by the sun actually being up).
Your solar array has a bunch of electronics with it to mediate this output to give a) something that will charge your batteries an b) something that won’t overtax your batteries
This graph has very little to do with what humans can see or can make use of.

This partly true. However the graph is raw voltage, not power output. The “charge controller” is, as you point out doing a lot of stuff, but it isn’t doing much to the voltage output of the panel, except as you can see the small spikes where it is MPPT tracking actual sunshine and allowing the voltage to rise to achieve higher power output, but for the most part the panel just sits roughly around the battery voltage. At dawn the voltage across the panel will rise from some milli-volts caused by street lighting etc to well over 10V as soon as it seens light. I won’t produce any power but the voltage across it is very responsive to light.

So for detecting day and night I wouldn’t be looking at what the power output is, or the exact voltage, but rather that the voltage is above, say 2V, then it’s definitely “light” outside.

Note it doesn’t need to “see” the sun to produce voltage. The sun does not “dawn” for the panel until around 11am due to my house being the way! So it’s just responding to ambient light.

The street light outside my old house use to get the panel to 1.9V and it even produced about 50uA of current!

You don’t need a large panel for this. If you buy a tiny panel on EBay and put a suitable resistor across it and measure the voltage dropped across it, it will give a highly accurate indication of ambient light and/or direct sunlight.

Sorry are you looking at the same graph I am ?

Panel voltage over two days showing the panel voltage as good as 0 over night and rapidly rising to roughly 14V at dawn? Small spikes during the day and then plummeting to as good as 0 at dusk?

Excuse me, if this comes across wrong, but a lot of people confuse solar panel as “voltage sources” as this is the most common type of power source, but they are actually “current sources”. Open circuit they produce a large voltage. Short circuited they produce a large current and 0 volts. The charge controller balances these two to achieve the highest Power output. Without direct sunlight, that is, in the case of my panel and battery, around 14V. So the panel gravitates towards that point.

It matters because it explains why this graph does not follow a sinusoidal curve.

(I knew my training as an Electrical/Electronics Engineer was deficient in many areas).
But Largely … “my point entirely”
The electronics have the solar panel (which are semiconductors and have their own schottky effect) then there is the management electronics (good systems are powered from the array to ensure they don’t consume power, without generating it first - another step point. Then there is battery mangement, these are expensive installations and good battery management can prolong battery life. So an array of heavy-side step functions to consider. Then (on the analogue side) you have to consider internal resistances, a good battery has very low internal resistance, so the charge charachteristic is governed largely by voltage, but as you say the “current” is the important part. This is a delicate juggling act but result in an output as shown in the graph, Actually, I think those transient spikes may actually be damaging your batteries.
I’d be happy to go over the calculations with you if you wish (it’s been a long time but I have a text book on it somewhere), but it would require a lot of baseline data about your system. From the voltage it would seem you have a lead-acid or gel pack, battery pack as normaly modern lithium systems I’m familiar with would operate around 20-26v
But why would your system report “raw voltage”, surely it’s more important to you (as a user) to know the state of charge ? (usually calculated from battery charachteristics with voltage level as measured variable input). Most systems hide internal statistics, a bit like ignoring the catalytic converter on your car til it needs servicing.
Not withstanding, buying a ‘solar panel off ebay’ still requires you to get the value into HA if you want to do something with it.

Lots of trees around our home and neighborhood, so I use a BH1750 light sensor with a Wemos D1 Mini and ESPHome to report actual daylight levels at my home.

1 Like

I realise we are trashing the OPs post. Apologies.

The charge controller is an MPPT tracking system. It’s basically a dynamic “buck converter”, so the only connection between the panel voltage and the battery voltage is that the panel voltage must be higher than the battery voltage. The buck converter tries to get the maximum output from the panel without exceeding the charge profile of the battery.

Using a search algorithm it adjusts the output voltage to where the Voltage*Amps is highest. With the panel being a current source you can get (in my panel) around 5 Amps at short circuit 0 Volts. You can also get 0 Amps at open circuit, around 17-19V. Maximum power point is around 16V and 3.2A. Depending on the amount of light hitting the panel determines the amount of power it can produce. This varies with angle, insolation, shading, haze etc, Thus the MPPT tracking algorithim “hunts” by varying the output voltage back and forward to achieve the maximum power output to the battery and/or the load.

When the battery is getting close to fully changed or the output voltage hits 14.4V then the MPPT disengages, locks the output voltage at 14.4V (unless equalise charging or floating) and lets the panel and the battery work out the current. As the battery pulls less and less current the panel voltage will rise higher and higher until it eventually hits open circuit and is producing no power.

The spikes, as the look too regular, are most likely the controller in this case switching in and out of float and boost modes as the battery was likely charged. It’s much ore interesting to watch with a nearly flat battery.

It might be more apparent if I post the other graphs for battery voltage, amps and panel amps and power.

At dawn the panel will be completely open circuit as the charge controller cannot charge anything until the voltage is at least higher than the battery, connecting it to the battery the battery would feed back through the panel and cause it to heat up, draining the battery, although there are diodes to prevent that, so the voltage rises rapidly to 14.4V when the MPPT kicks in and starts managing things.

The main point is the panel voltage and the battery charge voltage and decoupled. This is not the case if you were use a PWM charge controller, which just pulses the full panel voltage into the battery to try and maintain the battery voltage.

It’s a bit more complicated in some details, but that’s the gist.

(Note it doesn’t need to be charging a battery, it is often used to heat domestic water too).

My project for monitoring the solar panel:

I think you inadvertently gave me the “solution” check mark when you should have given it to Phil since you used his answer.

@ianadd , apologies as Paul said for trashing your thread.
as @finity suggests you should remove the solution tick from my initial solution post and go with the one you used or got you where you wanted to be…
@paulcam, apologies to you aswell, you are not someone just playing with a very expensive toy but someone who knows a lot more than I (i thought I knew a lot but …) Though you must admit a) this is a very expesive way to gather lux input b) eve you say that the spikes show the ‘buck coverters’ kicking into boost mode (so it cant be raw. :wink: :rofl: :+1: ) I’ve learnt a bit from this and everyday should be a school day, thanks.