The paper presents an Energy Harvesting Earliest Deadline First (EH-EDF) scheduling algorithm aimed at increasing the lifetime of real-time systems by effectively managing energy consumption through dynamic voltage scaling (DVS). It highlights the importance of energy harvesting, especially in remote areas where traditional battery recharging is impractical, and demonstrates that the proposed approach outperforms existing methods in terms of energy conservation and system longevity. Experimental results validate the effectiveness of the EH-EDF algorithm in optimizing task scheduling while ensuring sufficient energy supply.