Instructions for Use of RS485 Temperature &
Humidity Sensor
Introduction
This is a high-precision industrial-grade RS485 temperature and humidity sensor. It
uses high-quality digital integrated transducer and reliable digital processing
circuit to convert the temperature and humidity in the environment into
corresponding RS485 signals. And it can reliably carry out centralized monitoring
jobs with the host computer system.
Featuring a wide measurement range, a high detection accuracy and a fast
response speed, the module supports temperature detection of -40 to 120 degrees
and humidity detection of 0 to 99.9% RH. Fully wrapped by the aluminum alloy
shell, the sensor is waterproof and heat resistant, which makes it suitable for harsh
environments. Besides, its probe employs a breathable and dust-proof design that
effectively protects the internal circuit board and prolongs the service validity
period.
The product has remarkable long-term stability, low latency, high resistance to
chemical pollution and superior repeatability. It is an ideal solution for accurately
measuring relative humidity and temperature in HVAC(Heating, ventilation, and air
conditioning) applications. This sensor can be widely used in building automation,
climate and HVAC automatic control, climatology stations in museums and hotels,
closed-loop control of HVAC systems, etc.
Specification
Temperature Measurement Range: -40 ~ 120℃
Humidity Measurement Range: 0 ~ 99.9%RH
Temperature Accuracy: ± 0.3°C (25°C)
Humidity Accuracy: ± 2%RH (25℃)
Sampling Cycle Period: 3 sec
Power Supply Voltage: 12 ~ 36V (DC)
Product Size: 200mm(L) × 15.7mm(D) / 7.87×0.62 inch
Output Signal: RS485 signal
Communication Protocol: standard MODBUS RTU protocol
Baud Rate: 9600 (default)
Display Resolution: Temperature: 0.1℃; Humidity: 1%RH
Sensitivity Attenuation Value: temperature < 0.1 ℃ /year; humidity <
0.5%RH/year
Pinout
Lead line Name Description
① A+ Yellow: FG6485 A end
② V+ Red: Power supply positive input
③ GND Black: Power supply negative input
④ B- White: FG6485 B end
① Yellow
② Red
③ Black
④ White
Wiring Diagram
RS485 Communication Protocol
1. Internal Register Mapping Address
Register Address Register Address
information information
Humidity 0x0000 Device model 0x0008
Temperature 0x0001 Version number 0x0009
(lower 8 bits)
Reserve 0x0002 Device ID high 16 0x000A
bits
Reserve 0x0003 Device ID low 16 0x000B
bits
Reserve 0x0004 Temperature 0x000C
upper limit alarm
value
Reserve 0x0005 Temperature 0x000D
upper limit alarm
enable
Reserve 0x0006 Temperature lower 0x000E
limit alarm value
Reserve 0x0007 Temperature lower 0x000F
limit alarm enable
Humidity upper limit 0x0010 Reserve 0x0018
alarm value
Humidity upper limit 0x0011 Reserve 0x0019
alarm enable
Humidity lower limit 0x0012 Reserve 0x001A
alarm value
Humidity lower limit 0x0013 Reserve 0x001B
alarm enable
Reserve 0x0014 Reserve 0x001C
Reserve 0x0015 Temperature correction 0x001D
value update
Reserve 0x0016 Humidity correction 0x001E
value update
Reserve 0x0017 Reserve 0x001F
2. Supported function codes
0x03: read multiple registers
0x10: write multiple registers
Read command:
Host frame format
Transmitter address + 0x03 + register start address (2 bytes) + number of registers
(2 bytes) + CRC low bit + CRC high bit
Transmitter return format
Transmitter address+0x03+number of bytes returned (1 byte)+data 0+..+data
n+CRC low bit+CRC high bit
Write command:
Host frame format
Transmitter address + 0x10 + register start address (2 bytes) + number of registers
(2 bytes) + number of bytes sent (1 byte) + data 0 +... + data n + CRC low bit + CRC
high bit
Transmitter return format
Transmitter address + 0x10 + register start address (2 bytes) + number of registers
(2 bytes) + CRC low bit + CRC high bit
Instructions for writing function codes:
1. In the internal register mapping address, only the addresses 0x000C-0x001E can
be written, and others are prohibited.
2. In address 0x000C-0x001B, if the host data writing is out of the range or not in
accordance with the control logic, the transmitter register will not update the
values but keep the original values.
3. 0x001C, 0x001d, 0x001E, the three registers, will be limited to boundary values if
they exceed the range.
4. The host should send the actual value magnified 10 times to change decimal into
integer.
3. Error code prompt
0x81 illegal function code (unsupported function code)
0x82 read illegal address
0x83 write illegal data (write to an unwritable register address or write-forbidden
transmitter)
4. Examples for communication read instruction
The format of the message sent by the host: 01 03 00 00 00 02 C4 0B. The
following table is an introduction to the function codes:
Send by Host Number of bytes Message to send Remarks
Slave address 1 01 Send to the slave
with address 01
Function code 1 03 Read register
Initial address 2 0000 Start address is
0000
Read Number of 2 0002 Read 2 registers, a
registers total of 4 bytes
CRC code 2 C40B The CRC calculated
by the host, the
low byte first(C4)
and high byte
behind(0B)
The message format returned by the product response: 01 03 04 Humidity (16 bits)
Temperature (16 bits) CRC check code
The following table is an example of returning a set of temperature and humidity
data: 01 03 04 01 D7 00 D6 CA 69
Slave response Number of bytes Message returned Remarks
Slave address 1 01 Data from address
01
Function code 1 03 Read the register
Number of bytes 1 04 Returned 4
returned registers, total 4
bytes
Register 0 high 1 01 The content of
byte address 0x00
(humidity high
byte)
Register 0 low byte 1 D7 The content of
address 0x00
(humidity low
byte )
Register 1 high 1 00 The content of
byte address 0x00
(temperature high
byte)
Register 1 low byte 1 D6 The content of
address 0x00
(temperature low
byte )
CRC code 2 CA69 The returned CRC
calculated by the
slave, the low
byte first(CA)
Temperature and humidity output format and calculation example
The temperature and humidity resolution are 16-Bit, and the temperature and
humidity are output in the actual positive and negative format, and the numerical
value is 10 times the actual temperature and humidity value;
Humidity: 01D7 = 1×256+13×16+4= 471 => Humidity = 471÷10=47.1%RH
Temperature: 00D6 = 13×16+6= 214 => Temperature = 214÷10 = 21.4℃
Calculation of CRC code
1. Preset a 16-bit register as hexadecimal FFFF (that is, all 1); call this register CRC
register;
2. The first 8-bit binary data (that is, the first byte of the communication
information frame) XOR the lower 8 bits of the 16-bit CRC register, and then put
the result in the CRC register;
3. Shift the contents of the CRC register one bit to the right (towards the low bit)
and fill the highest bit with 0, and check the shifted bit ;
4. If the shifted bit is 0: repeat step 3 (shift one bit to the right again); if the shifted
bit is 1: the CRC register XOR the polynomial A001 (1010000000000001);
5. Repeat steps 3 and 4 until you move 8 times, so that the entire 8-bit data is
processed;
6. Repeat steps 2 to 5 to process the next byte of the communication information
frame;
7. After calculating all the bytes of the communication information frame according
to the above steps, exchange the high and low bytes of the resulting 16-bit CRC
register;
8. The final content of the CRC register is: CRC code.
CRC Code Calculation Program in C Language
Note: This program calculates the CRC code of the bytes of first len length in * ptr.
unsignedshortcrc16(unsignecdhar*ptr, unsignedcharlen)
{
unsignedshortcrc=0xFFFF;
unsignedchari;
while(len--)
{
crc ^=*ptr++;
for(i=0;i<8;i++)
{
if(crc& 0x01)
{
crc>>=1;
crc^=0xA001;
}else
{
crc>>=1;
}
}
}
returncrc;
}
Code Description
Set slave address: Each terminal should have an address according to the ModBus-RTU
Protocol. Follow the steps below to disassemble the product, then you can use the
8-digits DIP switch inside to set the communication address as per your needs.
Calculation: the DIP digits1~8 respectively correspond to number 1, 2, 4, 8, 16, 32,
64, 128(as shown in the figure above); Add all the values corresponding to the DIP
digits 1-8 dialed to NO , that is the value of the address code. For example:
Figure 1 Figure 2 Figure 3
In figure 1, address=1 (Only DIP digit 1 is dialed to ON, and it corresponds to number 1,
so the address is 1.)
In figure 2, address=2(Only DIP digit 2 is dialed to ON, and it corresponds to number 2,
so the address is 2.)
In figure 3, address=13 (DIP digits 1, 3, 4 are dialed to ON, so the address should be:
1+4+8=13.)
Note: Turn off the transmitter before selecting measurement range by jumper.