Automatic AC temperature controller using arduino, DHT 11an IR

Am having problem in coding this circuit I need some help.

1 OLED – Vcc 5V
2 OLED – Gnd Gnd
3 OLED- SCK, D0,SCL,CLK 4
4 OLED- SDA, D1,MOSI, Data 3
5 OLED- RES, RST,RESET 7
6 OLED- DC, A0 5
7 OLED- CS, Chip Select 6
8 DHT11 – Vcc 5V
9 DHT11 – Gnd Gnd
10 DHT11 – Signal 13
11 TSOP – Vcc 5V
12 TSOP – Gnd Gnd
13 IR Led – Anode 9
14 IR Led – Cathode Gnd
*/

#include <IRremote.h> //Lib for IT Blaster and TSOP
#include <SPI.h> // Inbuilt Lib
#include <Wire.h> //Inbuilt Lib
#include <Adafruit_GFX.h> //Lib for OLED
#include <Adafruit_SSD1306.h> //Lib for OLED
#include <dht.h> //Library for dht11 Temperature and Humidity sensor (Download from Link in article)

// Assign pins for OLED (Software config.)
#define OLED_MOSI 3
#define OLED_CLK 4
#define OLED_DC 5
#define OLED_CS 6
#define OLED_RESET 7
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
#define SSD1306_LCDHEIGHT 64 //Change if you are using a Different OLED
#define DHT11_PIN 13 //Sensor output pin is connected to pin 13
dht DHT; //Sensor object named as DHT
#define Desired_temperature 27 //The desired temperature is 27*C at any time
//Decoded Remote Signals For my AC ##CHANGE IT FOR YOUR REMOTE
unsigned int ACoff = {2950,1750, 400,1100, 450,1050, 450,400, 400,400, 400,400, 450,1100, 400,400, 400,400, 450,1100, 400,1100250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,250, 550,250, 550,1000, 500,1000, 550,1000, 500,1000, 550,300, 500};
unsigned int Temp30 = {3000,1650, 500,1000, 550,1000, 500,300, 500,300, 550,250, 550,1000, 500,300, 500,300, 550,1000, 550,950, 550,250, 550,1000, 550,250, 550,250, 550,1000, 550,950, 550,300, 500,1000, 550,950, 550,300, 500,300, 550,950, 550,300, 550,250, 550,1000, 500,300, 500,300, 550,250, 550,250, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,950, 550,300, 500,300, 500,1000, 550,250, 550,300, 550,950, 550,1000, 500,300, 550,250, 550,250, 600,250, 500,300, 550,250, 550,1000, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,950, 550,300, 500,1000, 550,950, 550,1000, 500,300, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,250, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,950, 500,1050, 500,1000, 500,350, 500,1000, 500,1000, 500,1050, 500,300, 500};
//Change it for your remote
IRsend irsend;
int Measured_temp;
int Measured_Humi;
int AC_Temp;
char temp_error = 2;
int Pev_value;
boolean AC = false;
int khz = 38; // 38kHz carrier frequency for the NEC protocol
void setup()
{
Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC);
display.clearDisplay();
}
void loop() {

DHT.read11(DHT11_PIN); //Read the Temp and Humidity
Measured_temp = DHT.temperature + temp_error;
Measured_Humi = DHT.humidity;
// text display tests
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print("Temperature: "); display.print(Measured_temp);display.println(“C”);
display.setCursor(0,10);
display.print(“Humidity: “); display.print(Measured_Humi);display.println(”%”);
display.setCursor(0,20);
display.print("AC Temp: "); display.print(AC_Temp);display.println(“C”);
display.display();
delay(500);
display.clearDisplay();

if ((Measured_temp <= (Desired_temperature-3)) && AC == true) //If AC is turned on and temperature is less than 3 degree of Desired value #24 turn off
{
irsend.sendRaw(ACoff, sizeof(ACoff) / sizeof(ACoff[0]), khz); delay(2000);//Send signal to Turn Off the AC
AC_Temp = 0; AC=false;
}
if ((Measured_temp >= Desired_temperature+4) && AC == false) //If AC is off and measured Temp is greater than Desired Temp
{
irsend.sendRaw(ACon, sizeof(ACon) / sizeof(ACon[0]), khz); delay(2000); //Send Signal to Turn On the AC
delay(2000);
irsend.sendRaw(Temp27, sizeof(Temp27) / sizeof(Temp27[0]), khz); //Send signal to set 27C
AC_Temp = 27; AC=true;
}
if ( Measured_temp != Pev_value) //Change the temperature only if the measured voltage value changes
{
if (Measured_temp == Desired_temperature+3) //If AC is ON and measured temp is very very high than desired
{
irsend.sendRaw(Temp24, sizeof(Temp24) / sizeof(Temp24[0]), khz); delay(2000);//Send signal to set 24
C
AC_Temp = 24;
}
if (Measured_temp == Desired_temperature+2) //If AC is ON and measured temp is very high than desired
{
irsend.sendRaw(Temp25, sizeof(Temp25) / sizeof(Temp25[0]), khz); delay(2000);//Send signal to set 25C
AC_Temp = 25;
}
if (Measured_temp == Desired_temperature+1) //If AC is ON and measured temp is very high than desired
{
irsend.sendRaw(Temp26, sizeof(Temp26) / sizeof(Temp26[0]), khz); delay(2000);//Send signal to set 26
C
AC_Temp = 26;
}
if (Measured_temp == 27 ) //If AC is ON and measured temp is desired value
{
irsend.sendRaw(Temp27, sizeof(Temp27) / sizeof(Temp27[0]), khz); //Send signal to set 27C
AC_Temp = 27;
}
if (Measured_temp == Desired_temperature-1) //If AC is ON and measured temp is low than desired value
{
irsend.sendRaw(Temp28, sizeof(Temp28) / sizeof(Temp28[0]), khz); delay(2000);//Send signal to set 28
C
AC_Temp = 28;
}
if (Measured_temp == Desired_temperature-2 ) //If AC is ON and measured temp is very low than desired value
{
irsend.sendRaw(Temp29, sizeof(Temp29) / sizeof(Temp29[0]), khz); delay(2000);//Send signal to set 29C
AC_Temp = 29;
}
if (Measured_temp == Desired_temperature-3 ) //If AC is ON and measured temp is very very low desired value
{
irsend.sendRaw(Temp30, sizeof(Temp30) / sizeof(Temp30[0]), khz); delay(2000);//Send signal to set 30
C
AC_Temp = 30;
}
Pev_value = Measured_temp;
}

You have not told us what the program does and what you want it to do that is different.

To make it easy for people to help you please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum

Your code is too long for me to study quickly without copying to a text editor.

Also please use the AutoFormat tool to indent your code for easier reading.

Please display your image(s) in your post so we can see it(them) without downloading it(them). See this Simple Image Guide

If your pictures are just images of text, please just copy and paste the text - it will be much easier to read.

…R

Automatic AC Temperature Controller using Arduino, DHT11 and IR Blaster
In this project we are going to make a small Automatic Temperature Control Circuit that could minimize the electricity chargers by varying the AC temperature automatically based on the Rooms temperature. By varying the set temperature periodically we can avoid making the AC to work for lower temperature values for a long time and thus making it consume less power.
Most of us would have experienced a situation where we have to change the Air Conditioner’s set temperature to different values during different times of the day, so as to keep us comfy throughout. To automate this process this project uses a Temperature sensor (DHT11) which reads the present temperature of the room and based on that value it will send commands to the AC through an IR blaster similar to the AC’s Remote. The AC will react to these commands as if it is reacting to its Remote and thus adjust the temperature. As your room’s temperature changes, the Arduino will also adjust your AC’s set temperature to maintain your temperature in just the way you want it to be. Sounds cool right?... Let’s see how to build one.
Materials Required:

  1. Arduino Mega 2560
  2. TSOP1738 (HS0038)
  3. IR Led
  4. DHT11 Temperature/Humidity Sensor
  5. Any Colour LED and 1K Resistor(optional)
    The code I first post was supposed to work on this project but when verified the code on arduino sotfware it display this error "compiling terminated" status one. Pls I need a working code that can work on this project
1 Like

I can't afford an AC in every room. Besides, my heat pump uses a lot less electricity than 6 or 7 separate ACs. Ant I would have to keep all the doors closed.

Now, back to your problem. There was a lot more to the error message. Please don't leave it to our imagination to guess at what it was. It told you the line number where the error probably is and what the error was.

Paul

The error message was not show me the line number that is where the problem come from.

You have not responded to my requests in Reply #1

And post the full error message.

…R

HIS IS THE ERROR MESSAGE
Arduino: 1.6.9 (Windows 7), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

WARNING: Spurious .github folder in ‘Adafruit SSD1306’ library
WARNING: Spurious .github folder in ‘DHT sensor library’ library
Build options changed, rebuilding all
C:\Users\ABOI\Documents\Arduino\ABOI.ino:6:69: fatal error: dht.h: No such file or directory

#include <dht.h> //Library for dht11 Temperature and Humidity sensor

^

compilation terminated.

Multiple libraries were found for “IRremote.h”
Used: C:\Program Files (x86)\Arduino\libraries\IRremote-2.2.3
Not used: C:\Program Files (x86)\Arduino\libraries\RobotIRremote
Not used: C:\Program Files (x86)\Arduino\libraries\IRremote-1.0.0
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

I see this line in your program:

#include <dht.h> //Library for dht11 Temperature and Humidity sensor (Download from Link in article)

Did you download it?

And start getting rid of the duplicate files the error messages have identified.

Paul

@Samaboi53, how do you reconcile this

The error message was not show me the line number that is where the problem come from.

with this

C:\Users\ABOI\Documents\Arduino\ABOI.ino:6:69: fatal error: dht.h: No such file or directory

...R

I don't know that's why i need help to be able to solve the prblm

Funny, Reply #2 looks like a direct copy / paste of the assignment as handed out by the class instructor. A little bit lazy, IMHO.

gfvalvo:
Funny, Reply #2 looks like a direct copy / paste of the assignment as handed out by the class instructor. A little bit lazy, IMHO.

I think the word "pathetic" is correct.

Paul

I copy the error message from the arduino software an pest it here, am not the want that write the program because I don't now any thing about programming but I really want to learn that's why am asking for help

Samaboi53:
because I don't now any thing about programming but I really want to learn that's why am asking for help

Start learning with something simpler. Have a look at a number of the example programs that come with the Arduino IDE.

Make a copy of an example program and try making changes to it to see what happens.

...R