Too high voltage on the generator

ManFish:
The MOSFET is the IRF520

That's not a logic-level MOSFET and won't work properly from 5V