I would like to build some battery management system for grid independent homes or smart grids. I know very little about writing controller software for hardware that regulate power intake and output for batteries. Preferably I would like this system to be capable to use any set and type of battery. And then the controller takes care of optimally using them.