The SM50 sensor board’s digital information output is based on the following serial protocol. You can use the protocol to develop your own programme/digital interface.
The commands are specified by Aeroqual Limited, all rights reserved. Aeroqual reserves the right to change the protocol without notification.
Note: The serial protocol is a proprietary binary protocol and is not ASCII. Hence a terminal program can’t be used to communicate with the SM50.
Communication settings and data representations
All floating point data values use IEEE754 32 bit floating point with little endian representation.
Port | RS232 port | RS485 port (2 wire) |
---|---|---|
Baud rate | 9600 | 4800 |
Data bits | 8 | 8 |
Stop bits | 1 | 1 |
Parity | None | None |
Flow control | None | None |
Commands
This section details the communication commands used to transmit and receive information from the SM50 board.
Data request
The SM50 sensor data report. The data report frequency varies with sensor.
This command behaves differently when using RS232 vs. RS485.
- When using RS232 the data report occurs automatically once per cycle (approx. once every 70 seconds). The SM50 board does not have to be polled when using RS232.
- When using RS485 the data report occurs only in response to a request command. The SM50 board does have to be polled when using RS485.
This request command has 4 different reply types. The data report reply occurs only once per cycle (approx. once every 70 seconds). If the SM50 is polled more frequently the other RESERVED replies will be received. These can be ignored.
Request command: DATA REQUEST
Length: 4 bytes
Position | Size | Name | Value | Format |
---|---|---|---|---|
0 | 1 byte | RECEIVER | 0x55 | |
1 | 1 byte | DATA REQUEST | 0x1A | |
2 | 1 byte | RESERVED | 0x00 | |
3 | 1 byte | CHECKSUM | 0x91 = 0x00 – (B0 + B1 + B2) | UINT8 |
Reply command 1: DATA REPORT
Length: 15 bytes
Position | Size | Name | Value | Format |
---|---|---|---|---|
0 | 1 byte | SENSOR | 0xAA | |
1 | 1 byte | DATA REPORT | 0x10 | |
2 | 4 bytes | DATA1 | Gas concentration in ppm | IEEE754 float |
6 | 6 bytes | RESERVED | ||
12 | 1 byte | STATUS1 | b1b0 = 00; Sensor OK b1b0 = 01; Sensor failure b1b0 = 11; Sensor aging | Only bits 1 and 0 are used to show status. Bits 2-7 can be ignored. |
13 | 1 byte | RESERVED | 0x00 | |
14 | 1 byte | CHECKSUM | CS = 0x00 – (B0 + … + B13) | UINT8 |
Reply command 2: RESERVED
Length: 15 bytes
Position | Size | Name | Value | Format |
---|---|---|---|---|
0 | 1 byte | SENSOR | 0xAA | |
1 | 1 byte | RESERVED | 0x1A | |
2 | 12 bytes | RESERVED | ||
14 | 1 byte | CHECKSUM | CS = 0x00 – (B0 + … + B13) | UINT8 |
Reply command 3: RESERVED
Length: 15 bytes
Position | Size | Name | Value | Format |
---|---|---|---|---|
0 | 1 byte | SENSOR | 0xAA | |
1 | 1 byte | RESERVED | 0x0E | |
2 | 12 bytes | RESERVED | ||
14 | 1 byte | CHECKSUM | CS = 0x00 – (B0 + … + B13) | UINT8 |
Reply command 4: RESERVED
Length: 15 bytes
Position | Size | Name | Value | Format |
---|---|---|---|---|
0 | 1 byte | SENSOR | 0xAA | |
1 | 1 byte | RESERVED | 0x0F | |
2 | 12 bytes | RESERVED | ||
14 | 1 byte | CHECKSUM | CS = 0x00 – (B0 + … + B13) | UINT8 |
Sensor information
The SM50 sensor information request.
Request command
Length: 4 bytes
Position | Size | Name | Value | Format |
---|---|---|---|---|
0 | 1 byte | RECEIVER | 0x55 | |
1 | 1 byte | SENSOR INFO | 0xFB | |
2 | 1 byte | RESERVED | 0x00 | |
3 | 1 byte | CHECKSUM | 0xB0 = 0x00 – (B0 + B1 + B2) | UINT8 |
Reply command
Length: 15 bytes
Position | Size | Name | Value | Format |
---|---|---|---|---|
0 | 1 byte | SENSOR | 0xAA | |
1 | 1 byte | SENSOR INFO | 0xFB | |
2 | 1 byte | VERSION NO | UINT8: Version x 10 | |
3 | 1 byte | DISPLAY FORMAT | 0x01 = N.DDD e.g. 0.500 ppm 0x02 = NN.DD e.g. 12.20 ppm 0x03 = NNN.D e.g. 126.8 ppm 0x04 = NNNN. e.g. 2888 ppm | |
4 | 1 byte | NAME LENGTH | UINT8 | |
5 | 7 bytes | SENSOR NAME | Gas sensor name | ASCII string. Valid bytes specified by NAME LENGTH |
12 | 2 bytes | RESERVED | ||
14 | 1 byte | CHECKSUM | CS = 0x00 – (B0 + … + B13) | UINT8 |
Conversion factor
The conversion factor to use when converting concentration from ppm to mg/m3.
Request command
Length: 4 bytes
Position | Size | Name | Value | Format |
---|---|---|---|---|
0 | 1 byte | RECEIVER | 0x55 | |
1 | 1 byte | CONVERSION | 0x2A | |
2 | 1 byte | RESERVED | 0x00 | |
3 | 1 byte | CHECKSUM | 0x81 = 0x00 – (B0 + B1 + B2) | UINT8 |
Reply command
Length: 15 bytes
Position | Size | Name | Value | Format |
---|---|---|---|---|
0 | 1 byte | SENSOR | 0xAA | |
1 | 1 byte | CONVERSION | 0x2A | |
2 | 4 bytes | FACTOR | Conversion factor | IEEE754 float |
6 | 8 bytes | RESERVED | ||
14 | 1 byte | CHECKSUM | CS = 0x00 – (B0 + … + B13) | UINT8 |