TERA Sensor Knowledge Center
Esc

Tapez pour chercher dans la documentation NextPM.

↑ ↓ naviguer↵ ouvriresc fermer

Sensor SafyrOPC User Guide

Integration guide for the Sensor SafyrOPC OEM module: electrical connection, UART/Modbus communication and mechanical specifications.

1. About Sensor SafyrOPC #

1.1 Generals #

The Sensor SafyrOPC is an Optical Particle Counter (OPC) dedicated to particle measurement from 0.3 µm up to 10 µm in diameter in clean air environments.

The particles detected are classified in 5 different channels from:

  • 0.3µm to 0.5µm
  • 0.5µm to 1µm
  • 1µm to 2.5µm
  • 2.5µm to 5µm
  • 5µm to 10µm

All those data are available within 3 different average periods (10sec, 1 min and 15 min) to best suit the dynamic of the external environment.

The outputs are expressed in number of particles per cubic meter (Pcs/m3) within 3 different average periods (10sec, 1 min and 15 min) to best suit the dynamic of the external environment.

  • Sensor specifications, such as range, precision, conditions of use, etc.., are defined into the datasheet of the Sensor SafyrOPC sensor which can be found at https://tera-sensor.com/
  • The user can find explanations about fluidic and mechanics to be helped for its Sensor SafyrOPC use/integration by referring to the Sensor SafyrOPC integration advice chapter.
  • The user can find accessories either to quickly use and test the Sensor SafyrOPC but also to make an easier integration.
  1. Only available since 0x1123 firmware version

1.2 Pinout and electrical considerations #

Pin #Signal name
1GND
2DE/RE
3Rx (input)
4Tx (output)
5+5V
6GND
  • The Sensor SafyrOPC must be power supplied with + 5 VDC / 0.2V.
  • The average current consumption is lower than 70mA. The average current consumption can be reduced to 20mA by turning the sensor into sleep mode.
  • The Tx and Rx signal logical level is TTL (+3.3V) and the Rx signal is +5V tolerant.
  • The signal DE/RE is useful only in case of RS485 half duplex mode use, to drive the external RS485 transceiver, otherwise, it could be left unconnected (high impedance).
  • The ADAM TECH 125CH-B-06 or MOLEX 51021-0600 connector can be purchased to connect the Sensor SafyrOPC..
    To connect the Sensor SafyrOPC to a PC, a FTDI cable such as TTL-232R-3V3 (supplier: FTDI chip) can be used.

Warning : do not connect the sensor directly on the RS232 port of a PC or to a RS485 network.

1.3 Sleep mode #

To save the system energy by reducing the average Sensor SafyrOPC current consumption, the user can put the Sensor SafyrOPC sensor into sleep mode by sending the corresponding command (see Writing commands list and Writable registers list). This reduces the current consumption below 20mA.

In this mode, the Sensor SafyrOPC cannot provide any measurement as it has stopped the majority of its functionalities (fan, laser) but its communication remains functional.

As at the power on of the sensor, at the sleep mode exit, the measurements are reliable after 15 seconds.

To save more energy, if the user has the capability to, it is better to produce ON/OFF cycles by managing the sensor power supply . This way, the consumption will be 0mA during the Sensor SafyrOPC off phase and the average consumption will be considerably reduced.

1.4 Temperature and relative humidity measurement #

The Sensor SafyrOPC measures its internal temperature and relative humidity for its own need and these values are accessible thanks to reading commands (see 0x14 command reply and Readable registers list).

However, these internal values are biased by internal heat of the sensor due to PCB power dissipation. So, the internal temperature and relative humidity are only technical data.

It will not take into account the global casing used by the integrator and adjustments may be needed to fit with outdoor parameters.

1.5 Status code description #

The Sensor SafyrOPC makes continuous internal diagnosis in order to let the user know the state of the sensor and so, the validity of the measurements.

The state is coded on 2 bytes (1) and it contents flags corresponding to errors which can occur:

Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8
-------

Default

