Difference between revisions of "Temperature & Humidity Sensor"

From Microduino Wiki
Jump to: navigation, search
Line 2: Line 2:
 
|-
 
|-
 
|
 
|
==Objective==
+
==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 will show you how to use Micorduino temperature & humidity sensor.  
+
==Specification==
 
+
*Electrical specification
==Equipment==
+
**Operation voltage: 2.6~5V;
*'''[[Microduino-CoreUSB]]'''
+
**Input device
*'''[[Microduino-Temperature & Humidity Sensor]]'''
+
*Tech parameters
*'''[[Microduino-Sensorhub]]'''
+
**Accuracy: 0.1°C  in temperature and 0.1%RH in relative humidity;
*'''[[Microduino-OLED]]'''
+
*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  
**1x USB cable
+
**One USB cable
 
+
[[File:Temp-Hum.jpg|600px|center]]
==Program==
+
===Preparation===
 
+
*Setup 1:Connect Microduino-Temp&Hum to the IIC port of the Hub.  
 
+
[[file:mCookie-Temp&Hum-sensor.JPG|600px|center]]
==Debugging==
+
*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]]
Step 1: Connect Microduino Temperature & Humidity sensor to IIC pin of Microduino-SensorHub and Microduino-OLED to IIC pin of Microduino-SensorHub.  
 
[[File:MicroduinoTemperatureSensor.png|600px|center|thumb]]
 
 
 
 
 
Step 2: Connect the Microduino-CoreUSB to your PC with the USB cable and upload the code.
 
[[File:MicroduinoTemperatureSensor1.png|600px|center|thumb]]
 
 
 
 
 
Step 3: Power it on and it will show temperature value on OLED.
 
  
[[File:MicroduinoTemperatureSensor2.png|600px|center|thumb]]
+
===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);
 +
}
  
Step 4: Try to change temperature and see changes on OLED.
+
void loop() {
[[File:MicroduinoTemperatureSensor3.png|600px|center|thumb]]
+
  readByAM2321();
 +
  delay(500);
 +
}
  
 +
void readByAM2321()
 +
{
 +
  AM2321 am2321;
 +
  am2321.read();
  
==Result==
+
  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]]
  
You can get indoor temperature through the temperature sensor.  
+
===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

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.

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

Module Number Function
mCookie-CoreUSB 1 Core board
mCookie-Hub 1 Sensor pin board
Microduino-Temp&Hum 1 Sound detection sensor
  • Other Hardware Equipment
    • One USB cable
Temp-Hum.jpg

Preparation

  • Setup 1:Connect Microduino-Temp&Hum to the IIC port of the Hub.
MCookie-Temp&Hum-sensor.JPG
  • Setup 2:Stack the CoreUSB, Hub and Sound together and then connect them to the computer with a USB cable.
MCookie-Sound-pc.JPG

Experiment: Detect Temp&Hum Values

  • Open Arduino IDE and copy the following code into IDE.
#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(')');
}
  • Select the right board from Tools→Serial Port in Arduino IDE and download the program.
Upload.JPG
  • Open the serial monitor after download; The value displayed reflects the current temperature and humidity.
MCookie-Temp-Hum-res.JPG

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