Datasheet

ASAIR
®
5
/
8
5.2 One-wire bus communication protocol
One-wire bus descriptions
The AM2311A uses simplied one-wire bus
communication, the one-wire bus has only one data
line, and the data exchange and control in the system
are completed by the data line. The micro-controller
is connected to the data line via a drain open circuit
or a three state port, allows the device to release the
bus without sending data, let other devices use the
bus. A single bus usually requires an external pull up
resistor of about 4.7k, thus, when the bus is idle, the
state is high. Because they are the principal and
subordinate structure, only the host call sensor, the
sensor can response, so the host access sensor
must strictly follow the single bus sequence, if the
sequence of chaos, sensor will not respond to host.
One-wire bus transmits data denitions
SDA is used for communication and synchronization
between micro controller and AM2311A, and uses
single bus data format to transmit 40 bit data at one
time. The specic communication sequence is shown
in Figure 7, and the communication format
specication is shown in Table 6.
Examples for one-wire bus data calculation
Example 1:Received 40 bit data is
00000010 10010010 00000001 00001101 10100010
Humidity high Humidity low Temperature high Temperature high Check sum
Calculation
00000010+10010010+00000001+00001101=10100010(Check sum)
Received data is correct
Humidity00000010 10010010=0292H(Hexadecimal)= 2×256+9×16+2=658
=> Humidity = 65.8%RH
Temperature00000001 00001101=10DH(Hexadecimal)=1×256+0×16+13=269
=> Temperature= 26.9
Special instructions
When the temperature is below 0 ° C, the highest bit of the
temperature data is 1
Example 1 : -10.1 => 1 000 0000 0110 0101
Temperature: 0000 0000 0110 0101 = 0065H(Hexadecimal) 6×16 +5 = 101
=> Temperature -10.1
Example 2 :received 40 bit data is
00000010 10010010 00000001 00001101 10110010
Humidity high Humidity low Temperature high Temperature high Check sum
Calculation
00000010+10010010+00000001+00001101=1010001010110010
(Check error)
The data received this time is not correct. Give up and
re-receive data.
www.aosong.com Guangzhou Aosong Electronics Co.,Ltd. Tel: 400-630- 5378 Versior:V1. 0
AM2311A Technical Manual
Figure7 One-wire bus communication protocol
Name Single bus format definitio n
START
The microprocessor pulls the data bus (SDA) down for a period of time (at
least 1ms), informing the sensor to prepare the data.
Response
The sensor pulls the data bus (SDA) low by 80µs and pills up by 80µs in
response to the host's start signal.
Data format
Once receipted from the host start signal, the sensor collects 40 bits of
data from the data bus (SDA) at one time, High first out.
Humidity
Humidity resolution is 16Bit, high bit in the former; sensor string out the
humidity value is 10 times the actual humidity value.
Temperature
Temperature resolution is 16Bit, high in the former; sensor string out of the
temperature value is 10 times the actual temperature;
The highest temperature (Bit15) is equal to 1 for negative temperature,
the highest temperature bit (Bit15) is equal to 0 for positive temperature;
Temperature in addition to the most significant bit (Bit14 ~ Bit0) that the
temperature value.
Check Sum
Check SumHumidity high bit+Humidity low bit+Temperature high
bit+Temperature low bit
Table 6 AM2311A communication format specication
5.3 One-wire bus communication timing
The AM2311A switches from Sleep to High Speed mode
when the user host (MCU) sends a start signal (pulls the
data bus SDA low by at least 800μs). After the host start
signal is completed, the AM2311A sends a response
signal and sends 40Bit from the data bus SDA serially.
The high bit of the data is sent first. The data sent is: the
high bits of humidity, the low bits of humidity, the high bits
of temperature, the low bits of temperature, the check
digit. The information is collected after sending data ends
and the sensor is automatically transferred to the sleep
mode until the next A communication comes.
Detailed timing signal characteristics shown in Table 7,
single bus communication timing diagram shown in
Figure 8.
Note: The temperature and humidity data the host read from the AM2311A is
always the previous measurement. If the two measurement interval is very long,
please read twice and use the second measurement value as the value of
real-time temperature and humidity values. While reading ,make sure the
minimum interval between two measurement is 2 Second.
Figure 8 AM2311A Single bus communication timing