Anda di halaman 1dari 6

Email: info@sunrom.com Visit us at http://www.sunrom.

com http://

Document: Datasheet

Date: 31-Dec-10

Model #: 1211

Humidity/Temperature Sensor
This sensor measures Relative Humidity and Temperature and outputs in simple serial interface of two types types. Serial data can be viewed on PCs terminal software at 9600 bps bps. Microcontrollers can use Serial shift interface to read the sensor data through general I/O pins.

Features
Fast response time / Simple 5V Supply & Interface Two type of digital outputs(Serial & SPI) Relative Humidity from 1%-100% Temperature from +2 deg C to +60 60 deg C

Applications
Weather Stations / Environment Monitoring Green Houses, Books & Archive Storage Medicine Storage, Warehouse Environment Surveillance

Specification
Parameter Supply Voltage Supply Current Temperature Range Humidity Range Storage Temperature Humidity Accuracy Temperature Accuracy Pin +5V DC 20 mA 60 deg C 1 to 100% RH -20 to 85 deg C +/- 5% RH +/- 2 deg C Notes Supply voltage greater than +5.5V will damage the sensor Degree Celsius Relative Humidity

Images of the Sensor

Module Connections
Pin# 1 2 3 4 5 6 Pin GND +5V DAT RDY CLK TXD Name Ground +5V DC Supply DATA READY CLOCK TRANSMITUART Type I/O Ground Positive Supply Output for Module Output for Module Input for Module Output 5V level Details Power Supply Ground Power Supply Positive Serial Shift Interface - Data Output Serial Shift Interface - Ready Signal Output Serial Shift Interface - Clock Input Serial Data of 9600 bps, 8 bit data, no parity, 1 stop bit

Interfacing with the sensor


There are two ways you can get the output from sensor. You can use either of the interface depending on your application.
U2 Humidity/Temperature Sensor Sunrom Model: 1211 H T

GND +5V DAT RDY CLK TXD

Interface #1 Serial Data at 9600bps TXD

1 2 3 4 5 6 +5V

Interface #2 Serial Shift Interface CLK RDY DAT Two Digital Interface

Interface #1 is Serial Data at 9600 bps at 5V level. You can also use the serial data to interface to PC using MAX232 level convertor for serial port or use USB-TTL chip to get a virtual serial port on PC to which many software like Hyperterminal can be connected. Custom software can also be made to monitor the incoming data. You can also use serial interface directly with a microcontroller when you have a dedicated serial input pin available on your application to get the data for display or processing. Interface #2 is Serial Shift Interface, which consist of three pins. In this interface you have to monitor RDY pin to go low which means new data has arrived. Then you shift output data using DAT and CLK pins. You can use any I/O of your application microcontroller.

Sunrom Technologies

Your Source for Embedded Systems

Visit us at www.sunrom.com

Serial Data Output Format


When you see data output from chip in serial at 9600 baud rate, you will get total thirteen bytes output containing reading of temperature and humidity. This data is output every second in ASCII format so you can view it on screen. Let us see what data output you will get in serial mode. The first and last byte in serial mode are new line characters so that when you see this data in terminal you can see each new data in new line. Example Output of Serial in terminal software: H:058 T:024 H:058 T:024 H:058 T:024 It means Relative Humidity is 58% and Temperature is 24 degrees Celcius. Interpreting above data for single reading of 13 bytes in below table
BYTE COUNT 1 2 3 4 5 6 7 8 9 10 11 12 13 HEX 0x0A 0x48 0x3A 0x30 0x35 0x38 0x20 0x54 0x3A 0x30 0x32 0x34 0x0D DECIMAL 10 72 58 48 53 56 32 84 58 48 50 52 13 CHARACTER DISPLAYED \n = LF H : 0 5 8 T : 0 2 4 \r = CR Details New Line Character Fixed Character H Fixed Character : Humidity Character-Hundreds Humidity Character-Tens Humidity Character-Ones Space Fixed Character T Fixed Character : Temperature Character-Hundreds Temperature Character-Tens Temperature Character-Ones New Line Character

The above values in serial data are ASCII characters.

Sunrom Technologies

Your Source for Embedded Systems

Visit us at www.sunrom.com

Connecting Sensor to Serial Port


