So, the last few days it’s been overcast. Monday I had a firmware glitch that caused the mains supply to be brought in almost constantly, so I’d disregard that result.
Basically, the moment the battery dropped below ~12.8V for even a brief second, the mains got brought in. We were just teetering on the edge of 12.8V all day. I realised that I really did need a delay on firing off the timer, so I’ve re-worked the logic:
- If battery drops below V_L, start a 1-hour timer
- If battery rises above V_L, reset the 1-hour timer
- If the battery drops below V_CL or the timer expires, turn on the mains charger
That got me better results. It means V_CL can be quite low, without endangering the battery supply, and V_L can be at 12.8V where it basically ensures that the battery is at a good level for everything to operate.
I managed to get through most of Tuesday until about 4PM, there was a bit of a hump which I think was the solar controller trying to extract some power from the panels. I really need a good sunny day like the previous week to test properly.
This is leading me to consider my monitoring device. At the moment, it just monitors voltage (crudely) and controls the logic-level enable input on the mains charger. Nothing more. It has done that well.
A thought is that maybe I should re-build this as a Modbus-enabled energy meter with control. This idea has evolved a bit, enough to be its own project actually. The thought I have now is a more modular design.
If I take the INA219B and a surface-mount current shunt, I have a means to accurately measure input voltage and current. Two of these, and I can measure the board’s output too. Stick a small microcontroller in between, some MOSFETs and other parts, and I can have a switchmode power supply module which can report on its input and output power and vary the PWM of the power supply to achieve any desired input or output voltage or current.
The MCU could be the ATTiny24As I’m using, or a ATTiny861. The latter is attractive as it can do high-speed PWM, but I’m not sure that’s necessary in this application, and I have loads of SOIC ATTiny24As. (Then again, I also have loads of PDIP ATTiny861s.)
The board would expose the ICSP pins plus two more for interrupt and chip select, allowing for a simple jig for reprogramming. I haven’t decided on a topology yet, but the split-pi is looking attractive. I might start with a buck converter first though.
This would talk to a “master” microcontroller which would provide the UI and Modbus interface. If the brains of the PSU MCU aren’t sufficient, this could do the more grunty calculations too.
This would allow me to swap out the PSU boards to try out different designs.