State

Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
Laser ErrorMemory ErrorFan ErrorT/RH Error-Not ReadyDegraded StateSleep State
  • bit 0: set if the user has sent a sleep mode command or if the sensor is in default state (bit 8).
    In simple protocol, the only authorized command still possible is a Sensor SafyrOPC state read.
  • bit 1: set each time a minor error is detected and confirmed. The corresponding minor error flag is set. In this state, the Sensor SafyrOPC can still measure data but with less accuracy.
    The minor errors are the following:
    • bit 4: T/RH Error: the sensor reading are out of specification
    • bit 5: Fan Error: the fan speed is out of range but the fan is still working
    • bit 6: Memory Error: the sensor can’t access its memory, some internal smart functions will not be available.
    • bit 7: Laser Error: the photodetector is not detecting any particle for at least 240 secs resulting from a possible laser error.
  • bit 2: set at power on, meaning that the sensor is starting and that measurements are not yet reliable until the bit is clear. It lasts 15 seconds.
    This bit is also set after a wake-up of the sensor (sleep mode exit)
  • bit 8: set if the fan has stopped working, after 3 restart attempts, the sensor will switch to the default mode, set the default state flag meanwhile the degraded state flag is clear and the sensor goes into sleep mode.

(1) The 8 most significant bits are only available using modbus protocol


2. Sensor SafyrOPC communication #

The Sensor SafyrOPC is able to either communicate using a simple protocol based only on proprietary UART frames or using Modbus standard protocol.

For both communication protocols, the physical layer is TTL 3.3V logical levels.

2.1 Serial communication configuration #

The serial communication must be configured as followed :

  • Default baud rate : 115 200
  • Number of data bits: 8
  • Parity : even
  • Number of stop bits: 1

Notes:

  • The Sensor SafyrOPC considers a timeout when there is 50ms of idle state between 2 bytes.
  • The Sensor SafyrOPC delay is 50 ms (beginning of the reply to a request).

2.2 Simple protocol #

The simple protocol uses the following frame format:

  • Reading:
    • Request: address (0x81) + command function code + checksum
    • Response: address (0x81) + command function code + data + checksum
  • Writing:
    • Request: address (0x81) + command function code + data + checksum
    • Response: address (0x81) + command function code + checksum


The checksum is calculated in such a way that the sum of all the frame bytes is equal to a multiple of 256 (0x100): checksum = 0x100 – MOD ((sum of the other bytes), 256).

Example :

  • 0x81 + 0x16 + 0x69 = 0x100

2.2.1 Reading commands list #

The Sensor SafyrOPC information’s reading can be realized through the following command frames:

Cmd codeDescriptionCommand
0x14Temperature and humidity readings0x81 0x14 0x6B
0x15Power on or sleep mode0x81 0x15 0x6A (cf note 1)
0x16Sensor state0x81 0x16 0x69
0x17Firmware version0x81 0x17 0x68
0x22Modbus address0x81 0x22 0x5D
0x31Concentrations (in number/m3) readings averaged over 10 seconds and updated every 1 second0x81 0x31 0x4E
0x32Concentrations (in number/m3) readings averaged over 60 seconds and updated every 10 seconds0x81 0x32 0x4D
0x33Concentrations (in number/m3) readings averaged over 900 seconds and updated every 60 seconds0x81 0x33 0x4C

2.2.2 Reading replies #

2.2.2.1 0x31, 0x32, 0x33 replies

addressCmd id

State

(1 byte)

Particles >0.3µm

pcs/m3

(4 bytes)

Particles >0.5µm

pcs/m3

(4 bytes)

Particles >1µm pcs/m3

(4 bytes)

Particles >2.5µm pcs/m3

(4 bytes)

Particles >5µm

pcs/m3

(4 bytes)

Checksum
0x810x310x000x00A86CE90x000BE42D0x00026B9C0x000000000x000000000x2C
0x810x320x000x0370F1EF0x0007BAEF0x0002349B0x000030440x000030440x91
0x810x330x000x02DCAE930x000918660x0001DC4D0x000050710x000050710xFA


