Introduction: WEEKLIMATIC Arduino Programmable Thermostat

About: come visit me!

It's a programmable thermostat Arduino based.

Up to 9 weekly programs can be stored.

Three modality: SET PROGRAM, AUTO MODE, PROGRAM MODE

Two PROGRAM modality: ON Mode / OFF Mode

.....and more fuctions, fully customizable!

Step 1: Introduction

Hello everyone. This is a project of a customized thermostat used to drive boiler radiators in my home.

I've got a Vaillant water boiler and, as many others, has a circuit to control switching on/off hot water circulation inside radiators net. This circuit has two cables output, when these cables are short-circuited hot water circulation starts inside radiators. When are not connected water circulation stops.

A basic thermostat has a temperature sensor and a relay. A temperature less of threshold level switch on the relay.

Before this project, digital thermostat that i used has a weekly scheduler so i could select to switch on radiator at specific time of a day of week.

That's not enough for my purpose.

There are some actions that we do repetitively during the week that needs radiators switching on , for example i like to have radiators hot when i take a shower in the morning at 7.30 from monday to friday. For this my old thermostat can do the work.

But, when for example my wife open all house windows to make domestic works, there is the problem that home temperature goes down threshold level and radiators uselessly goes on. That's not good for pollution (and for methane monthly bill!).

So i've created WEEKLIMATIC. It's a common weekly programmable thermostat, same as previous, but the improved functionality is that i can program a weekly scheduling that can force radiators switching on or off at a specific time . Up to 9 program can be stored inside Arduino EEPROM.

I've two programs actually stored:

from monday to friday ON MODE at 7:15 for 30 min. in the morning (shower) (*)

from monday to friday OFF MODE at 10:30 for 2 hrs. in the morning (my wife domestic works)

(*) this doesn't mean that i don't take the shower on saturday and sunday. I do it in the late morning and don't need for a warm bathroom!

Step 2: Let's Starts

For the first time i've used Arduino for a my Instructables. As you will see, the hardware is very easy to retrive and to assemble.

What i've used:

Arduino Mega 2560 compatible - ARDUINO MEGA 2560

Grove backlight RGB LCD display - RGB LCD

Grove DHT11 sensor (to be improved with DHT22 for more sensitivity) - DHT22

Grove relay - RELAY

DS1307 RTC - RTC

n.3 buttons - BUTTONS

n.6 220 ohm resistors - RESISTORS

n.1 slide ONOFFON - SWITCH

some cables and jumpers - CABLES

prototyping pcb breadboard - PCB BOARD

PS 9V 1A - POWER SUPPLY

an enclosure box

Tools:

welder and pond

pliers

clipper

Dremel

Hot glue

Step 3: Connect Everything

Before soldering on the PCB board, i've tested everything on a breadboard. Following you can find connections list for buttons, switch and relay.

Grove DHT sensor - SIG to A0, VCC to 5V, GND to GND

Grove relay - SIG to PWM11, VCC to 5V, GND to GND

DS1307 RTC - SCL to SCL21, SDA to SDA20, VCC to 5V, GND to GND

Grove RGB LCD - SDA to RTC SDA, SCL to RTC SCL, VCC to SDA VCC, GND to RTC GND

connect buttons, switch and resistors as showed on schematic.

RTC has been connected via I2C. The one that i've got has I2C input and output, so i was able to make a cascade connection with LCD display .

Step 4: Enclosure & Power Supply

I've recycled a plastic Zyxel router box to contain everything. All rectangulars holes has been easly cutted with Dremel tool. The holes for buttons and switch with a classic drill.

Be carefully for power supply insulations inside the enclosure, you can alternatively leave it out. This could be best solution because if PS become hot, it can alter the temperature data reading.

My project include also an ON/OFF button for a complete system shutdown.

Verify that you have done strong solderings. Connect everything and test to check if there is short-circuited pins before run system.

The label has been easly made with a b/w printer and double-adesive tape.

Step 5: How Do It Works

Starting from the slide switch i have following modalities:

Center position: auto mode

Right position: program mode

Left position: set mode

Set mode:

here you can easly set scheduling. After pressed enter, you can consecutively set:

- scroll programs (pushing + , then ENTER to confirm), or delete program (pushing -)

- start time (increment hour pushing +, increment minutes pushing -. Then ENTER to confirm)

- duration (increment minute duration pushing +, then ENTER to confirm)

- modality ON/OFF (if you want to force radiators heating push ON. Push OFF to prevent heating also if room temperature is less of threshold level)

- day of the week that program is performed (push + to add day of week, push - to remove day of week. At the end push ENTER to confirm)

- save data or return to menu (pus YES to save, push NO to return to set mode)

There is a script utility, into duration menu, for crossing programs preventing .

Auto Mode:

With this function WEEKLIMATIC check room temperature and, if it is less than threshold level, switch on relay and heating starts.

When room temperature swing around threshold level, to prevent a continuous relay switching, there is following functionality:

assuming that my threshold level selected is 19C degree

when it's 18C or less - heating start and continue till it's less 19C

when it's 19C - heating continues and starts a timer that, after 2 minutes check if it's changed. Then, if it's up threshold level, heating stops, if it's less re-starts as above described.

Program Mode:

This modality combine Auto Mode and Program Mode. It checks if there are programs stored and run it. Programs have priority on Auto Mode. If, for example, room temperature is less of threshold level and, at the same time there is a program stored that force heating OFF, radiators will be forced to OFF for all the time stored in that program number.

Step 6: The Sketch

A lot of time i've spent for the sketch due to my complete inexperienced to Arduino and C++.

So, my starting point has been the alarm clock project founded on the Arduino for Dummies book. From this i've developed the sketch that's, i think, it's very raw and could be improved by the community.

Feel free to adopt a different display using the appropriate library.

The one not included in IDE are:

DHT.h https://github.com/Seeed-Studio/Grove_Temperature...

rgb_lcd.h https://github.com/Seeed-Studio/Grove_LCD_RGB_Bac...

RTClib.h https://github.com/adafruit/RTClib

The parameters to set before run it on Arduino are:

const int tempThreshold = 20;  //Set this temperature 
		threshold based upon your preferencies. 
if (digitalRead(relayPin)==HIGH && t<=tempThreshold && adesso<=count+120000){ // 120000milliseconds=2 min SET GAP TIME FOR AUTOMODE

and, obviously, you need RTC already setted.

Step 7: The End

Thank you if you have readed all this Instructables and sorry if you have now an headache.

Thank to Gearbest.com for project supporting.

Bye