rs232tenki-p-sht – instruction manual · 2019. 11. 19. · rs232tenki-p-sht – instruction...

12
RS232Tenki-P-SHT – Instruction manual English version RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 1 / 12

Upload: others

Post on 24-Jan-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: RS232Tenki-P-SHT – Instruction manual · 2019. 11. 19. · RS232Tenki-P-SHT – Instruction manual English version RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 1 / 12

RS232Tenki-P-SHT – Instruction manualEnglish version

RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 1 / 12

Page 2: RS232Tenki-P-SHT – Instruction manual · 2019. 11. 19. · RS232Tenki-P-SHT – Instruction manual English version RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 1 / 12

Table of content1) Specifications.........................................................................................................................................3

1.1) Limiting values..............................................................................................................................31.2) Pressure sensor...............................................................................................................................31.3) Power supply input terminal block................................................................................................31.4) External sensor terminal block.......................................................................................................31.5) RS-232 Connector..........................................................................................................................4

2) Software specifications..........................................................................................................................52.1) Polling an external SHT1x sensor..................................................................................................5

2.1.1) Polling frequency...................................................................................................................52.1.2) Temperature............................................................................................................................52.1.3) Relative humidity...................................................................................................................52.1.4) Error detection........................................................................................................................5

2.2) Serial communications...................................................................................................................52.3) Polling through the serial port........................................................................................................62.4) Dew point computation..................................................................................................................6

3) Protocol..................................................................................................................................................73.1) Definitions......................................................................................................................................73.2) Commands.....................................................................................................................................73.3) Combining commands.................................................................................................................103.4) Behavior in error situations..........................................................................................................103.4) Error detection for RS-232 interface (CRC)................................................................................11

4) History and legal notes........................................................................................................................124.1) Change history.............................................................................................................................124.2) Copyright.....................................................................................................................................124.3) Limited Warranty.........................................................................................................................124.4) Disclaimer....................................................................................................................................12

RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 2 / 12

Page 3: RS232Tenki-P-SHT – Instruction manual · 2019. 11. 19. · RS232Tenki-P-SHT – Instruction manual English version RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 1 / 12

1) Specifications

1.1) Limiting values

Symbol Parameter Min. Typ. Max. Unit

VIN Supply voltage 7 12 17(1) V

ICC Supply current 18 mA

RS232 input voltage -25 25 V

RS232 output voltage 5 5.4 V

Output voltage for external sensor 4.8 5 5.2 V

Maximum current for external sensor 1 (2) 100 mA

VIL Low level input voltage on SDA and SCL 1 V

VIH High level input voltage on SDA and SCL 3 V

VOL Low level output voltage on SDA and SCL 0.9 V

VOH High level output voltage on SDA and SCL 4.2 V

Operating temperature -40 70 °C

Table 1: Electrical and thermal characteristics

1. The overvoltage protection starts acting above 18v.

2. The external sensor output is typically used to supply voltage to an SHT1x type sensor with a current draw of less than 1mA.

1.2) Pressure sensor

• Supports pressures from 15 to 115 kPa

• Maximum error of 1.5% from 0°C to 85°C

• Temperature compensated from -40°C to +125°C

1.3) Power supply input terminal block

Silk screen reference Function

+++ Positive terminal. Refer to Table 1 VIN and ICC parameters for applicable limits.

--- Negative terminal.

Table 2: Power supply terminal block pin-out

1.4) External sensor terminal block

This products supports the connection of an external sensor using a cable of up to 800 cm. Using a

RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 3 / 12

Page 4: RS232Tenki-P-SHT – Instruction manual · 2019. 11. 19. · RS232Tenki-P-SHT – Instruction manual English version RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 1 / 12

shielded cable is recommended to prevent causing interferences or errors due to received interferences.

Silk screen reference Function

GND External sensor negative terminal.

VCC External sensor positive terminal.

SCL Clock signal for external sensor.

SDA Data signal for external sensor.

Table 3: External sensor terminal block pin-out.

• The signal named DATA on a SHT1x sensor must be connected to the SDA signal above.

• The signal named SCK on a SHT1x sensor must be connected to the SCL signal above.

1.5) RS-232 Connector

DB9 Pin Signal name Direction

2 RXD Output

3 TXD Input

5 GND N/A

Table 4: DB9 Connector pin-out

• The is a DCE port. The connection with a DTE host such as a PC does not require a “null modem” cable to be used.

• The connector is a DB9-F using 4-40 fasteners. Pins are gold-plated.

• The RS-232 interface features a protection against electrostatic discharges of ±15kV based on the HBM (“Human-Body Model”).

RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 4 / 12

Page 5: RS232Tenki-P-SHT – Instruction manual · 2019. 11. 19. · RS232Tenki-P-SHT – Instruction manual English version RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 1 / 12

2) Software specifications

2.1) Polling an external SHT1x sensor

2.1.1) Polling frequency

