Introduction: Sky Control V1 - Temperature and Humidity Controller With Relays

Picture of Sky Control V1 - Temperature and Humidity Controller With Relays

This intructable will teach you how to make very cheap Sky Control module (temperature and humidity controller). All the parts cost below 10$.

The module is based on Arduino Uno. It uses a DHT22 sensor to measure temperature and humidity. The results are displayed on LCD Screen and pre-sets can be changed by using buttons. By using 2 relays you are able to connect any humidifier and heating element up to 2.5 kW. In this project devices connected to relays should have separate power source (even for 5V heating plate and humidifier that I’m using in my terrarium). In next project I will add Dust Sensor for controlling Air Pollution

Shopping List

1. Arduino uno

2. DHT22 sensor -

3. LCD Keypad Shield -

4. 2-channel 5v relay Module -


1. Arudiono Screw Shield – to make this easier to connect -

2. Heating plate -

3. USB ultrasonic nebulizer -

Step 1: Wiring

Picture of Wiring

Connect everything as shown on schematics (Fritizng file and parts available to download below)

I’m not showing LCD wiring as it slides on top of Arduino.

Remember to put 4.7 kohm resistor between 5V and SIG nodes od DHT22. You can buy DHT sensors with built in resistor, if so you don’t need external one.

To connect anything to relay – power source goes to COM1 and COM2 in relay and devices that should be turned on and off to NO1 and NO2 (NO – Normally Open).

I'm using Screw Shield - so i do not have to solder anything

Step 2: The Code - It Looks Bad on the Site, But Grab Attached File

/*Sky Control - Temperature and humidity sensor with relays made by ArkadiuszO2 v1
* Please read comments * Shopping list includes: * 1. Arduino Uno * 2. DHT22 sensor * 3. 2 channel relay - 5V * 4. DFRobot LCD Keypad Shield * * In V2 i will add Air quality sensor based on Sharp's GP2Y1010AU0F */
#include <LiquidCrystal.h>
#include <DFR_key.h>
#include <DHT.h>
//Starting values after boot up, you can change them
int temp = 25;
int hum = 50;
//For DHT22 (AM2023)
#define DHTPIN 15
#define DHTTYPE DHT22
const int relay1 =  18;
const int relay2 =  19;
LiquidCrystal lcd(8, 9, 4, 5, 6, 7); 
DFR_Key keypad;
int localKey = 0;
String keyString = "";
int lcd_key     = 0;
int adc_key_in  = 0;

#define btnRIGHT 0
#define btnUP 1 #define btnDOWN 2 #define btnLEFT 3 #define btnSELECT 4 #define btnNONE 5