The particulate matter concentrations in pcs/m3 are coded with 4 bytes (32 bits).

For example :

The response 0x81 0x32 0x00 0x00 0xA8 0x6C 0xE9 0x00 0x0B 0xE4 0x2D 0x00 0x02 0x6B 0x9C 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x2C

Signifies that the results are averaged over 1 minute. No error occurred during the measurement and the state code is 0.

In this example, the measured concentrations are:

DescriptionData (4 bytes)FactorResults
Particles >0.3µm pcs/m3 (4 bytes)0x00A86CE9111 037 929
Particles >0.5µm pcs/m3 (4 bytes)0x000BE42D1779 309
Particles >1µm pcs/m3 (4 bytes)0x00026B9C1158 620
Particles >2.5µm pcs/m3 (4 bytes)0x0000000010
Particles >5µm pcs/m3 (4 bytes)0x0000000010

2.2.2.2 0x16 command reply (state)

AddressCmd codeState (1 byte)Checksum
0x810x160x040x65


The 0x16 command frame requests the State code. This reply is also the default response to other requests when the Sensor SafyrOPC has no data to send neither because the sensor has just been switched on nor because the sensor is in the Default State and/or Sleep State. See Status code description for State code decoding.

2.2.2.3 0x17 command reply

AddressCmd codeStateFirmware versionChecksum
0x810x170x000x11240x33


The Sensor SafyrOPC replies to its firmware version. If the Sensor SafyrOPC is in the SLEEP mode, it will only reply to its state code.

2.2.3 Writing command list #

Cmd codeDescriptionfull command
0x15Sleep mode entry / exit (1)0x81 0x15 0x6A
0x22Modbus address write (2)0x81 0x22 0x03 0x5A

(1) At each 0x15 command frame sent, the Sensor SafyrOPC changes its functional state alternately. To know its state (see Status code description) before sending the command frame, the user can send a 0x16 command frame

(2) The 0x22 command is used to write the new modbus address. The third byte (here 0x03) is the address, which must be different from 0. See 0x22 command reply.

2.2.4 Writing replies #

2.2.4.1 0x15 command reply (sleep mode)

addressCommand codeState (1 byte)Checksum
0x810x150x010x69

When the sensor receives a sleep mode command frame, it turns into sleep mode, stops its functionalities (fan, laser and so, the measurements) and replies with a state code whose the sleep flag is set

During the sleep mode, if the sensor receives a new 0x15 command frame, the Sensor SafyrOPC switches on and sends the first data after 15 seconds.

While the sensor is in sleep mode, it replies to all the other command frames by sending a 0x16 command code and the state code.

If the Sensor SafyrOPC is in the Default State and so in sleep mode, the 0x15 command frame turns on the sensor: it allows the user to try a restart without errors.

2.2.4.2 0x22 command reply

addressCommand codeState (1 byte)Modbus addressChecksum
0x810x220x000x030x5A

The user can change the modbus device address using this command. The sensor replies to its new modbus address. The addresses start at 1 up to 15 (decimal values)

2.2.5 Error codes #

The Sensor SafyrOPC sensor replies the state code (see 0x16 command reply (state)) in these different cases:

  • sleep mode
  • default mode
  • measurements not ready (in case of power on or sleep mode exit)

It won’t send back any response in case of:

  • wrong checksum
  • wrong command code
  • wrong address
  • command frame length too long (>5 bytes)

2.3 Modbus Protocol #

The second way to get data from the Sensor SafyrOPC sensor is using the modbus protocol, respecting the modbus standard (v1.1b modbus specification compliance).

2.3.1 General information #

2.3.1.1 Bytes order #

All registers are coded on 2 bytes (word) but some data can be coded on 2 or more registers.

If a data is coded on 4 bytes (2 words, so 2 registers), such as Particles measurements, the second word is the most significant one.

