In this tutorial we are going to construct a water heater temperature controller circuit using Arduino, LCD and a water proof temperature sensor. You can set your desire temperature in Celsius / Fahrenheit and the water heater will maintain the set temperature. The proposed design is equipped with a buzzer to notify the user when various temperature conditions are met.
We will see:
- Circuit diagram of temperature controlled water heater.
- Detailed circuit explanation.
- Program code for temperature controlled water heater.
- How to operate the proposed water heater controller circuit.
- Prototype Images of the circuit setup.
Download high resolution image of the above circuit: Click here
NOTE 1: The DC buzzer has polarity, +ve (RED) terminal must connect to the switch / Arduino pin and -Ve terminal to GND.
NOTE 2: “A” and “K” are anode and cathode of the diode respectively and it is connected across the relay coil.
Using the above circuit you can heat water from 0 to 110 Celsius / 32 to 230 Fahrenheit. Four buttons are provided using which you can set a temperature that you wish to attain / maintain in the mentioned range.
The water heater we are going to use with the proposed circuit is immersion rod type:
The circuit utilizes a water proof temperature sensor DS18B20 which will be dipped in to the water that you are going to heat, this sensor collects current temperature of water using which Arduino decides when to trigger the relay ON and OFF to attain / maintain your desire temperature.
The circuit will turn OFF the heater once the desire temperature is reached and turns back ON once the temperature fall below an acceptable value, in this way temperature of the water is maintained.
A 5V buzzer is provided to alert the user once the set temperature is reached, you may enable / disable the buzzer using the slide switch provided in the circuit.
The proposed circuit consists of an Arduino board which is the brain of the project and you may use any Arduino board that is available with you and not just limited to Arduino nano.
A 16×2 LCD display is provided here to display the user set value and the current temperature of the water. A 10K variable resistor is provided to adjust the contrast of the LCD display.
DS18B20 digital temperature sensor:
A water proof (digital) temperature sensor DS18B20 is utilized in the circuit to measure the current water temperature accurately. It comes in a metallic tube and the actual sensor inside it looks like a transistor (as shown in the diagram).
The sensor comes with 3 wires 5V, Data and GND and the sensor communicates with the microcontroller using “one wire” protocol. The data line must be connected with a 4.7K pull-up resistor.
It can sense temperature from -55 to +125 degree Celsius and can measure temperature with the accuracy of +/- 0.5 degree Celsius (from -10 to +85 C). Since our application is about heating the water, we have limited the working range from 0 to 110 degree Celsius / 32 to 230 F.
A 9V/12V relay is utilized in the circuit to turn on and off the water heater. The relay coil is controlled by a NPN transistor BC548 and the input signal to the transistor is provided from pin #8 of Arduino.
A current limiting resistor of 4.7K is connected to the base terminal to prevent over-biasing of the transistor. A diode is connected across the relay coil to arrest the high voltage spikes that could arise while energizing and de-energizing the relay coil.
Heater to relay wiring diagram:
Note: Make sure your relay contacts can handle the current your water heater demands. A 10A 250V relay can handle 1KW / 1000W heater, above which you should get a higher ampere rated relay.
A 5V buzzer is provided to notify when the water reaches the temperature set by you, this feature is helpful when you just want to attain certain temperature and you would remove the heater from water.
You can turn off the buzzer using the switch provided in the circuit; you would do this when you want to maintain the temperature of the water for long time, for example: Sterilizing medical tools where the tools need to be placed in hot water several minutes to hours and you don’t want to get notified when the temperature reaches the set value.
You can power the circuit using a wall adapter with 9V (if you are using a 9V relay) or with 12V (if you are using a 12V relay). It should provide a minimum current of 500mA.
Download “onewire.h” library: Click here
Download “DallasTemperature.h” library: Click here
Program for temperature controlled water heater:
To maintain certain temperature of water the relay turns OFF the heater when your desire temperature is reached so that water don’t heat further and after sometime the heater is turned ON when the temperature falls below an acceptable value.
You can set a tolerance value in the code here:
By default we have set to 3, which mean if the desire temperature is attained say 60 degree Celsius the relay turns OFF the heater and it will turn the heater back ON once the water temperature falls to 57 degree C (60-3 = 57 degree C) to raise the temperature of the water.
Similarly, if you set the tolerance value to 5, it will turn the heater back ON when the water temperature falls to 55 degree C.
How to operate this water heater controller?
S1: Start / long press to stop the heater.
S2: Increment a digit (INC).
S3: Decrement a digit (DEC).
S4: To set and save the temperature value.
- Turn ON the circuit with the completed hardware set-up, you will see this screen:
The above is the home screen it shows the user set temperature. You may either press start button to get your water to 50C/122F or you may press SET button (S4) to enter a new temperature value.
2. To enter a new temperature, press SET button (S4) and you’ll see the screen below. Press INC or DEC buttons to bring your desire temperature value on the screen.
3. Long press SET button to save the value and “values saved!” message will appear and it will get stored to EEPROM of Arduino and the screen will return to home.
4. Now press start button (S1), the relay will turn on with a beep to indicate that the process has started and you’ll see the below screen:
The “SET” on the screen is the value that you have just entered and “water” is the present temperature of the water where the temperature sensor is dipped in.
5. Once the water reaches the “SET” temperature the relay turns OFF and buzzer beeps for few seconds to notify that water is ready for use and you may turn off the heater by long pressing the start/stop button (S1):
- 6. Or to maintain the set temperature of the water, just leave the circuit ON for as long as you want, your set temperature will be maintained. Turn off the buzzer so that it won’t beep ever time the relay turns off.
- 7. When you turn ON the circuit the last set value will be retrieved from EEPROM. You may either press start button (S1) to heat the water or press SET button (S4) to enter a new temperature value.
If you have any questions regarding this project, feel free to ask us in the comment section and you will get a guaranteed reply from us.