The default is to poll the external SHT1x sensor once approximately 4 seconds (approx.) to make sure the sensor is not active for more than 10% of the time. This helps maintain a greater precision.

This is recommended in the SHT1x datasheet: “Important: To keep self heating below 0.1°C, SHT1x should not be active for more than 10% of the time [...]”

It is possible to enable a fast polling mode if the 4 second interval between updates is not acceptable for a given application.

2.1.2) Temperature

The value received from the SHT1x is converted to °C using the formula and coefficients provided by Sensirion. Please consult the SHT1x datasheet section 4.3 for details.

2.1.3) Relative humidity

The value received from the SHT1x is converted to % using the formula and coefficients provided by Sensirion. Also, for a a greater precision, the result is subsequently temperature-compensated as recommended by the manufacturer. See the SHT1x datasheet sections 4.1 and 4.2 for details.

2.1.4) Error detection

Reads from the sensor are protected using a 8 bit CRC. Refer to the SHT1x datasheet section 3.5 and application note titled “CRC Checksum” from the same manufacturer for implementation details.

2.2) Serial communications

The serial communication with the host is RS-232 compatible. The host must communicate according to the following parameters:

Baud rate 9600

Data bits 8

Stop bits 1

Parity None

Flow control None

RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 5 / 12

Page 6: RS232Tenki-P-SHT – Instruction manual · 2019. 11. 19. · RS232Tenki-P-SHT – Instruction manual English version RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 1 / 12

2.3) Polling through the serial port

The host reads the most recent pressure and temperature readings through the serial port. Request from the host are treated with a high priority. It is recommended to space polls by at least 100ms to prevent slowing down the internal sensor polling loop.

2.4) Dew point computation

The firmware internally computes the dew point using the algorithm below. The host is free to implement its own algorithm.

double getDewPoint(double mbars, double T, double rh)

{

double DPa;

double DPb;

double Es, Ws, W, E, dew;

/* Calculate the saturation vapor pressure */

if (T <= 0) {

// Over Ice (Ei)

DPa = 21.875;

DPb = 265.5;

} else {

// Over Water (Es)

DPa = 17.2695;

DPb = 237.3;

}

Es = 6.1078 * exp((DPa*T) / (DPb + T) );

Ws = 0.62197 * (Es / (mbars - Es));

W = (rh / 100) * Ws;

E = mbars * (W / (W + 0.62197));

dew = (DPb * log( (E / 6.1078) ) ) / (DPa - log( (E / 6.1078) ) );

return dew;

}

RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 6 / 12

Page 7: RS232Tenki-P-SHT – Instruction manual · 2019. 11. 19. · RS232Tenki-P-SHT – Instruction manual English version RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 1 / 12

3) Protocol

3.1) Definitions

In this document, special characters are represented using specific sequences. This is done using the C language convention.

Sequence Signification

\n The ASCII character representing a new line. “Newline”, “Linefeed”, “LF”. Hexadecimal: 0x0A, Decimal: 10.

\r The carriage return ASCII character. (”CR”)Hexadecimal: 0x0D, Decimal: 13.

0x?? Where ?? is a numerical value in hexadecimal notation. I.e.: 0xFF = 255

/* ... */ The /* and */ pairs as well as the characters placed between are comments. They are no transmitted nor received.

3.2) Commands

Code Description

?I\r\n Get the product code, version and serial numberExample:

?I\r\n

RS232Tenki-P-SHT,00,1.0.0,MPROTO01;c32b\r\n

Code Description

?C\r\n Get the transmitted unit types and assigned channels.Example:

?C\r\n

P,Ta,U,Td;000e\r\n

Where the above is interpreted as:• Canal 1: P, atmospheric pressure given in kPa• Canal 2: Ta, air temperature (SHT1x)• Canal 3: U, relative humidity give in % (SHT1x)• Canal 4: Td, the dew point (Based on P, TA and U)

Note:• For a given product, the order does not change. The host is therefore not required to detect and

adapt to different parameter order.

RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 7 / 12

Page 8: RS232Tenki-P-SHT – Instruction manual · 2019. 11. 19. · RS232Tenki-P-SHT – Instruction manual English version RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 1 / 12

Code Description

?A\r\n Get all channels at onceExample:

?A\r\n

100.725, 27.040, 69.522, 21.161;0470\r\n

In case of errors (or external sensor not present), the value 'err' may be returned.?A\r\n

100.725, err, err, err;59bc\r\n

Note:• The dew point channel will read 'nan' if relative humidity falls to 0% (or near).• The type of reading a channel uses can be determined by the ?C\r\n command.

Code Description

?1\r\n Get channel 1 value

?2\r\n Get channel 2 value

?3\r\n Get channel 3 value

?4\r\n Get channel 4 valueExample:

?1\r\n

101.701;9e19\r\n

?2\r\n

26.670;2de7\r\n

?3\r\n

69.530;db2b\r\n

?4\r\n

20.779;467b\r\n

Note:• The type of reading a channel uses can be determined by the ?C\r\n command.• Channels can also be accessed by their names. (See below)

