Fan speed control for AC and EC fans in HVAC applications