Introduction: Arduino Control AC Water Heater Temperature

About: revolutionary device designed to control AC Loads working on 110V/220V allowing to control High voltage AC loads using Microcontrollers Like AVR,PIC,STM32 or Electronics platforms like arduino,Raspberry pi,bea…

This is one of the most interesting and hardest experiment to do, Why?because the circuit we want to build is a little bit hard and tricky.

Most of the tutorial in the internet do it with relay to turn on-off the AC heater to increase the temperature,it's not an accurate way to control the water temperature,and will not be able to reach to your target temperature.

To explain it in a simple example: you want to increase a temperature of the water to be about 60 degree Celsius,With a relay when you reach to 60 degree Celsius,the relay turn off the Heater, that makes the temperature decrease rapidly so the relay will turn on and increase temperature rapidly again , so the relay will turn on-off within a short time which will damage the relay and maybe damage the heater it self.

Best way to adjust the temperature by control AC voltage output applied on AC heater.

build a (crappy) AC triac circuit not just unprofessional but also will not work well,With inappropriate heatsink,no protection from ac short circuit or overload current, and most important no protection for you,any small fault might kill you,be careful.

So let's see the best way to control AC heater, and offer a high protection from electrical shock hazard,and give us a full control over the water temperature.

Step 1: What We Want to Do ? and the Component We Need

What we want to do is:

Control AC Water heater, and control the water target temperature with temperature sensor feedback signal,and we want to control Applied AC voltage on the AC water heater so we can control accurately the water temperature.

We will use an LCD to show all information an parameters on it.

the components we need are:

  1. Arduino Board"I used arduino Nano".
  2. AC water heater 300W.
  3. Sugar Device "I used Sugar300".
  4. Power Cable C14.
  5. OLED 0.96 inch display.
  6. DS18B20 water proof temperature sensor.
  7. 4.7K resistor
  8. RJ12 Cable.
  9. RJ Breakout.
  10. Breadboard and solderless jumper
  11. Oscillscope"optional".

As we see no need for any naked wire, or cutting any AC wires to connect the components together "like in the relay circuits".

and we will use an oscilloscope to see the AC voltage waveform and ensure the sugar device control the applied ac voltage on water heater

Step 2: Connect Arduino With Temperature Sensor

First thing to do is to attach the arduino nano into the breadboard,you need a resistor 4.7K ohm resistor to connect it with DS18B20 sensor

the sensor is waterproof and here is the connection.

its important to use a waterproof sensor, otherwise it will not work probably well with you.

Step 3: Connect the OLED Display

the display i used is OLED 0.96 display, it comes in I2C or SPI type, i used the I2C one, the code and connection will be different if you want to use SPI one.

The connection is so simple , you can see it here

In this moment we can check the connection if its right or not by uploading the code "see it in the end " you will see the lcd works on and display the value of the temp. sensor on it.

Step 4: Connect Sugar Device and High Voltage Components

in the final all you need to do is

Connect to connect the water heater element to Sugar device output socket.

Connect the AC power cable to sugar device to power it up.

connect the RJ12 cable between sugar device and arduino, use RJ breakout to connect the cable to Arduino nano.

Step 5: Safety Is a Priority

well during this test, i faced something may happen for everyone, the power consumption by the AC Heater was larger than 300W and the AC current was higher than I expected, thanks for Sugar device , the ac fuse protect the circuit and cut off the power source, for such a circumstances,Sugar is capable to protect your self and equipment you use from any short circuit or overload fault.

all similar circuits on the internet won't do that, you will be under the mercy of AC current which will damage all unprotected component and put you life under threat.

remember safety is a priority.

and with sugar I safely remove the fuse and replace it by a new one,no need to open the device or touch any dangerous ac components.

Step 6: You Love Sugar Device ? We Need Your Help

Sugar is a startup project , designed and Manufactured the Prototypes in Taipei - Taiwan and Now sugar need your help to become a real product in the market and bring a simple tools to control AC voltage.

Sugar comes in 2 different type :

  • Sugar300 : can Handle Up to 300 W
  • Sugar1000 : can Handle Up to 1000 Wand both type support AC output voltage control "For Dimmer applications"

Hope you support us and become our backer Now on Indiegogo Campaign, we updated the artical ,you can visit our campaign page Here. Keep in touch with us on Facebook ,Twitter , Google+ , Instagram , Youtube official accounts. Visit Our website to see all features and tutorial and see the story behind sugar

Step 7: Code and Test Video

You need a glass of water to test your circuit on it.

To download the code from attachment

all the library you need to run the code Here , the code tested on Arduino 1.5.5 and 1.5.2 as well

last thing to say:you need to observe the temp target and the sensor temp and adjust the value of the output voltage in the code go to "" void UpdatePWM() "" and change the value to match your requirements

See the video to see how the circuit works

and you can see the oscilloscope waveform shows how the sugar control AC Voltage output

//This is just a potion of the Code Only,use the code in attachemnt

<p>void setup()   {                <br>  Serial.begin(9600);</p><p>  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
  display.begin(SSD1306_SWITCHCAPVCC, 0x3D);  // initialize with the I2C addr 0x3D (for the 128x64)
  // init done
  
  // Show image buffer on the display hardware.
  // Since the buffer is intialized with an Adafruit splashscreen
  // internally, this will display the splashscreen.
  display.display();
  delay(2000);</p><p>  // Clear the buffer.
  display.clearDisplay();</p><p>  // draw a single pixel
  display.drawPixel(10, 10, WHITE);
  // Show the display buffer on the hardware.
  // NOTE: You _must_ call display after making any drawing commands
  // to make them visible on the display hardware!
  display.display();
  delay(2000);
  display.clearDisplay();</p><p>  // draw many lines
  testdrawline();
  display.display();
  delay(2000);
  display.clearDisplay();</p><p>  // draw rectangles
  testdrawrect();
  display.display();
  delay(2000);
  display.clearDisplay();</p><p>  // draw multiple rectangles
  testfillrect();
  display.display();
  delay(2000);
  display.clearDisplay();</p><p>  // draw mulitple circles
  testdrawcircle();
  display.display();
  delay(2000);
  display.clearDisplay();</p><p>  // draw a white circle, 10 pixel radius
  display.fillCircle(display.width()/2, display.height()/2, 10, WHITE);
  display.display();
  delay(2000);
  display.clearDisplay();</p><p>  testdrawroundrect();
  delay(2000);</p>