int read_LCD_buttons(){
adc_key_in = analogRead(0); if (adc_key_in > 1000) return btnNONE; if (adc_key_in < 50) return btnRIGHT; if (adc_key_in < 250) return btnUP; if (adc_key_in < 450) return btnDOWN; if (adc_key_in < 650) return btnLEFT; if (adc_key_in < 850) return btnSELECT; } void setup() { pinMode(relay1, OUTPUT); pinMode(relay2, OUTPUT); lcd.begin(16, 2); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Sky control v1"); lcd.setCursor(0, 1); lcd.print("Instr on Select"); delay(2500); Serial.begin(9600); dht.begin(); delay(1000); lcd.clear(); //Sample rate (default 10 ms) keypad.setRate(10); digitalWrite(relay1, HIGH); digitalWrite(relay2, HIGH);}

void loop() {

float h = dht.readHumidity(); float t = dht.readTemperature(); if (isnan(t) || isnan(h)) { //checking sensor operation lcd.begin(16, 2); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Sensor broken!!"); delay(10000); } else { //You can change values (step) after each button press, default is 1'C for step and 5% humidity lcd_key = read_LCD_buttons(); switch (lcd_key){ case btnLEFT:{ temp = temp +1; break; } case btnRIGHT:{ temp = temp - 1; break; } case btnUP:{ hum = hum + 5; break; } case btnDOWN:{ hum = hum - 5; break; } case btnSELECT:{ lcd.begin(16, 2); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Hum Up/Down +-5%"); lcd.setCursor(0, 1); lcd.print("Temp L/R +-1"); lcd.print((char)223); lcd.print("C"); delay (5000); break; } } lcd.setCursor(0, 0); lcd.print("Hum: "); lcd.print(h); lcd.print("%"); lcd.print("("); lcd.print(hum); lcd.print("%)"); lcd.setCursor(0, 1); lcd.print("Tem: "); lcd.print(t); lcd.print((char)223); lcd.print("("); lcd.print(temp); lcd.print((char)223); lcd.print(")");

//adding this so the humidifier will not be powering on and off constantly (humidifier will exceed upper limit by 10% - IF YOU NEED EXACT VALUES COMMENT THIS SECTION AND UNCOMMENT NEXT !! 

int H = hum + 10;
if(h < hum ) digitalWrite(relay1, LOW); else if (h >= H) digitalWrite(relay1, HIGH);

/* <- UNCOMMENT THIS IF YOU NEED EXACT VALUES BUT COMMENT 5 LINES ABOVE if(h < hum ) digitalWrite(relay1, LOW); else digitalWrite(relay1, HIGH); */

if(t < temp ) digitalWrite(relay2, LOW); else digitalWrite(relay2, HIGH);



Step 3: Operation

Picture of Operation

Upon pressing Select you will see basic operation instruction

Up/Down changes preset humidity by +- 5%

Left/Right changes preset temperature by +-1 °C

In the code you will find that humidifier will exceed preset limit by 10% - this is done so it will not be powering it on and off constantly, so ie. you have set 50% target humidity - the relay will power on the humidifier when reading will reach 49% and power it down when it reaches 60%. You can change that by modifying the code.


Col68 (author)2017-10-12

hello ArkadiuszO2, so I try but not succeed, this is the project I have been looking for a long time, I have to succeed, thank you again for your sharing.

ArkadiuszO2 (author)Col682017-10-12

What is your primary language? What is not working for You? I will try to help.

Col68 (author)ArkadiuszO22017-10-18

I would like the moisture to run from + - 75 to 85% and the temperature on relay 2 set from 10 to 15 or more but not less, I think the library error has been set my compiler error came from non indicated correctly.

Thank you in advance for your help, cordially.

int H = 75 + 10; // humidity value + 10%

if (h> 85) digitalWrite (relay1, LOW); // superior has 85 relays Off

else if (h <= H) digitalWrite (relay1, HIGH); // inferior = 75 relays On

/ * <- UNCOMMENT THIS YOU NEED EXACT VALUES GOAL HOW 5 LINES ABOVE if (h> 85) digitalWrite (relay1, LOW); // greater than 85 relay1 Off

else digitalWrite (relay1, HIGH); // Otherwise relais1 On

* / if (t <10) digitalWrite (relay2, LOW); else digitalWrite (relay2, HIGH);

Thank you.

Col68 (author)ArkadiuszO22017-10-18

Hello ArkadiuszO2, I'm sorry for the delay, I save your page in favorites in order to be present more often. When I try this does not compile because error with DFR_Key library, but I will try again and keep you informed.

For the shield 1602 I wanted to use with i2c module instead of inserting on top, otherwise I will try without the module I2C with the wires and I inform you of the cause of the error DFR_Key.

Thank you for wanting to help me, I am Turkish of origin and I am born in France, I speak French and Turkish :-) Thank you again for the support, cordially.

Col68 (author)2017-10-09

Hello, thank you for having me accept, I am new in the field Arduino my goal is to realize a thermostat to regulate the temperature and humidity of the cheese fridge, I make cheese at home, I needed to thank you with all my heart for this sharing, I use a translator excuse me for the mistakes, great for you, thank you.

Swansong (author)2017-04-21

Thanks for sharing :)

ArkadiuszO2 (author)Swansong2017-04-21

You're welcome :)