基于Arduino/DHT11和红外发射器制作的自动交流温度控制器

空调(空调)曾经被认为是奢侈品,只能在大酒店,电影院,餐馆等中找到...但是,现在几乎每个人都在家里有空调来度过夏天/冬天,而那些拥有它的人担心一件共同的事情。这就是他们的高耗电量和充电器。在这个项目中,我们将制作一个小型的自动温度控制电路,该电路可以通过根据室温自动改变交流温度来最小化充电器。通过定期改变设定温度,我们可以避免使交流电长时间以较低的温度值工作,从而使其消耗更少的功率。
我们大多数人都会遇到这样一种情况,即我们必须在一天中的不同时间将空调的设定温度更改为不同的值,以使我们始终保持舒适。为了自动化此过程,该项目使用温度传感器(dht11),该传感器读取房间的当前温度,并根据该值,它将通过类似于ac遥控器的红外发射器向ac发送命令。ac 将对这些命令做出反应,就像它对遥控器做出反应一样,从而调节温度。随着房间温度的变化,arduino还会调整空调的设定温度,以您想要的方式保持您的温度。听起来很酷吧?...让我们看看如何构建一个。
所需材料:
阿杜伊诺超级 2560
tsop1738 (hs0038)
红外灯
dht11 温度/湿度传感器
任何颜色 led 和 1k 电阻器(可选)
面包板
连接线
工作方法:
我们家中用于控制电视、家庭影院、空调等的所有遥控器都在红外发射器的帮助下工作。红外发射器只不过是一个红外 led,可以通过重复脉冲来冲击信号;该信号将由电子设备中的接收器读取。对于遥控器上的每个不同按钮,将发出一个独特的信号,该信号在接收器读取后用于执行特定的预定义任务。如果我们能够读取从遥控器发出的信号,那么我们可以在需要执行该特定任务时使用红外 led 模拟相同的信号。
tsop是一种红外接收器,可用于解码来自遥控器的信号。该接收器将与arduino接口,为每个按钮发送信号,然后ir led将与arduino一起使用,以在需要时模拟信号。这样,我们就可以使用arduino控制ac。
现在,剩下的就是使用 dht11 读取温度值,并使用 ir 信号相应地指示 ac。为了使项目看起来更具吸引力和用户友好性,我还添加了一个oled显示屏,可以显示当前的温度,湿度和ac设定温度。
交流遥控器的工作:
在我们进入项目之前,请花一些时间并注意您的交流遥控器的工作原理。与电视、dvd 红外遥控器相比,交流遥控器的工作方式略有不同。遥控器上可能只有 10-12 个按钮,但它们将能够发送许多不同类型的信号。这意味着遥控器不会每次为同一按钮发送相同的代码。例如,当您使用向下按钮降低温度使其为 24°c(摄氏度)时,您将获得带有一组数据的信号,但是当您再次按下它以设置 25°c 时,您将不会获得相同的数据,因为温度现在是 25 而不是 24。同样,25 的代码也会因不同的风扇速度、睡眠设置等而异。因此,我们不要摆弄所有选项,而只是将温度值与其他设置的恒定值集中在一起。
另一个问题是每次按下按钮发送的数据量,普通遥控器发送 24 位或 48 位,但交流遥控器最多可以发送 228 位,因为每个信号都包含大量信息,如温度、风扇速度、睡眠时间、摆动风格等。这就是为什么我们需要arduino mega以获得更好的存储选项的原因。
电路图及说明:
幸运的是,这个自动交流温度控制项目的硬件设置非常简单。您可以简单地使用面包板并进行连接,如下所示。
下表还可用于验证连接。
s.no: 元件引脚 阿杜伊诺引脚
1 oled – vcc 5v
2 oled – gnd 格德
3 oled- sck, d0,scl,clk 4
4 oled-sda, d1,mosi, data 3
5 oled- res, rst,reset 7
6 oled- 直流,a0 5
7 oled- cs,芯片选择 6
8 dht11 – vcc 5v
9 dht11 – gnd 格德
10 dht11 – 信号 13
11 tsop – vcc 5v
12 tsop – gnd 格德
13 红外发光二极管 – 阳极 9
14 红外发光二极管 – 阴极 格德
连接完成后,它应该如下所示。我使用面包板来整理东西,但您也可以直接将公对母线连接到所有组件
解码交流远程信号:
控制交流电的第一步是使用 tsop1738解码交流遥控红外代码。按照电路图中所示进行所有连接,并确保已安装所有提到的库。现在打开示例程序“irrecvdumpv2”,可以在文件 -> 示例 -> irremote -> irrecvdumpv2 中找到。将程序上传到arduino mega并打开串行监视器。
将遥控器指向 tsop 并按任意按钮,对于您按下的每个按钮,信号将由 tsop1738 读取,由 arduino 解码并显示在串行监视器中。对于遥控器温度的每次变化,您将获得不同的数据。保存此数据,以便我们将在主程序中使用它。您的串行监视器将看起来像这样,我还显示了保存复制数据的word文件。
屏幕截图显示了将我的交流遥控器的温度设置为 26°c 的代码。根据您的遥控器,您将获得一组不同的代码。同样,复制所有不同温度水平的代码。
主要arduino程序:
完整的arduino主程序可以在此页面底部找到,但您不能使用相同的程序。您必须更改我们刚刚从上面的示例草图中获得的信号代码值。打开arduino ide上的主程序,然后向下滚动到下面显示的该区域,您必须将数组值替换为为遥控器获得的值。
请注意,我使用了 10 个阵列,其中两个用于打开和关闭交流电,而其余 8 个用于设置不同的温度。例如,temp23 用于在交流电上设置 23°c,因此请使用该阵列中的相应代码。完成后,您只需将代码上传到arduino并将其放在ac对面,即可享受凉风。
代码的解释如下,首先我们必须使用dht1温度传感器读取温度和湿度并将其显示在oled上。这是通过以下代码完成的。
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(%);
一旦我们知道房间的温度,我们只需要将其与所需的值进行比较。这个期望值是一个常量值,在我的程序中设置为 27°c(摄氏度)。因此,基于此比较,我们将设置相应的交流温度,如下所示
if (measured_temp == desired_temperature+3) //if ac is on and measured temp is very high than desired
{
irsend.sendraw(temp24, sizeof(temp24) / sizeof(temp24[0]), khz); delay(2000);//send signal to set 24*c
ac_temp = 24;

当测量温度为 30°c 时,此处的 ac 将设置为 24°c(因为所需温度为 27)。同样,我们可以创建许多 if 循环,以根据测量的温度设置不同的温度级别,如下所示。
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 29*c
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;
}
自动交流温控系统工作原理:
当您的代码和硬件准备就绪时,将代码上传到您的主板,您应该注意到 oled 显示与此类似的内容。
现在将电路放在空调的对面,您会注意到空调的温度会根据室温进行控制。
您可以调整程序以执行任何所需的操作;您所需要的只是从示例草图中获取的代码。希望您了解这个自动温度控制器项目,并喜欢构建非常相似的东西。
/*
* automatic ac temperature control using arduino and tsop
* code by: aswinth raj b
* dated: 25-10-2017
* website: www.circuitdigest.com
*
s.no: component pin arduino pin
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 //lib for it blaster and tsop
#include // inbuilt lib
#include //inbuilt lib
#include //lib for oled
#include //lib for oled
#include //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,1100, 450,350, 450,1100, 400,400, 400,400, 450,1100, 400,1100, 450,400, 400,1100, 400,1100, 450,400, 400,400, 400,1100, 450,350, 450,400, 400,1100, 450,400, 400,400, 400,400, 450,350, 450,350, 450,400, 400,400, 450,350, 450,400, 400,400, 400,400, 450,350, 450,400, 400,400, 400,400, 450,400, 400,400, 400,400, 450,350, 450,350, 450,1100, 400,400, 450,400, 400,1100, 450,1050, 450,400, 400,400, 400,400, 450,350, 450,400, 400,400, 450,350, 450,400, 400,400, 400,1100, 450,350, 450,400, 400,400, 400,400, 450,400, 400,1100, 450,350, 450,400, 400,400, 400,400, 400,1100, 450,400, 400,400, 450,350, 450,400, 400,400, 400,400, 450,350, 450,350, 450,400, 400,400, 450,350, 450,400, 400,400, 400,400, 450,350, 450,400, 400,400, 450,350, 450,400, 400,400, 400,400, 450,350, 450,350, 450,400, 450,350, 450,350, 450,400, 450,350, 450,350, 450,350, 450,400, 450,350, 450,350, 450,400, 400,1100, 450,350, 450,350, 450,400, 450,350, 450,350, 450,1100, 450};
unsigned int acon[] = {2950,1700, 450,1100, 400,1100, 450,350, 450,350, 450,400, 450,1050, 450,350, 450,400, 450,1050, 450,1100, 400,400, 450,1050, 450,350, 450,400, 400,1100, 450,1100, 450,350, 450,1050, 450,1100, 450,350, 450,350, 450,1100, 450,350, 400,400, 450,1100, 450,350, 450,350, 450,400, 400,400, 450,350, 450,350, 450,400, 400,400, 450,350, 450,350, 450,400, 400,400, 450,350, 450,350, 450,400, 450,350, 450,350, 450,1100, 400,400, 450,350, 450,1100, 400,400, 450,350, 450,1100, 400,1100, 450,350, 450,400, 400,400, 450,350, 500,300, 450,400, 450,350, 400,400, 450,1100, 400,400, 450,350, 450,350, 450,400, 400,400, 450,350, 450,1100, 450,350, 400,400, 450,350, 450,400, 450,350, 400,400, 450,400, 450,350, 450,350, 450,350, 450,400, 400,400, 450,350, 450,400, 400,400, 400,400, 400,400, 450,350, 450,400, 450,350, 450,350, 450,400, 450,350, 450,350, 450,350, 450,400, 400,400, 400,400, 450,350, 450,400, 450,350, 400,400, 450,350, 450,400, 450,350, 450,350, 450,350, 450,400, 450,350, 450,1100, 400,400, 400,400, 450,350, 450,350, 450,1100, 400,400, 450};
unsigned int temp23[] = {3000,1650, 550,950, 550,1000, 500,300, 550,250, 550,250, 550,1000, 500,300, 550,300, 500,1000, 550,950, 550,300, 550,950, 550,250, 550,300, 500,1000, 500,1050, 500,300, 500,1000, 550,1000, 500,300, 500,300, 550,1000, 450,350, 500,300, 500,1050, 450,350, 450,350, 450,350, 450,400, 450,350, 450,350, 450,400, 400,400, 450,350, 450,350, 450,350, 450,400, 400,400, 400,400, 450,400, 400,400, 400,400, 450,1100, 400,400, 400,400, 450,1050, 450,400, 400,400, 450,1100, 400,1100, 400,400, 450,350, 450,400, 400,400, 400,400, 450,400, 400,400, 400,400, 450,350, 450,1100, 400,400, 400,400, 450,350, 450,400, 400,400, 450,1100, 400,400, 400,1100, 450,1100, 400,1100, 450,350, 450,400, 400,400, 450,350, 450,350, 450,400, 400,400, 400,400, 450,350, 450,400, 400,400, 450,350, 450,400, 400,400, 400,400, 450,350, 450,400, 400,400, 450,350, 450,350, 450,400, 450,350, 400,400, 450,350, 450,400, 450,350, 450,350, 450,400, 450,350, 450,350, 450,350, 450,400, 400,400, 400,400, 450,350, 450,1100, 400,1100, 450,1100, 400,1100, 450,1100, 400,1100, 400,400, 450};
unsigned int temp24[] = {3000,1650, 500,1050, 500,1000, 500,300, 500,300, 500,350, 500,1000, 500,300, 500,350, 500,1000, 500,1050, 500,300, 500,1000, 500,300, 500,350, 500,1000, 500,1050, 500,300, 500,1000, 500,1050, 500,300, 500,300, 500,1050, 500,300, 500,300, 500,1050, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,1050, 500,300, 500,300, 500,1050, 500,300, 500,300, 500,1050, 500,1000, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,1000, 500,1050, 500,1000, 500,300, 500,350, 450,350, 500,300, 500,300, 500,350, 500,1000, 500,300, 500,1050, 500,1000, 500,1050, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,300, 500,350, 500,300, 450,350, 500,350, 450,350, 450,350, 450,350, 450,400, 400,400, 400,400, 450,400, 400,400, 400,400, 400,400, 450,350, 450,400, 400,400, 450,350, 450,400, 450,350, 450,350, 450,350, 450,400, 450,350, 450,350, 450,350, 500,350, 450,1050, 500,300, 500,1050, 500,1000, 500,1050, 500,1000, 500,1000, 500,350, 550};
unsigned int temp25[] = {3050,1650, 500,1000, 550,950, 550,300, 500,300, 500,300, 550,1000, 500,300, 500,300, 550,1000, 550,950, 550,250, 550,1000, 500,300, 550,250, 550,1000, 500,1000, 550,300, 550,950, 550,950, 550,300, 500,300, 500,1000, 550,250, 550,300, 550,950, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,250, 550,250, 600,250, 500,300, 550,250, 550,250, 550,300, 550,250, 500,300, 550,300, 500,300, 500,1000, 550,250, 550,300, 500,1000, 550,250, 550,300, 500,1000, 550,1000, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,300, 500,1000, 550,950, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,950, 550,300, 500,1000, 550,1000, 500,1000, 500,300, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,250, 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, 550,250, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 500,350, 500,1000, 500,1000, 500,1050, 500,1000, 500,1050, 500,300, 550};
unsigned int temp26[] = {3000,1650, 500,1000, 500,1050, 500,300, 500,300, 500,350, 500,1000, 500,300, 500,350, 500,1000, 500,1050, 450,350, 500,1000, 500,300, 500,350, 500,1000, 500,1050, 500,300, 500,1000, 500,1050, 500,300, 500,300, 500,1050, 500,300, 500,300, 500,1050, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,1050, 500,300, 500,300, 500,1050, 450,350, 500,300, 500,1050, 500,1000, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,1000, 500,300, 500,1050, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,1050, 500,300, 500,1050, 450,1050, 500,1000, 500,350, 500,300, 500,300, 500,350, 450,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 450,350, 500,300, 500,350, 450,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,350, 500,300, 500,300, 500,300, 500,350, 500,300, 500,300, 500,350, 450,1050, 500,1000, 500,350, 500,1000, 500,1000, 500,1050, 500,1000, 500,350, 500};
unsigned int temp27[] = {3050,1600, 550,1000, 500,1000, 550,300, 500,300, 550,250, 550,1000, 500,300, 550,300, 500,1000, 550,1000, 500,300, 550,1000, 550,250, 500,300, 550,1000, 500,1050, 500,300, 500,1000, 550,1000, 500,300, 550,250, 550,1000, 550,250, 550,300, 500,1000, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,300, 500,300, 500,1000, 550,300, 500,300, 550,1000, 500,300, 500,300, 550,1000, 550,1000, 500,300, 500,300, 550,250, 550,300, 500,300, 550,300, 500,300, 500,300, 550,1000, 500,300, 550,250, 550,300, 500,300, 500,300, 500,350, 500,300, 550,250, 550,1000, 500,1000, 550,1000, 500,300, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,300, 500,300, 550,250, 550,300, 500,300, 500,300, 500,300, 550,300, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 500,300, 500,350, 500,300, 500,350, 500,300, 500,300, 500,1050, 500,1000, 500,1050, 500,1000, 500,350, 500};  // panasonic c4d3:64800024
unsigned int temp28[] = {3100,1600, 550,950, 550,1000, 550,250, 550,250, 550,250, 550,1000, 500,300, 500,300, 550,1000, 500,1000, 550,250, 550,1000, 500,300, 550,250, 550,1000, 550,950, 550,300, 500,1000, 550,950, 550,300, 550,250, 500,1000, 550,300, 500,300, 550,950, 550,300, 500,300, 500,300, 550,250, 550,300, 550,250, 500,300, 550,300, 500,300, 500,300, 550,250, 550,250, 600,250, 500,300, 500,300, 550,300, 500,300, 500,1000, 550,300, 500,300, 500,1000, 550,250, 550,300, 500,1000, 550,1000, 550,250, 550,250, 550,250, 550,300, 500,300, 550,250, 550,1000, 500,1000, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,1000, 500,300, 500,1000, 550,1000, 500,1000, 550,250, 550,300, 500,300, 550,250, 550,250, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 550,250, 550,300, 550,250, 500,300, 550,250, 550,250, 550,300, 550,250, 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,1000, 500,300, 500,300, 550,950, 550,1000, 500,1000, 550,1000, 500,300, 550};
unsigned int temp29[] = {3100,1550, 600,950, 500,1000, 550,300, 500,300, 500,300, 550,950, 550,300, 550,250, 550,1000, 500,1000, 550,250, 550,1000, 500,300, 550,250, 550,950, 600,950, 550,250, 550,1000, 500,1000, 550,250, 600,250, 550,950, 550,250, 550,300, 550,950, 550,250, 550,300, 550,250, 550,250, 550,250, 550,300, 550,250, 550,250, 550,300, 500,300, 550,250, 550,250, 550,300, 500,300, 550,250, 550,250, 600,250, 550,950, 550,250, 550,300, 500,1000, 550,250, 550,300, 550,950, 550,1000, 500,300, 500,300, 550,250, 550,250, 550,300, 500,300, 550,250, 550,1000, 500,300, 550,250, 550,300, 500,300, 550,250, 550,250, 550,300, 500,1000, 550,250, 550,1000, 500,1000, 550,1000, 500,300, 500,300, 550,300, 500,300, 500,300, 550,250, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,250, 550,250, 550,300, 500,300, 500,300, 550,300, 500,300, 500,300, 550,250, 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+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 27*c
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 25*c
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 27*c
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 29*c
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;
}

飞凌嵌入式FCU2601网关,为工商业储能EMS注入智慧的力量
大模型及ChatGPT核心技术论文
联创光电为世博点燃节能灯火
高效率70W通用开关电源模块
光分路器芯片和阵列波导光栅芯片关键技术
基于Arduino/DHT11和红外发射器制作的自动交流温度控制器
关于AutoML的完整资源列表
快来get 1500V光伏和储能系统的解决方案吧√
出售JDSU ORL-55插回损测试仪
电动汽车充电的三大注意事项
精密的智能电池简单化充电过程
苹果AirPods 2/Pro耳机新固件更新,具体内容还不确定
芝加哥大学:能将IBM最大的量子计算机本身变成一种量子材料
双卡双待智能手机全推荐
物联网主机E6000:引领智能安防新时代
杉岩数据USP统一存储平台的应用案例
小米路由器HD和荣耀路由Pro2哪个好
关于分布式训练的线性加速实践详解
如何将ArduinoBootLoader刻录到AtMega328p芯片上
美光CEO:与大陆合资NAND Flash可能比较合理