如何建立一个简易的气象站

第1步:获取所有部分
你需要,
1个arduino板,我使用的是pro mini
1 dht传感器我使用了dht 22
1个10k电阻器
1个带有匹配板的sd卡或micro sd卡
3英尺线上
3线电缆(您将使用它将您的dht传感器连接到arduino)
焊接材料
第2步:连线。
连接所有导线,如图所示。
dht sensor pro mini,uno& mega。将传感器的引脚1(左侧)连接到+ 5v
注意:如果使用具有3.3v逻辑的电路板,如arduino due连接引脚1至3.3v而不是5v
将传感器的引脚2连接到您的dht引脚
将传感器的引脚4(右侧)连接到ground
将一个10k电阻从vcc连接到数据pin
对于大型miso-50 mosi-51 sck-52 ss/cs 53
对于uno& pro mini miso-50 mosi-51 sck-52 ss/cs-53。
步骤3:编程arduino。
// created by a homeschoolers workbench
// 12/1/2016
#include “dht.h”
#include
file myfile;
int pincs = 10; // pin 53 on arduino mega 10 on pro mini and uno, this is the ss pin
// for the uno and pro mini connect sck-13 miso-12 mosi-11 cs/ss-10
// for mega connect sck-52 miso-50 mosi-51 cs/ss-53
#define dhtpin 2 // what digital pin we‘re connected to
// uncomment whatever type you’re using!
//#define dhttype dht11 // dht 11
#define dhttype dht22 // dht 22 (am2302), am2321 i am using the 22
//#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 vcc to data pin
// initialize dht sensor.
dht dht(dhtpin, dhttype);
void setup() {
serial.begin(9600); // start the serial
pinmode(pincs, output);
// sd card initialization
if (sd.begin())
{
serial.println(“sd card is ready to use.”);
} else
{
serial.println(“sd card initialization failed”);
return;
}
dht.begin();
}
void loop() {
// wait a 60 seconds between measurements.
delay(2000);
// reading temperature or humidity takes about 250 milliseconds!
float h = dht.readhumidity();
// read temperature as fahrenheit (isfahrenheit = true)
float f = dht.readtemperature(true);
// check if any reads failed and exit early (to try again)。
if (isnan(h)||isnan(f)) {
return;
}
// create/open file
myfile = sd.open(“th.txt”, file_write);
// if the file opened okay, write to it
if (myfile) {
serial.println(“writing to file.。.”);
// write to file
myfile.print(h); // print humidity
myfile.print(“,”); // place a divider
myfile.println(f); // print the temp and start a new line
myfile.close(); // close the file
serial.println(“done.”);
} //if the file didn‘t open, print an error:
else {
serial.println(“error opening th.txt”);
}
}
步骤4:安装它。
传感器放置在您想要测量温度和湿度的任何地方,您必须确保arduino保持干燥。
当您将sd卡放入其主板时,您必须重置arduino,否则它将不会记录数据。
步骤5:如何导出数据
打开sd卡,然后打开th,选择全部,复制
然后打开excel(linux中的libre calc)然后粘贴,并用逗号分隔。然后把它变成一个图表。

台湾半导体大厂强茂发生火灾
华为P10闪存门之后又来爆炸自燃:华为P10 Plus步三星Note7后尘发生自燃!
Marvell推出安全汽车以太网和边缘计算及完整的IEEE 802.11ax无线连接方案
iPhone8将成苹果未来十年最后一波成长潮?
ams AG的传感器解决方案与应用
如何建立一个简易的气象站
“2018爱分析·中国人工智能创新企业榜”正式揭晓
解读苹果造车的秘密
S7-200 SMART Modbus TCP服务器指令库
EMC问题的根源在哪?
河北电信携手华为在石家庄国际会展实现了首次5G背包+4K超高清直播
振荡器中使用hbsp去仿真输出阻抗分析
RFID怎样可以检测食品安全
基于WPKI的安全移动支付系统的设计与实现
创客热爱的超微型电脑:C.H.I.P. 和 Pi Zero 大比拼
行星减速机和齿轮减速机对比分析
AP8801直流变换器中文资料(特性_引脚功能_驱动电路)
小米即将推出新品,开启高端全自动智能锁时代
LED灯具失效分析及电路保护措施
泰克荣获两项媒体年度“最佳测试测量产品”大奖