Difference between revisions of "Temperature & Humidity Sensor"
From Microduino Wiki
Line 2: | Line 2: | ||
|- | |- | ||
| | | | ||
− | == | + | ==Outline== |
− | + | This tutorial adopts AM2321 digital temperature and humidity sensor. Microudino-Temp&Hum consists of a capacitive humidity sensor and a high precision integrated temperature measuring component, connecting with a high performance microprocessor. Therefore, the product has the advantages of excellent quality, fast response, high anti-interference and high comparability in price and etc. | |
− | This tutorial | + | ==Specification== |
− | + | *Electrical specification | |
− | == | + | **Operation voltage: 2.6~5V; |
− | * | + | **Input device |
− | * | + | *Tech parameters |
− | * | + | **Accuracy: 0.1°C in temperature and 0.1%RH in relative humidity; |
− | * | + | *Size |
− | + | **Size of the Sensor: 8mm*11mm, | |
− | + | **Size of the Board: 20mm*10mm | |
+ | **1.27mm-pitch 4Pin interface; | ||
+ | *Connection method | ||
+ | **Interface: I2C。 | ||
+ | **Pin description: GND, VCC, Signal 1 and Signal 2. This output signal is IIC and needs IIC interface to receive signal, which can connect Sensorhub's IIC pin. | ||
+ | ==Development== | ||
+ | ===Equipment=== | ||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | |Module||Number||Function | ||
+ | |- | ||
+ | |[[mCookie-CoreUSB]]||1||Core board | ||
+ | |- | ||
+ | |[[mCookie-Hub]]||1||Sensor pin board | ||
+ | |- | ||
+ | |[[Microduino-Temp&Hum]]||1||Sound detection sensor | ||
+ | |} | ||
*Other Hardware Equipment | *Other Hardware Equipment | ||
− | ** | + | **One USB cable |
− | + | [[File:Temp-Hum.jpg|600px|center]] | |
− | == | + | ===Preparation=== |
− | + | *Setup 1:Connect Microduino-Temp&Hum to the IIC port of the Hub. | |
− | + | [[file:mCookie-Temp&Hum-sensor.JPG|600px|center]] | |
− | == | + | *Setup 2:Stack the CoreUSB, Hub and Sound together and then connect them to the computer with a USB cable. |
− | + | [[file:mCookie-Sound-pc.JPG|600px|center]] | |
− | |||
− | [[ | ||
− | |||
− | |||
− | |||
− | [[ | ||
− | |||
− | |||
− | |||
− | + | ===Experiment: Detect Temp&Hum Values === | |
+ | *Open Arduino IDE and copy the following code into IDE. | ||
+ | <source lang="cpp"> | ||
+ | #include <Wire.h> | ||
+ | #include <AM2321.h> | ||
+ | void setup() { | ||
+ | Serial.begin(9600); | ||
+ | } | ||
− | + | void loop() { | |
− | + | readByAM2321(); | |
+ | delay(500); | ||
+ | } | ||
+ | void readByAM2321() | ||
+ | { | ||
+ | AM2321 am2321; | ||
+ | am2321.read(); | ||
− | + | Serial.print("("); | |
+ | Serial.print(am2321.temperature/10.0); | ||
+ | Serial.print(", "); | ||
+ | Serial.print(am2321.humidity/10.0); | ||
+ | Serial.println(')'); | ||
+ | } | ||
+ | </source> | ||
+ | *Select the right board from Tools→Serial Port in Arduino IDE and download the program. | ||
+ | [[file:upload.JPG|500px|center]] | ||
+ | *Open the serial monitor after download; The value displayed reflects the current temperature and humidity. | ||
+ | [[file:mCookie-Temp-Hum-res.JPG|500px|center]] | ||
− | + | ===Program Debugging === | |
+ | *The program uses AM2321 temperature and humidity collection library and defines "#include <Wire.h>" and "#include <AM2321.h>" as driving files. | ||
+ | *“am2321.temperature/10.0”represents the calculated temperature value and " am2321.humidity/10.0" represents the calculated humidity value. | ||
+ | ==Application== | ||
+ | Microudino-Temp&Hum can be widely applied in HVAC system, dehumidifier, testing and detection equipment, consumer goods, automobile, automatic control, data recorder, weather station, appliances, humidity control, medical care, and other relative humidity detection control. | ||
==Video== | ==Video== | ||
|} | |} |
Revision as of 01:54, 4 November 2015
ContentsOutlineThis tutorial adopts AM2321 digital temperature and humidity sensor. Microudino-Temp&Hum consists of a capacitive humidity sensor and a high precision integrated temperature measuring component, connecting with a high performance microprocessor. Therefore, the product has the advantages of excellent quality, fast response, high anti-interference and high comparability in price and etc. Specification
DevelopmentEquipment
Preparation
Experiment: Detect Temp&Hum Values
#include <Wire.h>
#include <AM2321.h>
void setup() {
Serial.begin(9600);
}
void loop() {
readByAM2321();
delay(500);
}
void readByAM2321()
{
AM2321 am2321;
am2321.read();
Serial.print("(");
Serial.print(am2321.temperature/10.0);
Serial.print(", ");
Serial.print(am2321.humidity/10.0);
Serial.println(')');
}
Program Debugging
ApplicationMicroudino-Temp&Hum can be widely applied in HVAC system, dehumidifier, testing and detection equipment, consumer goods, automobile, automatic control, data recorder, weather station, appliances, humidity control, medical care, and other relative humidity detection control. Video |