Example: 0x01 0x03 0x04 0xB5 0x7F 0x02 0x71 0x2C 0xA3, is the reply of particles>0.3µm on 10 sec average measurement value request. The raw value is: (0xB57F) + (0x0271)*65536 = 41 006 463 pcs/m3.

2.3.1.2 Modbus default address #

The default modbus address is 0x01 but it can be changed by sending a simple protocol write command frame or modbus command write frame. The change is saved into its memory and is kept even after a restart.

2.3.1.3 Timings #

Timings are the ones specified in Serial communication configuration:

  • The Sensor SafyrOPC considers a timeout when there is 50ms of idle state between 2 bytes.
  • The Sensor SafyrOPC delay is 50 ms (beginning of the reply to a request).

2.3.1.4 Function codes #

Sensor SafyrOPC registers are accessible through 3 function codes:

  • 0x03: read multiple holding registers
  • 0x10: write multiple registers
  • 0x17: Read/Write Multiple registers

2.3.2 Readable registers list #

The following registers are only readable and accessible with a read or read/write multiple holding registers function command (0x03 or 0x17)

RegisterNameDescription
1 (0x01)Firmware versionEmbedded firmware version
19 (0x13)StatusSensor SafyrOPC status (error codes)
20-21 (0x14-0x15)GetTenSecondesAverageResult.Nbsup_0_3average over 10s of the number of particles / m3 of size > 0.3 μm
22-23 (0x16-0x17)GetTenSecondesAverageResult.Nbsup_0_5average over 10s of the number of particles / m3 of size > 0.5 μm
24-25 (0x18-0x19)GetTenSecondesAverageResult.Nbsup_1_0average over 10s of the number of particles / m3 of size > 1.0 μm
26-27 (0x1A-0x1B)GetTenSecondesAverageResult.Nbsup_2_5average over 10s of the number of particles / m3 of size > 2.5µm
28-29 (0x1C0x1D)GetTenSecondesAverageResult.Nbsup_5_0average over 10s of the number of particles / m3 of size > 5.0µm
30-31 (0x1E-0x1F)GetOneMinuteAverageResult.Nbsup_0_3average over 60s of the number of particles / m3 of size > 0.3µm
32-33 (0x20-0x21)GetOneMinuteAverageResult.Nbsup_0_5average over 60s of the number of particles / m3 of size > 0.5µm
34-35 (0x22-0x23)GetOneMinuteAverageResult.Nbsup_1_0average over 60s of the number of particles / m3 of size > 1.0µm
36-37 (0x24-0x25)GetOneMinuteAverageResult.Nbsup_2_5average over 60s of the number of particles / m3 of size > 2.5µm
38-39 (0x26-0x27)GetOneMinuteAverageResult.Nbsup_5_0average over 60s of the number of particles / m3 of size > 5.0µm
40-41 (0x28-0x29)GetFifteenMinuteAverageResult.Nbsup_0_3average over 15 min of the number of particles / m3 of size > 0.3µm
42-43 (0x2A-0x2B)GetFifteenMinuteAverageResult.Nbsup_0_5average over 15 min of the number of particles / m3 of size > 0.5µm
44-45 (0x2C-0x2D)GetFifteenMinuteAverageResult.Nbsup_1_0average over 15 min of the number of particles / m3 of size > 1.0µm
46-47 (0x2E-0x2F)GetFifteenMinuteAverageResult.Nbsup_2_5average over 15 min of the number of particles / m3 of size > 2.5µm
48-49 (0x30-0x31)GetFifteenMinuteAverageResult.Nbsup_5_0average over 15 min of the number of particles / m3 of size > 5.0µm
106 (0x6A)HumidityHumidity in % multiplied by 100
107 (0x6B)TemperatureTemperature in °C multiplied by 100
113-114 (0x71-0x72)0.3-0.5 raw cumulative (2)Raw cumulative number of detection by the sensor in the channel 0.3 - 0.5 µm
115-116 (0x73-0x74)0.3-0.5 raw cumulative (2)Raw cumulative number of detection by the sensor in the channel 0.5 - 1 µm
117-118 (0x75-0x76)0.3-0.5 raw cumulative (2)Raw cumulative number of detection by the sensor in the channel 1 - 2.5 µm
119-120 (0x77-0x78)0.3-0.5 raw cumulative (2)Raw cumulative number of detection by the sensor in the channel 2.5 - 5 µm
121-122 (0x79-0x7A)0.3-0.5 raw cumulative (2)Raw cumulative number of detection by the sensor in the channel 5 - 10 µm
  1. See example below explaining how to decode mass and quantity concentration.
  2. Value increases every second, value restarted at every restart of the sensor.