If you wish to interface the module with RS232 level like a PC serial port or any other device you need a level convertor such as MAX232 as shown below since the sensor level out is of 5V while RS232 works on +/-12V levels for data transmission. If you connect sensor directly to serial port, it will damage the sensor due to high voltage. That is the reason MAX232 is required if interfaced with serial port.
U9 Humidity/Temperature Sensor Sunrom Model: 1211 H T +5V C16 100n U6 MAX232 11 9 12 10 + C13 10uF 16V +5V 2 + C14 10uF 16V 1 3 GND +5V DAT RDY CLK TXD 16 14 8 13 7 4 5 6 C15 10uF 16V + + C12 10uF 16V P2 DB9-CONN-FEMALE 1 6 2 7 3 8 4 9 5

T1IN R2OUT R1OUT T2IN C+ C1V+

1 2 3 4 5 6

VCC

T1OUT R2IN R1IN T2OUT C2+ C2V-

You can also use our Max232 Board Model 1104

RS232 INTERFACING

+5V

15

GND

http://www.sunrom.com/p-245.html

Interfacing to USB Port and Powering from USB Port


Since the output of sensor is at 5V level, you can directly connect to USB-TTL UART boards to get data to PC. More over USB also supplies power to the sensor. So no external power is required. It will appear as virtual serial port on PC to which you can communicate through any software which can receive by this serial port like hyperterminal or custom made software.
U10 Humidity/Temperature Sensor Sunrom Model: 1211 H T U11 USB to Serial Board SUNROM#1151 RX-IN TX-OUT GND +5V

You can use our USB to Serial Board Model 1151

http://www.sunrom.com/p-244.html

GND +5V DAT RDY CLK TXD

1 2 3 4 5 6

1 2 3 4

USB INTERFACING

To get +5V power for sensor from USB port, solder +5V wire of RF module to +ve pin of this capacitor. Your Source for Embedded Systems Visit us at www.sunrom.com

Sunrom Technologies

Microcontroller Application using serial shift data


In this application we will interface sensor with a microcontroller through serial shift data. We have used AT89C51s I/O pin to receive data from sensor. You can use any microcontroller to interface using this method. We have chosen AT89C51 to show since it is more widely used. The sample code we have given can be adapted to any C compiler or any microcontrollers like AVR or PIC since with minor changes. Sample code is given on next page.
U3 Humidity/Temperature Sensor Sunrom Model: 1211 H T C4 +5V U7 AT89C51 P0.0/AD0 P0.1/AD1 P0.2/AD2 P0.3/AD3 P0.4/AD4 P0.5/AD5 P0.6/AD6 P0.7/AD7 P1.0/T2 P1.1/T2EX P1.2 P1.3 P1.4/SS P1.5/MOSI P1.6/MISO P1.7/SCK EA/VPP PSEN ALE/PROG XTAL2 XTAL1 GND RST 9 R3 10K 39 38 37 36 35 34 33 32 1 2 3 4 5 6 7 8 31 +5V C6 10uF 16V

GND +5V DAT RDY CLK TXD

+5V

CLK RDY DAT

21 22 23 24 25 26 27 28 10 11 12 13 14 15 16 17 29 30

P2.0/A8 P2.1/A9 P2.2/A10 P2.3/A11 P2.4/A12 P2.5/A13 P2.6/A14 P2.7/A15 P3.0/RXD P3.1/TXD P3.2/INT0 P3.3/INT1 P3.4/T0 P3.5/T1 P3.6/WR P3.7/RD

18

19 Y2 11.0592

VCC

1 2 3 4 5 6

40

100n

C9 33p

C10 33p

Sunrom Technologies

Your Source for Embedded Systems

20

Visit us at www.sunrom.com

Sample Code for Microcontroller Interfacing


// Keil Compiler, Target Chip AT89C51 // We will take the sensor data into variables Hum and Temp #include <REGX51.H> #include <stdio.h> #define RDY P2_6 #define CLK P2_5 #define DAT P2_7 unsigned int indata16, k; //16 bit variables unsigned char Hum, Temp; //8 bit variables void main() { signed int i; indata16 = 0x0000; CLK=1; delay_ms(100); //delay for 100ms at power up while(1) { indata16 = 0x0000; if(RDY==0) { for(i=15;i>0;i-=2) { k = 0; if(DAT==1) k = 1 << i; indata16|=k; CLK=0; while(RDY==0); k = 0; if(DAT==1) k = 1 << (i-1); indata16|=k; CLK=1; while(RDY==1); } Hum= indata16 >>8; //Separate Humidity reading into variable Temp= indata16; //Separate Temperature reading into variable } } }

Sunrom Technologies

Your Source for Embedded Systems

Visit us at www.sunrom.com

Anda mungkin juga menyukai