Digital Temperature and Humidity Sensor: AM2320 Product Manual
Digital Temperature and Humidity Sensor: AM2320 Product Manual
Digital Temperature and Humidity Sensor: AM2320 Product Manual
Product Features:
Ultra-small size
Super cost-effective
2. Applications
HVAC, dehumidifiers, testing and inspection equipment, consumer goods, automotive,
automation, data loggers, gas stations, home appliances, humidity control, medical, and other
relevant humidity measurement and control.
3. Product Highlights
Completely interchangeable, low-cost, long-term stability, relative humidity and temperature
measurement, long distance signal transmission, the digital signal output, precise calibration, low
power consumption, standard single-bus digital interface standard I2 C bus digital interface,
communication free choice.
-1-
Figure 1 : AM2320 every inch form factor
External Interface: 1: VDD 2: SDA 3: GND 4: SCL
5. Sensor performance
5.2 Temperature
Table 2: AM2320 relative temperature performance table
6. Electrical Characteristics
Electrical characteristics, such as high energy consumption, low level, input and output voltage,
etc., depending on the power supply. Table 3 details the AM2320 electrical characteristics, if not
marked, it means that the power supply voltage of 5V. If you want to get the best results with the
sensor, please designed in strict accordance with please and conditions in Table 3 and Figure 27 and
Figure 14 Design.
Table 3: AM2320 DC Characteristics
parameter condition min typ max unit
① This accuracy is tested at the factory, and the
Supply Voltage 3.1 5 5.5 v
sensor at 25 ℃ precision ind
Dormancy 8 10 µA
conditions tested, it does not include hysteresis and
Power Consumption Measure 950 µA
non-linear, and only suitable for non-condensing
Average 350 µA
5
environment.
Low-level output voltage I CC 0 300 MV
② At 25 ℃
/ sand
air 1m
flow conditions, to a
High-level output voltage R p<25 kΩ 90% 100% VDD
first order effect 63% of the time to be needed.
Low-level input voltage 0 30% VDD
③ values in the volatile organic compounds may
High-level input voltage 70% 100% VDD
be higher. See the manual application store
6 VDD = 5V 30 45 60 kΩ
Rpu information.
VIN = VSS ④This value is VDD = 5.0V at a temperature of
Output Current 8 MA 25 ℃, 2S /Times, the average c
10 20 µA ⑤Low-level output current.
Sampling period 2.0 s ⑥show the resistor.
7. Interface Definition
2
Figure 5: I C typical configuration
Term Description
Transmitter Send data to the device bus
Receptor Device receiving data from the bus
Host computer Transmit clock signal generating device initialization and termination sent
Slave The device addressed by the host
At the same time there is more than one host attempts to control the bus,
Multi-master
but do not destroy the message
There is a multiple hosts at the same time try to control the bus, but only
Arbitration allows it a control bus and make the message is not destroyed in the
process
Synchronous Two or more devices in the process of synchronizing the clock signal
◎Data validity
Data line SDA data must remain stable during the high period of the clock. High or low state
of the data line SDA is only in the low period of SCL clock line only allowed to change. But at the
start and end I 2 C bus exceptions (for details see the start and stop conditions). Some other serial bus
data as may be required valid edge (rising or falling) of the clock signal, but I 2 C bus is valid level.
The specific timing diagram shown in Figure 6.
-6-
Figure 7: Schematic start and stop conditions
◎I 2 C-bus response
In the I 2 C bus data transfer process, one byte per transmission, must acknowledge with a status
bit. Receiving reception data to inform the transmitter can acknowledge bit. Acknowledge bit hosts
still generated clock pulse, and acknowledge the state of the bit data follow the principle of "Who
receives who produce", that always generates acknowledge bit by the receiver, the receiver clock
pulse response during the SDA line must be low, making it a high level during this clock pulse is
stable low (see Figure 9), of course, setup and hold times must be considered (for details please refer
to table 6). When sending data from the host to the machine, generating an acknowledge bit from the
slave; master data received from the slave, the master generates an acknowledge bit.
I 2 C bus standards: Acknowledge bit 0 indicates the receiver acknowledge (ACK), often
abbreviated as A; it is a representation of non-response (NACK), often abbreviated as NA. The
transmitter then sends LSB, should release the SDA line (pull SDA), in order to wait for the receiver
generates an acknowledge bit.
If the receiver is receiving at the time of completion of the last byte of data, or can’t receive
more data should be generated to notify the non-response signal transmitter. If you find a receiver
transmitter generates a non-responder status, you should send a termination.
-7-
C bus Response: 9 Figure
◎Slave Address
I 2 C bus does not additional address decoder and chip select signals. Multiple with I 2 C bus
interface devices can be connected to the same I 2 C bus, through the device address to distinguish
between them. I 2 C bus addressing procedure is usually starting at the first byte determines the
conditions to choose which one from the host machine, the seven addressable address (the other is a
10-bit addressing addresses differ the sensor uses seven addressable address). Bit of the first byte of
the definition shown in Figure 10, the first byte of the first seven constitute the slave address, the
least significant bit (LSB) is the first 8. It determines the direction of the packet, the lowest bit of the
first byte (LSB) is "0": Indicates that the host will write information to the selected slave; "1"
indicates that the host will read information from the machine to.
-8-
Figure 11: C bus master sends the data to the machine from the basic format
2
Figure 12: I C bus master basic format for receiving data from a machine
8.2 AM2320 sensor I 2 C communication protocol
AM2320 serial interface for the I 2 C bus, in full accordance with I 2 C standard protocols
addressing, can be directly linked to the I 2 C bus. AM2320 sensor I 2 C address of the c(SLAVE
ADDRESS) 0xB8, on the basis of I 2 C standard protocol on the bus, based on Mod Bus protocol,
developed a unique communication protocol, reducing the transmission error rate. When micro
controller read AM2320 sensors strict accordance with AM2320 sensor I 2 C -Mod Bus
communication protocol design and timing.
8.2.1 I 2 C Interface Description
AM2320 digital temperature and humidity sensor as a communication from the machine, and
the host (user microprocessor) between uses the standard I 2 C bus mode. For the accurate
measurement of humidity, temperature and humidity to reduce the impact of, AM2320 sensors
during non-working, automatically become dormant, in order to reduce public consumption, to
reduce the impact sensor self-heating of the ambient humidity values. AM2320 uses passive mode,
which hosts the wake sensor by instruction, and then send the appropriate commands to read the
appropriate temperature and humidity values; After the communication, the sensor triggers a
temperature and humidity acquisition; Therefore, if there is no time to read the sensor, please read
two consecutive second sensor (minimum interval of two reads 2s), is the latest in a second
measurement; after the acquisition sensor automatically become dormant. The next time you need to
read the host sensor, sensors need to reawaken. It should be noted that the host communication from
start to finish, for a maximum of 3s. If communication is not completed within 3s, sensors
automatically end communication, automatically become dormant again as the host read sensors,
needed to re-send a wakeup command.
8.2.2 interface Features
This section describes the I 2 C interface characteristics AM2320 sensor, if you want to get the
-9-
best communication with the sensor results, designed in strict compliance with the conditions of
Figure 13 and Table 6 design.
Figure 1 13 3: AM2320 typical application circuit I2C bus and timing diagram
Table 6 : AM2320 sensor C interface characteristics
Standard C mode
Symbol Parameters Unit
min Max
SCL clock frequency 100 kHz
T w (SCLL) SCL Clock low time 4.7
μs
T w (SCLH) SCL Clock high time 4.0
T s u (SDA) SDA Settling time 250
T h (SDA) SDA Data hold time
T r (SDA)
SDA and SCL Rise time 1000 ns
T r (SCL)
T f (SDA)
SDA and SCL Fall Time 300
T f (SCL)
T h (STA) Start condition hold time 4.0
μs
T s u (STA) Repeated Start condition setup time 4.7
T s u (STO) Stop condition setup time 4.0 μs
T w (STO:STA) Stop to Start condition time (bus idle) 4.7 μs
Cb Capacitive load for each bus 400 PF
Register Address Register data Data Description Register Address Register data Data Description
0x00 0x01 High humidity 0x02 0x00 High temperature
0x01 0XF4 Low humidity 0x03 0xFA Low temperature
- 12 -
Number of registers 1 0x04 Read the number of register
Numerical calculation:
From the temperature and humidity sensor value is read back, as long as the value into decimal
number 10 is divided by the corresponding values of temperature and humidity, corresponding
temperature unit ℃, humidity unit is% RH. Such as the above data read back:
Humidity: 01F4 = 1×256+15×16+4 =500 => humidity = 500÷10=50.0%RH;
Temperature: 00FA= 15×16+10 = 250 => temperature = 250÷10 = 25.0℃ Note: CRC
verification code calculated by the CRC code drawn, then the sensor on the transmission of CRC
codes ratio; same, then that data is received correctly, otherwise that data has errors.
2. Function code "10": Write multiple registers to sensor
Host code can use this feature to save multiple data storage sensor. Single AM2320 sensor
register is a byte, or 8 bits. Sensor allows you to save a maximum of 10 data registers. Thus, the
single most host to the sensor to save up to 10 registers. Over 10, the sensor will return the
corresponding error code.
The host sends the write frame format:
START + (I 2 C address + W) + function code (0x10) + start address register number + save data
+ CRC + STOP
The host reads the confirmation instruction:
START + (I 2 C address + R) + read sensor data returned + STOP
Sensor response frame format:
Function code (0x10) + start address + number + CRC register
For example: The host should be saved to address 10,11 ,01,02 sensors to register.
Host message format sent:
The host sends Byte count Transmitting information Remarks
Sensor address 1 0XB8 Sensor C address (0xB8) + W (0)
Function Code 1 0x10 Write Multiple Registers
Starting address 1 0x10 Start address of the register to be written
- 13 -
Save word length 1 0x02 Save the data word length (2 words)
Save Data1 1 0x01 Save the data (address: 10)
Save Data2 1 0x02 Save the data (address: 11)
Host calculated CRC code, low byte first(C
CRC code 2 C092
addresses are not included in the CRC calculation)
◎CRC checksum
Host or sensors available checksum discriminate receiving information is correct. As electronic
noise or some other interference during the transmission of information is sometimes an error occurs,
the error check code (CRC) can test the host or sensor information in the communication data
transfer process is wrong, wrong data can give (either sending or receiving), thus increasing the
safety and efficiency of the system.
CRC I 2 C-Mod Bus communication protocol (cyclic redundancy code) contains two bytes, or
16-bit binary number. CRC code by the sending device (host) calculations, send the information
placed in the rear frame, I 2 C address is not included in the CRC calculation. Whether sending or
receiving CRC are by the low byte first, high byte format for transmission in the post. Receiving
information on the device (sensor) to recalculate the information received CRC, the CRC is
calculated by comparing the received query, and if they do not match, then the error. Users need
special attention, reading sensor command without adding the CRC; writing sensors must be added
the CRC; and all the return data are CRC.
◎CRC code calculation method
1. Preset a 16-bit register hexadecimal FFFF (including 1); said this register for the CRC
register;
2. The low (first byte frames both communications and information) first 8-bit binary data
with 16-bit CRC register eight or different, the results put in CRC register;
3. The contents of the CRC register right one (towards low) with zeros to fill the highest
position, and check out bit right after;
4. If the bit is 0 out: Repeat steps (the right one again) 3; If the bit is shifted 1: CRC register
with the polynomial A001 (1010 0000 0000 0001) XOR;
5. Repeat steps 3 and 4 until the right eight times, so that the entire eight were processed all
the data;
6. Repeat steps 2 through 5, the communication of information to the next frame byte
processing;
7. The communication message frame after all the bytes calculated according to the above
steps completed, the high and low byte of the resulting 16-bit CRC register exchange;
8. The resulting CRC register contents is: CRC code.
- 14 -
◎CRC calculation code in C language code
Description: This program to calculate the length len * ptr bytes before the CRC.
unsigned short crc16(unsigned char *ptr, unsigned char len)
{
unsigned short crc =0xFFFF;
unsigned char i;
while(len--)
{
crc ^=*ptr++;
or(i=0;i<8;i++)
{
if(crc & 0x01)
{
crc>>=1;
crc^=0xA001;
}else
{
crc>>=1;
}
}
}
return crc;
}
2
Figure14: I C sensors read the complete example of fig
- 15 -
◎I 2 C read and write timing decomposition
Sensors read or write, you must follow these three steps, otherwise it will not communicate or
can’t read the correct data:
Step one: Wake Sensor
In order to reduce the humidity sensor errors caused by self-heating, the sensor in a
non-working state, dormant, so to read the sensor must wake sensor to transmit commands to read
and write, otherwise the sensor will not respond. It should be noted that, in the wake sensor, I 2 C
address is sent, the sensor does not respond to ACK, but the host must send back an ACK clock
verify that the ninth SCL clock signal. Wake sensor operation is following instructions:
After the host sends a start signal is applied to the starting address, wait for sometime (waiting
time of at least 800 μs, the maximum 3ms; such as host hardware I 2 C, you do not need to wait for
the hardware I 2 C will automatically wait), and then sends a stop signal.
Namely: the starting signal +0 xB8 + wait (> 800us) + stop signal timing diagram shown in
Figure 15.
issued after the completion of I 2 C address, wait at least 30μs and then sent over the next serial
clock, reading data, or communication error occurs.
- 16 -
Figure 17: Read the sample temperature and humidity values
- 17 -
2
Figure18: The I C read sensor flowchart
2
Tables Table 1: I C_MODBUS communication protocol summary table
2
Read Bus Description: I C address is 0xB8; access a maximum of 10 registers;
- 18 -
information ess information ess information ess informatio ss
n
High Users register a
0x00 Model High 0x08 0x10 Retention 0x18
humidity high
Users register a
Low humidity 0x01 Model Low 0x09 0x11 Retention 0x19
low
High
Users register 2
temperatur 0x02 The version number 0x0A 0x12 Retention 0x1A
high
e
Low
Device ID (24-31) Users register 2
temperatur 0x03 0x0B 0x13 Retention 0x1B
Bit low
e
Device ID (16-23)
Retention 0x04 0x0C Retention 0x14 Retention 0x1C
Bit
Device ID (8-15)
Retention 0x05 0x0D Retention 0x15 Retention 0x1D
Bit
Retention 0x06 Device ID (0-7) Bit 0x0E Retention 0x16 Retention 0x1E
Retention 0x07 Status Register 0x0F Retention 0x17 Retention 0x1F
Status Register Definition: Bit7-Bit0 bit reserved;
Temperature Format: Temperature highest bit (Bit15) is equal to 1 indicates a negative temperature,
the temperature highest bit (Bit15) is equal to 0 indicates a positive temperature;
temperature in addition to the most significant bit (Bit14 ~ Bit0) indicates the temperature
sensor string value. Temperature sensor value is a string of 10 times the actual humidity
value;
Write Sensor: For users to write register (0x0F ~ 0x13); prohibit write other registers and status
registers can only be written separately.
Reader sample:
Functi Start
Function on addres Frame data content
Code s
Read the Send:(SLA+W)+0x03+0x00+0x04
temperature and 0x03 0x00 Return:0x03 +0 x04 + humidity + high + low temperature and
humidity humidity high temperature low + CRC
Read the Send:(SLA+W)+0x03+0x02+0x02
0x03 0x02
temperature Return:0x03+0x02+High temperature + low temperature+ CRC
Send:(SLA+W)+0x03+0x00+0x02
Read humidity 0x03 0x00
Return:0x03+0x02+High humidity+ Low humidity + CRC
Send:(SLA+W)+0x03+0x08+0x07
Reading Device
0x03 0x08 Return:0x03+0x07+Model (16) + version number (8) + ID
Information
(32-bit)+CRC
Write Status Send:(SLA+W)+0x10+0x0F+0x01+0x01+0xF4(Low)+0xB7(High)
0x10 0x0F
Register Note:Function code + register start address + register number
- 19 -
+ save content+ CRC
Return:0x10+0x0F+0x01+0xB4(Low Byte)+0x35(High Byte)
Note:Function code + number + register start address register+
CRC
Note: SLA = I2C address 0xB8. Table CRC parity bit, CRC was 16, the low byte first, high byte。
Return error code: 0x80: not support function code 0x81: Read an illegal address 0x82:
write data beyond the scope
0x83: CRC checksum error 0x84: Write disabled.
- 20 -
AM2320 device uses a simplified single-bus communication. Single bus that only one data line,
the data exchange system, the control by the data line is completed. Device (microprocessor) through
an open-drain or tree-state port is connected to the data line to allow the device when not
transmitting data to release the bus, and let other devices use the bus; single bus usually requires an
external 5.1kΩof approximately pull-up resistors, so that when the bus is idle, the state is high.
Because they are master-slave structure, only when the host calls the sensor, the sensor will be
answered, so the host access to the sensor must strictly follow the sequence of a single bus, if there is
a sequence of confusion, the sensor will not respond to the host.
◎Single bus transfer data definitions
SDA and AM2320 microprocessors for communication and synchronization between using single
bus data format, a 40-bit data transfer, high first-out. , The communication format specific
communication sequence shown in Figure 20 are shown in Table 9.
Response signal Sensor data bus (SDA) low 80μs, 80μs followed by a high signal in response to the initial host
Upon receipt of the host start signal from the data bus disposable sensor (SDA) string of 40-bit data, the high
Data Format
first-out
Humidity resolution is 16Bit, the previous high; strings out of the humidity sensor is 10 times the actual
Humidity
humidity values.
Temperature resolution is 16Bit, the previous high; sensor string temperature value is 10 times the actual
temperature value;
Temperature Temperature highest bit (Bit15) is equal to 1 indicates a negative temperature, the temperature highest bit
(Bit15) is equal to 0 indicates a positive temperature;
In addition to the temperature of the highest bit (Bit14 ~ Bit0) indicates the temperature value.
Parity bit Parity bit = humidity high temperature + humidity + high + low temperature low
[1] For details, see 7.3
◎ Single bus data sample calculation
Example 1: 40 of the received data:
0000 0010 1001 0010 0000 0001 0000 1101 1010 001
High humidity 8 Low humidity 8 High temperature 8 Low temperature8 Parity bit
Calculated as follows:
0000 0010+1001 0010 +0000 0001+0000 1101= 1010 0010 (Parity bit)
Receive data is correct:
Humidity:0000 0010 1001 0010 = 0292H (hex) = 2×256 + 9× 6 + 2 = 658 => Humidity =
65.8% RH
- 21 -
Temperature:0000 0001 0000 1101 = 10DH (hex) = 1×256 + 0×16 + 13 = 269
=> Temperature = 26.9 ℃
◎ Special Instructions:
When the temperature is below 0 ℃ temperature data for a top position.
Example One: -10.1 ℃ expressed as 1,000,000,001,100,101
Temperature: 0000 0000 0110 0101 = 0065H (hex) = 6×16 +5 = 101
=> Temperature = -10.1 ℃
Example Two: The received data 40:
0000 0010 1001 0010 0000 0001 0000 1101 1011 0010
High humidity 8 Low humidity 8 High temperature 8 Low temperature8 Parity bit
Calculated as follows:
0000 0010+1001 0010 +0000 0001+0000 1101=1010 0010≠1011 0010 (Parity error)
The received data is not correct, give up, again receiving data.
8.3.3 Single-bus communication timing
Hosts (MCU) sends a start signal (data bus SDA low for at least 800μs) After, AM2320
transition from sleep mode to high-speed mode. After completion, the master start signal, AM2320
transmit a response signal, the data sent from the data bus 40Bit SDA serial high byte is transmitted
first; data is sequentially transmitted high humidity, low humidity, high temperature, low temperature,
the parity bit , sent a message to trigger the end of data collection, collecting sensor automatically
transferred to the end of the sleep mode until the next traffic coming
Detailed timing signal characteristics are shown in Table 10, a single bus communication
timing diagram shown in Figure 21.
- 22 -
T en Sensor releases the bus time 45 50 55 µS
Note: To ensure quasi-sensor indeed communication, the user reads the letter when number,
strictly in accordance with table 10 and the parameters in figure 21 program design.
8.3.4 Peripheral reading step example
Communication between the host and the sensor reads the data can be done through the
following three steps.
Step One:
AM2320 after power (power after AM2320 2S to wait to cross the unstable state, during the
reading device can not send any commands), test environment temperature and humidity data, and
record the data, then the sensor automatically transferred to a dormant state. The SDA data line
AM2320 by resistance and pulling high has been to maintain a high level, then the AM2320 SDA pin
is in the input state, always detect external signals.
Step Two:
Microprocessor I / O is set to output, while the output low and low retention time can’t be less
than 800us, typical values are pulled 1MS, then the microprocessor I / O is set to enter the state, the
release of the bus, Since the pull-up resistor, the microprocessor I / O data lines that AM2320 the
SDA also will go high, and so the host releases the bus, AM2320 sends a response signal, the output
low as 80 microseconds response signal, followed by 80 microsecond high output peripheral is ready
to receive data notification signal transmitter 22 shown in fig.
- 23 -
Figure 23: Single-bus timing diagram decomposition
Data bus SDA AM2320 output 40-bit of data , the continued output low 50 microseconds
after the entry into the state, due to the pull-up resistor attendant goes high. Meanwhile AM2320
retest internal temperature and humidity data, and record data, test recording ends, the micro
controller automatically goes to sleep. Only after receipt of the start signal micro controller host,
only to re-awaken the sensor, enter the working state.
8.3.5 Peripheral read flowchart
AM2320 sensor reads a single bus flowchart diagram shown in Figure 24, we also provide
sample code reads C51, need to download the client, please visit our website (www.aosong.com)
associated download, this manual does not provide code description.
On the sensor
initialization
Reading device
sends a start signal
No response signal
Release the bus waiting for the sensor
response signal
There are a
response signal
Continuous reading
device to read 40 data
Parity error
Data validation
Correct parity
Update temperature
and humidity values
Wait (fixed
acquisition cycle)
No
Yes
9. Application Information
1. Work and storage conditions
The proposed scope of work may result in up to 3% RH temporary drift of the signal. Return
to normal working conditions, the sensor calibration status will slowly recover. To speed up the
recovery process can be found in "recovery process." The use of the product will accelerate the aging
- 24 -
process for a long time under abnormal operating conditions.
Avoid placing components on a long-term condensation and dry conditions and the following
environment.
A, salt spray
B, the acid or oxidizing gases such as sulfur dioxide, hydrochloric acid
Recommended Storage Environment
Temperature: 10 ~ 40 ℃ Humidity: 60% RH or less
2. Effects of exposure to chemical substances
Capacitive humidity sensor sensing layer will be disturbed chemical vapors, chemical diffusion
layer in the sensor may cause drift and measurement sensitivity. In a clean environment, slowly
release contaminants out. The recovery process described below to accelerate the process. High
concentrations of chemical pollution can cause damage to the sensor sensing layer completely.
3. Temperature Effect
Relative humidity of the gas, is largely dependent on temperature. Therefore, when measuring
the humidity should be possible to ensure that the humidity sensor works at the same temperature. If
you share a printed circuit board with electronic components heat released in the sensor should be
installed as far as possible away from the electronic components, and installed at the bottom of the
heat source, while maintaining a well-ventilated enclosure. To reduce the thermal conductivity sensor
and a copper plating layer of the printed circuit board should be as minimal other portions, and
leaving a gap between them.
4. Light effects
Prolonged exposure to sunlight or strong ultraviolet radiation, will reduce performance.
5. Recovery process
Placed under extreme operating conditions or chemical vapor sensors, through the following
process, you can return it to the state calibration. 2 hours at 45℃ and < 10% RH humidity
conditions(Hong Gan); then at 20-30 ℃ and> 70% RH humidity under conditions remain more
than 5 hours.
6. Wiring Precautions
Affects the communication quality of the signal wire distance and communication quality, we
recommend using a high quality shielded cable.
7. Soldering Information
Manual welding, at a temperature of 300 ℃ maximum contact time must be less than 10
seconds.
8. Product upgrades
For details, please consult our technical department.
The company only for those applications where the product meets the technical conditions
arising from defective product. Company for its products in those particular applications without any
guarantee, warranty or written statement. The company applied to the product or its products
reliability of the circuit does not make any promises.
- 26 -