In this study, an energy management system (EMS) focusing on low-cost hardware and embedded optimization has been built. A benchmark consisting of a residential photovoltaic (PV) and battery connected to the grid but without feed in power has been considered. The proposed EMS accepts input variables as building electrical load data, PV output data,. ••Building energy management system can be made affordable from commonly available electronics and open-source software.••24 h simultaneous power bill optimization is done.••A smart house energy bill is optimized without load scheduling/shedding.••Time of use rates can be a tool to promote investment in battery storage systems.••Convex optimization is suitable for smart house power bill minimization.Building power bill optimizationBattery storageSolar PVEnergy management systemAbbreviationsRES : Renewable energy sourceHEMS : Home energy management systemEMS : Energy management systemSBC : Single board computerSC : Slave controllerSG : Smart gridV2G : Vehicle to gridMILP : Mixed integer linear programmingSOC : State of chargeBPSO : Binary particle swarm optimizationToU : Time of useThe power grid is going through profound transformations influenced by technology and the energy crisis. In fact, the rarefaction of fossil fuel reserves, which are estimated to be 50 years for oil and gas and 100 years for coal, is pressuring nations to invest in renewable energy sources (RES). Also, there is an urgent need to reduce the power demand in order to cope with aging infrastructure poor endurance, and the power system stability issues created by the integration of intermittent RES. However, it is possible to achieve a high ratio of RES penetration while maintaining standards compliant voltage quality if properly planned. Regarding the load reduction, a study found that simply providing customers a regular report on their energy usage and that of their neighbors reduced the average power demand by more than 5%. Therefore, creating an awareness of energy consumption profile in a community can lead to energy saving. As cooling systems use high power equipment (e.g., compressor, pump), targeting them for peak load clipping has been demonstrated to reduce up to 85% of the power demand. To this end, in the residential energy sector, various tools have been developed to simulate household appliances (fridge, air conditioner, light bulb, and television) to help researchers investigate the impact of different power saving techniques on the overall energy consumption.Power.