Smoothing unregulated DC input voltage to a voltage regulator
Directly connecting a motor (acting as a generator) to an electronic circuit is going to cause problems. The most obvious one is commutation noise causing spikes that cyclically pulse the voltage to zero volts or even negative values. It won't be the same for every DC motor but you will get trouble from most.

The way around this is to half wave rectify the motor output and using a smoothing capacitor. You might also consider full wave rectifying the output so you can generate voltage when the motor turns in the opposite direction.

As Dmitry has said, a buck-boost converter is probably your best option because a 7805 will need typically 2 volts greater at the input to produce a stable 5 volts at the output. This means you need to guarantee 7 volts at the input (and after the diode(s)).

1st buck-booster from LT I looked at: -





You should also look at what TI can offer.