Variable speed generators can improve overall genset performance by allowing the diesel engine to reduce its speed at lower loads. In this project, a variable speed diesel generator (VSDG) uses a rotating stator driven by a compensator motor. At lower loads, the stator turns in the opposite direction of the rotor, a process that can be used for purposes like maintaining a fixed relative speed between the two components of a generator. This allows the diesel engine to turn at a lower speed (same as the rotor) and to increase its efficiency. The present research addresses the control of the compensator motor driving the generator’s stator using a variable-frequency drive that adapts the speed to its optimal value according to the load. The performance of the proposed control strategy was tested using a Freescale microcontroller card programmed in C-code to determine the appropriate voltage for the variable-frequency drive. The control algorithm uses a real-time application implemented on an FDRM-KL25Z signal processor board. The control performance of a 2 kW asynchronous motor (LabVolt EMS 8503-00/208 V/3 ϕ/60(50) Hz) was demonstrated experimentally at different operating conditions.