Although photovoltaic (PV) power generation systems are an efficient way to use solar energy, their conversion efficiency is very low. Keeping the DC output power from the panel consistent is the key challenge with solar PV systems. Radiation and temperature are two variables that can impact a panel's output power. This study proposes a unique hunting-based optimization technique called the Tyrannosaurus optimization algorithm (TROA). It is demonstrated that the TROA can be used to achieve maximum power point tracking (MPPT) for lithium-ion battery charging with solar panels. Tyrannosaurus Rex hunting techniques served as the model for this approach. MPPT is used to regulate the solar array's output in PV systems. A buck converter is used by the charge controller to convert DC to DC. To provide the most power, it is utilized to balance the impedance of batteries and solar panels. To maximize power transfer, the algorithm modifies the gating signal's duty cycle based on the voltage and current detected by the solar panel. Three well-known optimization methods are contrasted with TROA's performance: gorilla troops optimization (GTO) algorithm, perticle swarm optimization (PSO), and cultural algorithm (CA). In contrast to current approaches, the proposed approach has yielded superior results.