Grove - Temperature and Humidity Sensor Pro

From openPicus Wiki
Jump to: navigation, search

Contents

Device description

Temp humi pro.jpg This product is a high accuracy temperature and humidity sensor used in home conditions. It is based on RHT03 supplied by Maxdetect. The accuracy of this module can be up to 0.3 degree in temperature and 2% in relative humidity.Further details can be found in the datasheet of the component



Specifications:

  • Power Supply: 3.3V-5V;
  • Current: 1.5mA ;
  • Measuring Range
Temperature: -40 °C 80 °C
Humidity: 5% RH 99% RH
  • Resolution
Temperature: ±0.1 °C
Humidity: ±0.1% RH

How to use

This device uses its specific library plus the Grove basic libraries that are embedded into the GROVE TEMPLATE available from IDE 2.3. Just create a new Project on the IDE using the right GROVE TEMPLATE.
The device must be connected on any DIGx port of the Grove board.

  • Connect to port: any DIGx (DIG1, DIG2, DIG3 or DIG4);
  • Library to use: insert IC library + rht03 library + Grove basic library included into each Grove Template on the IDE

Once the library is added to the project, using the External lib button, the line #include "rht03.h" must be inserted in taskFlyport.c to include the header file. The line must also be inserted in HTTPApp.c if you want to access the device from webserver.

More infos and examples can be found in the Grove Library page.

Software commands

The steps to use the device are:

  • Initialization: the device is initialized as RHT03 type.The function to use is void* device_name = new(RHT03);
  • definition of the port: the sensor must be connected to a digital port (DIG1-4): attachToPort(board_name, device_name, DIGx);
  • configuration: The sensor has to be configured since it is using the Input Capture module:configure(device_name,IC_module_number), where IC_module_number is the number of Input Capture module will be using. There are up to 6 Input Capture modules available which you can choose from;
  • reading of the data: the temperature and humidity values have to be read separately, so in the get() function must be specified the name of the sensor and what you want to get:
function
Temperature get(device_name, TEMP);
Humidity get(device_name, HUMD);
Pay attention: Remember to check the flag status in order to know if the data that you have just got is valid or not


#include "taskFlyport.h"
#include "grovelib.h"
#include "rht03.h"
 
void FlyportTask()
{
	float data = 0;	
	char msg[100];
 
	vTaskDelay(50);
	UARTWrite(1,"Welcome to GROVE NEST example!\r\n");
 
 
	void *board = new(Board);
	void *rht03 = new(RHT03);
 
        attachToBoard(board,rht03,DIG1);
        configure(rht03, 3);
 
        while(1)
	{
		// Reading humidity
		data = get(rht03, HUMD);
		if(!readError())
		{
			sprintf(msg,"humidity %.1f\r\n", (double) data);
			UARTWrite(1,msg);
		}
                // Reading temperature
		vTaskDelay(100);
		data = get(rht03, TEMP);
		if(!readError())
		{
			sprintf(msg,"temperature %.1f\r\n", (double) data);
			UARTWrite(1,msg);
		}
 
	}	
}

External references

  • Seeed studio wiki: complete datasheet of the Temperature and Humidity Sensor Pro device;
Personal tools
Namespaces

Variants
Actions
START HERE
DEVELOPMENT
HARDWARE INFO
RESOURCES
PHASED OUT
Toolbox