This paper presents a proposal for a microgrid test rig for laboratory use. It aims at high flexibility using a modular approach with a common hardware for most of the tasks. The proposed framework for laboratory scale microgrid addresses the requirements for teaching and research. This objective is attained with a reconfigurable power electronics stage, used for test and design of new topologies. The experimental framework also allows testing algorithms at different levels in the hierarchical control structure, while giving access to emulation and simulation of elements commonly found in microgrids and to low-level programming of communication protocols for studying the communications channel. The processing unit in each module, called local controller in the paper, uses a high performance digital signal processor (DSP). This processing unit allows reconfiguration of each module, to assume any of the tasks in the microgrid, i.e. controllable loads, storage, wind, photovoltaic generation, etc. The proposed hardware was tested as a simulator/emulator of the different subsystems. The communications with a microgrid central controller (MCC) is provided with standard embedded processors, capable of implementing the communication protocols suitable for micro-grid environments.