My original plan was to do some form of MPPT, but I ran out of time near the end when I ran into an issue with my circuit - overlooked the fact that mosfets have to be driven low side, without some added complexity so I went back to the old controller. I'm honestly not sure what kind of system that controller uses, it's not PWM as I put my scope on it, but for the price I doubt it's MPPT. I will probably revisit it at some point and also redo all the wiring. I was doing the wiring harnesses while the actual box was still curing (glue for switches etc) in the garage so had to guess on wire lengths. The shape also makes it very hard to do anything inside. Live and learn. Next design - whether it's another solar system, or completely different project will be more flat so there is an easier work area. The somewhat modular design with the slide in circuit board turned out kind of neat though.
The main idea behind the MCU is being able to detect and set low voltage threshold so I can have it auto power off if battery is below a certain voltage. It uses a latching relay for on/off, that way the relay does not use up battery power. I can connect a laptop with USB to configure some parameters as well, and calibrate. i have it set to 15 minute shut down time if voltage goes below 10.5v. Idealy I would probably turn of loads manually before it gets to that point. That parameter can be changed though, just have to connect the USB port to a PC. Uses a MCP2221 for the serial interface.
The current reading does not work though, I've never been able to get shunt readings to work properly, I always end up with too much noise and it jumps around a lot. I might cheat and use a premade current sense IC instead when I choose to revisit it. There's an issue where when you power on a big load the MCU resets, which to me is really odd because I can't imagine it taking the battery voltage down low enough for that to happen. I might just try adding a bigger capacitor after the 5v regulator. I have a 2200uf one lying around, I figured that would be overkill so went with a 320uf one.
So still some issues to iron out but in general it works and will come in handy for camping or if power goes out. When I learn more in depth electronics I want to design a single circuit board that will have the charge controller, a separate 12vpsu for output power, and an inverter all built in. The whole thing would be way more miniaturized as well. Could even make it use 18650 cells, though I like the idea of lead acid because it's stable in harsher environments, like camping where it might hit 25C or hotter outside.