Due to development of technology in human life, the development of embedded system, as the major part of digital systems, is needed. Among the main characteristics of embedded systems, the two important features are real-time characteristic and energy consumption. In addition, the implementation of a program includes different tasks; each of them has its own resource demand from the system. If this resource did not achieve at the right time by the task, it would affect Efficiency and system performance. Therefore, implementing an appropriate Scheduler for such systems is very important. Low energy consumption is crucial in embedded systems, because most of these systems are battery powered, and often there is no possibility of recharging the battery, so if the energy in batteries runs out, the system will go off. In order to overcome energy limitations of embedded system, the use of energy harvesting is a good idea. Many scheduling algorithms are proposed in the field of real-time and energy efficiency improvement, but everyone has some limitations and defects. In most studies the ideal battery used as the energy source with constant amount of energy and constant output voltage, so the effect of battery charging/discharging coefficient in the amount of energy transferred, is neglected. But this assumption is not always true and designation based on this simple model to minimize energy consumption does not lead to battery life improvement. Here we have presented a powerful task scheduling algorithm for energy harvesting real-time embedded systems using a realistic model for battery charging and discharging processes, to improve energy consumption and reduce the deadline miss rate for every task set. Choosing the appropriate time interval to harvest energy from the environment, we pursue Energy availability of the system and the amount of energy required to run tasks in the time interval. Then we assign the amount energy required to run the Tasks and the frequency of CPU. Comparing to other existing methods the proposed algorithm reduces deadline miss rate and number of visits to the battery in experiment, therefore energy wasting decreases due to few battery charge/discharge. And finally our method will increase battery life and also life of the system as a result. Keywords: Embedded Systems, Energy Harvesting, Real Time Scheduling, Real Energy Storage