Measurement decoding example :

  • Particles concentrations request command on 1 minute average is:
01 03 00 1E 00 0A A5 CB
  • Sensor’s reply
01 03 14 92 71 01 DF EC 16 00 25 3B 18 00 0D F4 23 00 00 21 AC 00 00 A5 2C
  • Calculation of the particles number concentration / liter whose size is > 0.3μm :
    • 0x9271 is the less significant word and 0x01DF is the most significant word
    • the concatenate value (raw value) is 0x01DF9271 which is 31 429 233 in decimal. This is the measured physical value in Nb/m3, averaged over 1 minute of all particles detected with a size above 0.3µm.
  • Calculation of the particles number concentration / liter whose size is > 0.5μm :
    • 0xEC16 is the less significant word and 0x0025 is the most significant word
    • the concatenate value (raw value) is 0x0025EC16 which is 2 485 470 in decimal. This is the measured physical value in Nb/m3, averaged over 1 minute of all particles detected with a size above 0.3µm.
  • Calculation of the number of particles on the channel 0.3 - 0.5 µm:
    • To do so, you need to subtract the registers >0.3µm - registers >0.5µm
    • So the final number of particles here would be:

channel 0.3 - 0.5µm = 31 429 233 - 2 485 470 = 28 943 763 particles/m3

2.3.3 Writable registers list #

The following registers are writable and accessible with a write or read/write multiple holding registers function command (0x10 or 0x17). These are advanced registers that need to be considered carefully before changed, as they may modify the sensor behaviour. We recommend contacting Tera Sensor before modifying them.

RegisterNameDescription
88 (0x58)Modbus address

Sensor SafyrOPC with Modbus protocol

( range is 1 to 15)

100 (0x64)Fan target ratio (%)

Fan rotation setpoint (%)

(to be divided by 100) (1)

  1. As it will change the behavior of the sensor and the reliability of the measurements, Tera Sensor does not recommend any change .
  2. The baud rate of the simple and modbus communication can be changed by writing the identifier code corresponding to the desired baud rate value (see table below).

2.3.4 Error codes #

The Sensor SafyrOPC is able to make specific reply depending on the Modbus frame received:

  • Error code, with specific error code depending on the Modbus frame received:
    • Inexistant code function (CF)
      • reply: ModbusAdress 0x80|CF 0x01 CRC1 CRC2
    • Inexistant registers (write)
      • reply: ModbusAdress 0x80|CF 0x02 CRC1 CRC2
        note: only true for 0x10 code function. For the 0x17 code function, the Sensor SafyrOPC sends back correctly the data read, without any error code.
  • No reply, in case of:
    • wrong checksum
    • wrong Modbus address
  • Standard reply, even if the frame received is partially correct:
    • Registers quantity exceeding the maximum allowed:
      • 125 registers to be read in a single time
      • 18 registers to be written in a single time

In those cases, the Sensor SafyrOPC will set the quantity requested equal to the maximum.

  • Inexistent registers (to be read)
    • data corresponding to the nonexistent register will be 0x00 0x00
  • Frame content inconsistency (number of bytes not as expected depending on the code function):
    • If there are more bytes than expected, the Sensor SafyrOPC truncates the frame to match the size with the one expected according to the code function. It will then interpret the truncated frames and the reply could not be consistent with the user request.
    • If there are less bytes than expected, the Sensor SafyrOPC interprets the frames and the reply could not be consistent with the user request.

3. RS485 #

