PiFan is a python3 program to to read CPU temperature and control a fan with a transistor.
It uses on/ff as well as a kind of hacky voltage regulation by turning the transitor om/of very very fast to some kind of "modulate" the output voltage.
please adafruit make a AC motor driver with voltage regulation for venting the pi's from internal 5V !!!