To effectively control the energy consumption of embedded systems,this paper put forward an algorithm for controlling the energy consumption of embedded systems.Considering that embedded systems have periodic tasks with strict execution time,a directed acyclic graph was used to model the embedded system.Based on the known task information and processor information,the minimum energy consumption of the embedded system was taken as the ob-jective function,and then a model of controlling energy consumption for the embedded system was built in terms of task groups.Moreover,the firefly algorithm was adopted to optimize the energy consumption control model and find the optimal individual for updating the firefly position,thus obtaining the best scheme of energy consumption control.Sim-ulation results show that the proposed algorithm can effectively reduce system energy consumption,improve control ef-ficiency,and meet the requirements of system use.