Although this project is for a firewood processor, it would work similarly for a diesel generator. A Arduino processor controls a servo connected to the throttle linkage. Run the VW (or Mercedes, Kubota, etc.) Diesel engine on used filtered vegetable oil, and you have almost free electricity. Belt drive a 1800 rpm alternator off the engine, or if you are really handy, direct drive off the transmission bell housing.
Closed loop PID control of a VW diesel engine with an Arduino microprocessor. Throttle actuation accomplished with a stock RC servo motor. See http://mckgyver.pbworks.com/Firewood_Processor_Governor for Arduino source code and schematics