Rpi CPU fan speed control

Hi!

I would like to install a variable speed fan to cool down my Rpi4 CPU.

I need your input to select the best hardware and how to configure HA to keep CPU temperature as constant as possible. Is it possible?

Thank you in advance