2004 Volvo S40 AC stops

AC/heat in automatic mode stops. Will start working when fan is in 1 - 5 setting. Solutions.

There may be a problem with the thermostat.