In recent decades, the use of a pacemaker to regulate the heart rate has become widespread. However, researchers have been focusing on solving challenges such as minimizing the device's size by removing the battery, which typically occupies around 70% of the device's space. In this research, through stress and strain engineering, an optimal harvesting structure was designed to replace pacemakers batteries. For this purpose, piezoelectric layers in rectangular, trapezoidal and perforated trapezoidal shapes were studied numerically and experimentally. The engineering of the holes created in the trapezoidal layer caused the natural frequency of the structure to approach the excitation frequency by 21% compared to the design without holes and by 1.6% compared to the simple rectangular design. Due to the presence of stress concentration centers, this structure produced 52.34% more voltage than the rectangular beam and 22.07% more than the trapezoidal beam. The results of this research confirm that stress and strain engineering on piezo structures, can significantly increase energy generation in the same space. Therefore, in small spaces, it is possible to save more energy by the presented model for bio applications.