Code Description

?P\r\n Get the atmospheric pressure P in kPa

RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 8 / 12

Page 9: RS232Tenki-P-SHT – Instruction manual · 2019. 11. 19. · RS232Tenki-P-SHT – Instruction manual English version RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 1 / 12

?Ta\r\n Get the air temperature Ta in Celcius (SHT1x)

?U\r\n Get the relative humidity U in % (SHT1x)

?Td\r\n Get the dew point Td (Based on P, TA and U)Example:

?P\r\n

101.810;9138\r\n

?Ta\r\n

26.320;39e2\r\n

?U\r\n

40.733;a614\r\n

?Td\r\n

12.208;ae5e\r\n

Code Description

?fx\r\n Where X has to be 1 or 0. A value of 1 enables fast polling mode. A value of 0 disables it.Example:?f1\r\n /* Enable fast polling mode */

OK\r\n

?f0\r\n /* Disable fast polling mode */

OK\r\n

?f2\r\n /* Error */

ERROR\r\n

Note:• The configured mode will be retained even after a power cycle.• Fast polling mode may slightly increase the temperature of the external SHT1x sensor. This will

have an impact on accuracy.

RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 9 / 12

Page 10: RS232Tenki-P-SHT – Instruction manual · 2019. 11. 19. · RS232Tenki-P-SHT – Instruction manual English version RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 1 / 12

3.3) Combining commands

Several commands can be combined by separating them with a comma. This is particularly useful to read a selection of channels in a single operation in a known order.

Example :

?Ta,Td\r\n /* Air temperature, dew point */

26.350, 12.497;288f\r\n

?Td,Ta\r\n /* Dew point, air temperature */

12.327, 26.340;c91d\r\n

?P,Ta,U,Td\r\n /* All channels: equivalent to ?A\r\n */

101.810, 26.350, 40.883, 12.309;4cf1\r\n

Note:• The full request string may not exceed 16 characters.

3.4) Behavior in error situations

If communication with the external SHT1x sensor fails, the value(s) returned by the channels associated to the SHT1x sensor will by as below:

Example:

?A\r\n

100.725, err, err, err;59bc\r\n /* SHT error */

?Ta\r\n

err;4075

?3\r\n

err;4075

RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 10 / 12

Page 11: RS232Tenki-P-SHT – Instruction manual · 2019. 11. 19. · RS232Tenki-P-SHT – Instruction manual English version RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 1 / 12

3.4) Error detection for RS-232 interface (CRC)

An hexadecimal 16 bit value is affixed to all command answers sent to the host. This value is the CRC-16 of all the answer bytes before the semicolon. The CRC algorithm used is the same as used by the Xmodem protocol. The polynomial is x^16 + x^12 + x^5 + 1 (0x1021) and an initial value of 0 is used.

Here is an example implementation copied from the following page:

http://www.nongnu.org/avr-libc/user-manual/group__util__crc.html

uint16_t crc_xmodem_update (uint16_t crc, uint8_t data)

{

int i;

crc = crc ^ ((uint16_t)data << 8);

for (i=0; i<8; i++)

{

if (crc & 0x8000)

crc = (crc << 1) ^ 0x1021;

else

crc <<= 1;

}

return crc;

}

Here are a few examples that can serve to validate an implementation:

100.725, 26.430, 72.403, 21.216;8b12

100.725, 26.520, 72.418, 21.306;cac3

100.725, 26.550, 72.387, 21.328;295d

100.725, 26.600, 72.322, 21.363;c569

100.616, 26.640, 72.181, 21.370;1092

100.725, 26.650, 72.146, 21.373;b92d

RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 11 / 12

Page 12: RS232Tenki-P-SHT – Instruction manual · 2019. 11. 19. · RS232Tenki-P-SHT – Instruction manual English version RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 1 / 12

4) History and legal notes

4.1) Change history

Ce tableau résume les changements ayant été apportés à ce manuel:Révision Date Description

1,2,3 2012-08-12 Older french only revisions.

4 2012-10-22 First english version.

4.2) Copyright

All content, unless otherwise noted is © 2012 Technologies Dracal inc.

4.3) Limited Warranty

Dracal technologies inc. warrants the product RS232Tenki-P-SHT to be free of defects in materials and workmanship for a period of one (1) year following purchase by the original owner. Normal wear as well as any defect caused by an incorrect installation, misuse, unauthorized product modifications or natural disasters are not covered by this warranty. Should a defect covered by this warranty occurs during the above mentioned one (1) year period, Dracal technologies inc. liability will be limited to replacing or repairing the item according to the specific circumstances.

4.4) Disclaimer

Dracal technologies inc. cannot be held responsible or liable in case of direct or indirect damage caused by the use of this product. The liability of Dracal technologies inc. will always be limited to replacing or repairing its product if the defect is covered by the limited warranty.

RS232Tenki-P-SHT, Instruction manual, rev. 4 Page 12 / 12