The capability to either minimize energy consumption in battery-operated devices, or to adequately exploit energy harvesting from various ambient sources, is central to the development and engineering of energy-neutral wireless sensor networks. However, the design of effective networked embedded systems targeting unlimited lifetime poses several challenges at different architectural levels. In particular, the heterogeneity, the variability, and the unpredictability of many energy sources, combined to changes in energy required by powered devices, make it difficult to obtain reproducible testing conditions, thus prompting the need of novel solutions addressing these issues. This paper introduces a novel embedded hardware-software solution aimed at emulating a wide spectrum of energy sources usually exploited to power sensor networks motes. The proposed system consists of a modular architecture featuring small factor form, low power requirements, and limited cost. An extensive experimental characterization confirms the validity of the embedded emulator in terms of flexibility, accuracy, and latency while a case study about the emulation of a lithium battery shows that the hardware-software platform does not introduce any measurable reduction of the accuracy of the model. The presented solution represents therefore a convenient solution for testing large-scale testbeds under realistic energy supply scenarios for wireless sensor networks.