Surrounding autonomous embedded devices are in a constant expansion. The advent and the rise of Internet of Things (IoT) enable these objects to take a giant step forward, especially regarding their large scale deployment in real-world applications of the everyday life. A significant part of these objects are battery-powered and energy-dependent. Thus, energy is a critical resource which greatly complicates the development of the embedded software. By decomposing the energy consumption of a battery-powered IoT device, we can see that peripheral components are the major contributors among the overall consumption. Indeed, these components are exploited and repeatedly used by the object to interact and communicate with its surrounding environment during all the application lifetime. Acquire the expertise to handle accurately, during the development stage, the behaviour of every on-board peripheral component is a big challenge to improve the development of IoT embedded applications.To guide the developer in this task, we propose an automated inference procedure of energy models for peripheral components. An accurate automata-based model of the energy consumption can be generated, with only little efforts from the developer, based on real runtime measurements, providing precise energy figures. The proposed process is focused on a lightweight code generation step and simple analyses of the energy output traces, allowing a quick regeneration of the models in the case of a peripheral component modification. We show the potentials of the proposed procedure by real experiments on real peripherals. The obtained results are satisfactory, and we believe that our proposition is able to enhance the embedded development in an energy-constrained environment.