如何通过使用加热器和风扇调节任何温室的湿度和温度

步骤1:设置字符lcd
这是该项目接线中最棘手的部分。上图显示了lcd的每个连接如何连接到arduino。使用正/负面包板导轨进行设置要容易得多,但是我没有一个可用的导轨。在我的设置中,我在引脚3和引脚1之间使用了电位计,因为它可以轻松调节背光。但是,这不是必需的,一个10k电阻将代替它工作。
步骤2:连接湿度和温度传感器
设置两个非常简单为此使用了单独的传感器,但是我使用了一个同时读取湿度和温度的传感器。 dht传感器价格便宜,能够读取温度和湿度。它们有四个引脚,其连接方式如下:
vcc(3v-5v电源)
数据输出
无连接
接地
在vcc和数据线之间也连接一个10k电阻。上方显示一个图。
要使用dht传感器,您需要下载dht库。这是adafruit的一款。为了使用它,请下载dht.cpp和dht.h文件,并将它们放在arduino“ libraries”文件夹中的“ dht”文件夹中。
以下是adafruit的dht传感器示例代码:
// example testing sketch for various dht humidity/temperature sensors
// written by ladyada, public domain
#include “dht.h”
#define dhtpin 2 // what pin we‘re connected to
// uncomment whatever type you’re using!
//#define dhttype dht11 // dht 11
#define dhttype dht22 // dht 22 (am2302)
//#define dhttype dht21 // dht 21 (am2301)
// connect pin 1 (on the left) of the sensor to +5v
// note: if using a board with 3.3v logic like an arduino due connect pin 1
// to 3.3v instead of 5v!
// connect pin 2 of the sensor to whatever your dhtpin is
// connect pin 4 (on the right) of the sensor to ground
// connect a 10k resistor from pin 2 (data) to pin 1 (power) of the sensor
// initialize dht sensor for normal 16mhz arduino
dht dht(dhtpin, dhttype);
// note: for working with a faster chip, like an arduino due or teensy, you
// might need to increase the threshold for cycle counts considered a 1 or 0.
// you can do this by passing a 3rd parameter for this threshold. it‘s a bit
// of fiddling to find the right value, but in general the faster the cpu the
// higher the value. the default for a 16mhz avr is a value of 6. for an
// arduino due that runs at 84mhz a value of 30 works.
// example to initialize dht sensor for arduino due:
//dht dht(dhtpin, dhttype, 30);
void setup() {
serial.begin(9600);
serial.println(“dhtxx test!”);
dht.begin();
}
void loop() {
// wait a few seconds between measurements.
delay(2000);
// reading temperature or humidity takes about 250 milliseconds!
// sensor readings may also be up to 2 seconds ’old‘ (its a very slow sensor)
float h = dht.readhumidity();
// read temperature as celsius
float t = dht.readtemperature();
// read temperature as fahrenheit
float f = dht.readtemperature(true);
// check if any reads failed and exit early (to try again)。
if (isnan(h) || isnan(t) || isnan(f)) {
serial.println(“failed to read from dht sensor!”);
return;
}
// compute heat index
// must send in temp in fahrenheit!
float hi = dht.computeheatindex(f, h);
serial.print(“humidity: ”);
serial.print(h);
serial.print(“ % ”);
serial.print(“temperature: ”);
serial.print(t);
serial.print(“ *c ”);
serial.print(f);
serial.print(“ *f ”);
serial.print(“heat index: ”);
serial.print(hi);
serial.println(“ *f”);
}
步骤3:测试字符lcd和dht传感器
上面是对character lcd和dht22传感器的测试设置的详细了解。加载到其上的代码会定期显示传感器的湿度和温度读数。我将尽快上传代码。


水产品氯霉素快速检测仪的原理说明,它的用途是什么
特斯拉为何对碳化硅忽冷忽热?
丰田总市值创日企新高 24年涨幅已高达15%
在SpringBoot框架中将.xml中的sql语句查询得到的数据存入变量
为什么今年的5G旗舰手机这么贵? 安卓旗舰集体涨价背后你需要知道这些
如何通过使用加热器和风扇调节任何温室的湿度和温度
VGA光纤收发器的特点和技术参数
中国铁塔累计承建5G项目超76万
vivo推出新机vivo V19,搭载骁龙730G处理器
恒温隔膜式压力变送器的原理及设计
如何分辨判别步进电动机绕组相序
浅析各类USB和新的USB4
我国已为生产高性能CPU 芯片打下良好基础
阻碍区块链被广泛采用的五个主要障碍
监视器
可靠安全是汽车连接器必备的特征
存储器实现技术革新,DRAM有望进行量产
生成式 AI 如何融入软件开发全生命周期
郑州建设智能传感器产业共性关键技术创新与转化平台
这次碰到的是高通,苹果扩大利润策略能否如愿