If the user wants to integrate the Sensor SafyrOPC on an RS485 half duplex bus, despite the Sensor SafyrOPC does not have an embedded RS485 transceiver, it has the ability to drive an external one thanks to its DE/RE output signal which indicates to the RS485 transceiver if it should be in receive or in transmission mode.

Even if any module of that kind could work also well, Tera Sensor is used to work with the PModRS485 (from digilent supplier) or the DSD TECH SH-U12. Both converters have been tested and work properly for that purpose.


4. Test software #

Tera Sensor provides software that can help the user to communicate with the sensor and test it before working on the integration.

Note: The computer running the software should have Windows 10 or newer version.


5. Sensor SafyrOPC Mechanical tips #

5.1 Introduction #

This document has been written in order to support our customer to optimize the integration of the Sensor SafyrOPC in their device and obtain the best and most accurate results for particle monitoring. The mechanical settings and the guidelines for integration of the Sensor SafyrOPC will be approached in the following part of the document to guarantee the best performance for the sensor. This guideline is a tips summary of more than 20 years experience in the air quality monitoring domain.

5.2 Mechanical settings #

5.2.1 Air path in the sensor #

The Sensor SafyrOPC presents a 6 pins Molex connector to ensure power supply and to communicate with the sensor. Once the power supply is provided to the sensor, the sensor turns on automatically, the fan starts and the airflow path operates. The air inlet is facing the front of the sensor, while the outlet is rejecting the air by the side of the sensor to limit particle recycling effects.

5.2.2 Fixation #

You can fix the Sensor SafyrOPC thanks to the two holes in the back of the sensor. The holes are made to receive tap screws M2.5 and are 5 mm deep.

6. General Sensor SafyrOPC integration #

6.1 Positions for storage #

6.2 Positions to operate #

Why this recommendations for operating conditions:

  • The Sensor SafyrOPC inlet is an aerolic filter that stops particles larger than 10µm from entering the sensor. If the sensor is upside down, then the aerolic filter will not be able to block those big particles and the lifetime of the sensor will be affected due to clogging.
  • The fan is a critical part if not correctly set in the sensor. Inside the fan, a small amount of oil allows the rotation without friction. If the Sensor SafyrOPC (and consequently the fan) is not correctly placed, the oil can leak and it results with stretching in the fan, an increased power consumption to compensate for the frictions, until the failure of the fan. That will strongly affect the lifetime of the sensor.

6.3 Pressure lost and Deported Inlet #

6.3.1 Pressure Loss

The sensor uses an active airflow to sample the particles. In order to keep his accuracy, we advise you to put the inlet directly to the air you want to monitor. Be aware that the fan allowing the flow inside the sensor is sensitive to pressure loss, it does not allow a differential pressure between the inlet and outlet more than 0.3 mbar. As the fluidic path already generates a 0.15 mbar pressure loss, the remaining possible pressure loss is 0.15 mbar due to additional features, for instance a deported inlet of the Sensor SafyrOPC.


7. Electrical integrity #

As the EMC shield of the sensor is connected to its ground, the integrator should avoid a mechanical contact to the system earth / ground, by using a non conductive material or an electrical insulation.

This will avoid any unwanted current path flow in case of power supply isolation fault, which would damage the sensor.


8. Accessories #

Tera Sensor sells additional components to help the user/integrator:

  • anti-static tube for remote short distance measuring (easier integration)
  • plug and play: USB (FTDI) communication cable (plug and play for a quick use)
    Note: it also power supplies the Sensor SafyrOPC through the USB power lines but special care must be taken regarding the current drawn from the USB port.
  • Demo software to get data without getting into the code writing process (quick use)

Please visit https://tera-sensor.com/fr/ to find more information and to contact the sales service.


Revision history #

DateRevisionChanges
2018/05/121.2

- Add warnings at serial port communication chapter

- Add modbus protocol

2024/11/191.4

- Add summary

- Remove GetTimeOn modbus reading command

- Full graphic renewal of the Userguide

- Mechanical tips for integrator added