A humidifier for a respiratory apparatus for delivering a humidified flow of breathable gas to a patient, the humidifier comprising: a humidifier chamber configured to store a supply of water to humidify the flow of breathable gas, the humidifier chamber comprising a first heating element configured to heat the supply of water; a first temperature sensor to detect a temperature of the first heating element; and a controller; and either: (a) an absolute humidity sensor to detect the absolute humidity of ambient air and generate signals indicative of the ambient absolute humidity, wherein the controller is configured to receive the signals indicative of the ambient absolute humidity, or (b) a relative humidity sensor to detect a relative humidity of ambient air and generate signals indicative of the ambient relative humidity and a second temperature sensor to detect a temperature of ambient air and generate signals indicative of the ambient temperature, wherein the controller is configured to determine the absolute humidity of the ambient air from the signals generated by the relative humidity sensor and the second temperature sensor; wherein the controller is configured to control the first heating element to provide (c) a predetermined absolute humidity or (d) a predetermined temperature and a predetermined relative humidity to the flow of breathable gas, characterized in that the controller is configured to determine a fixed duty ratio for the first heating element and a heating element temperature threshold above which to apply the fixed duty ratio, the controller is further configured to determine whether the heating element temperature is above the heating element temperature threshold and to apply the fixed duty ratio to the first heating element when the first heating element temperature is above the heating element temperature threshold, and the controller is configured to apply a 100% duty ratio to the first heating element when the first heating element temperature is not above the heating element temperature threshold. a humidifier chamber configured to store a supply of water to humidify the flow of breathable gas, the humidifier chamber comprising a first heating element configured to heat the supply of water; a first temperature sensor to detect a temperature of the first heating element; and a controller; and either: (a) an absolute humidity sensor to detect the absolute humidity of ambient air and generate signals indicative of the ambient absolute humidity, wherein the controller is configured to receive the signals indicative of the ambient absolute humidity, or (b) a relative humidity sensor to detect a relative humidity of ambient air and generate signals indicative of the ambient relative humidity and a second temperature sensor to detect a temperature of ambient air and generate signals indicative of the ambient temperature, wherein the controller is configured to determine the absolute humidity of the ambient air from the signals generated by the relative humidity sensor and the second temperature sensor; (a) an absolute humidity sensor to detect the absolute humidity of ambient air and generate signals indicative of the ambient absolute humidity, wherein the controller is configured to receive the signals indicative of the ambient absolute humidity, or (b) a relative humidity sensor to detect a relative humidity of ambient air and generate signals indicative of the ambient relative humidity and a second temperature sensor to detect a temperature of ambient air and generate signals indicative of the ambient temperature, wherein the controller is configured to determine the absolute humidity of the ambient air from the signals generated by the relative humidity sensor and the second temperature sensor; wherein the controller is configured to control the first heating element to provide (c) a predetermined absolute humidity or (d) a predetermined temperature and a predetermined relative humidity to the flow of breathable gas, characterized in that the controller is configured to determine a fixed duty ratio for the first heating element and a heating element temperature threshold above which to apply the fixed duty ratio, the controller is further configured to determine whether the heating element temperature is above the heating element temperature threshold and to apply the fixed duty ratio to the first heating element when the first heating element temperature is above the heating element temperature threshold, and the controller is configured to apply a 100% duty ratio to the first heating element when the first heating element temperature is not above the heating element temperature threshold.