13.5 SBUS [T-Series Datasheet]
Overview
SBUS is a serial protocol used with SHT1X and SHT7x sensors from Sensirion. It is similar to I2C, but is not compatible. The EI-1050 uses the SHT11 sensor. Other available sensors are the SHT10, SHT15, SHT71, and SHT75. In the context of our devices, SBUS registers will also be used to interface newer I2C based SHT3x sensors from Sensirion (T4 firmware v1.0029+, T7 v1.0305+, T8 v1.0017+). SBUS protocol sensors used in the EI-1050 are now EOL.
T-Series SBUS Support
T-series devices support SBUS/SHT3x at a higher level compared to other devices using serial communication protocols. Protocols such as SPI and I2C provide direct access to the bus so that arrays of bytes can be sent and received, but T-series devices implement all the functionality necessary to run SBUS/SHT3x and convert the binary data to relative humidity (RH) or temperature.
Lua scripting is often convenient for serial applications. For example, a script can run the serial communication at a specified interval, and put the result in USER_RAM registers. The host software can read from the USER_RAM registers when convenient. This puts the complications of serial communication in a script running on the T-series device. The Lua examples contain several serial communication examples.
Default DIO Assignments
The lines used for data, clock, and power are set at startup according to the below list. The assignments can be changed as desired.
T4
DIO4 (FIO4): Data Line
DIO5 (FIO5): Clock Line
DIO6 (FIO6): Power line. Will be set to output-high. Can be disabled.
T7/T8
DIO0 (FIO0): Data Line
DIO1 (FIO1): Clock Line
DIO2 (FIO2): Power line. Will be set to output-high. Can be disabled.
How-To
SBUS on T-series LabJack devices is set up to work with the EI-1050 probe. SHT1x, SHT7x, and SHT3x sensors can be directly used as well. The most relevant difference is that the EI-1050 adds an enable line.
Device Control Basics
All T-series device features are controlled by reading and writing Modbus TCP registers via Modbus TCP (either directly or through our LJM library).
We have register descriptions throughout documentation detailing relevant register names, starting addresses, types, and access permissions (read/write).
See Section 3.0 Communication for other detailed communication information.
EI-1050
The EI-1050 datasheet should be referenced for hardware connections. The temperature and humidity can be read using the SBUS#_TEMP and SBUS#_RH registers:
The register index number determines which DIO port the EI-1050's enable line (brown wire) is connected to. See the Examples section below for examples.
When either SBUS#_TEMP and/or SBUS#_RH are read, the following steps are performed by firmware:
The power line is set to output-high.
The enable line is set to output-high (enabled).
The EI-1050 sensor is instructed to measure temperature or humidity.
When the measurement is complete, the result and the checksum are read from the sensor.
The enable line is set to output-low (disabled).
Firmware verifies the checksum.
If the checksum failed, an error will be returned. If the checksum passed, the result value will be converted to a decimal number and returned.
SHT1x or 7x sensor
To use an SHT1x and 7x sensor, connect the data and clock lines to DIO of your choosing. The sensor should be powered from 3.3 V—a digital IO set to output-high will work. The direction settings can be handled by firmware if desired. 5 V should not be used to power the SHT1x and 7x sensors. Doing so will create a logic level mismatch.
The Enable line control and power line control can be disabled.
Disable Enable line control. The enable line will be disabled if set to the same line as the clock or data line.
Set power control (optional). Set the SBUS_ALL_POWER_DIONUM register to match the hardware configuration. Power control can be disabled by setting the power line to an invalid number, like 9999.
Set the data and clock lines to match the hardware configuration.
Read from the temperature or humidity register as desired.
SHT3x (requires T4 firmware v1.0029+, T7 v1.0305+, T8 v1.0017+)
To use an SHT3x sensor, connect the data (SDA) and clock (SCL) lines to DIO of your choosing. The sensor should be powered from 3.3 V—a digital IO set to output-high will work. 5V should not be used to power the SHT3x sensor. If your SHT3x sensor has the address (ADDR) line exposed through a wire, we recommend connecting it to GND.
When either SBUS#_TEMP and/or SBUS#_RH are read, the following steps are performed by firmware:
If this is the first read, or if the data or clock line registers have been modified, the power line will be set high and a device acknowledge check will be performed. This is expected to take between 1.5ms and 6ms depending on the clock speed.
The SHT3x sensor is instructed to measure temperature and humidity.
When the measurement is complete, the result and the checksum are read from the sensor.
Firmware verifies the checksum.
If the checksum failed, an error will be returned. If the checksum passed, the result value will be converted to a decimal number and returned.
Troubleshooting
Checksum or acknowledgement errors can indicate that the clock speed is too fast for the hardware configuration. Use the SBUS_ALL_CLOCK_SPEED register to reduce the clock speed:
Register Listing
For configurations besides the default, use the following registers. See the Examples section below for more explanations. Note that SBUS_ALL_CLOCK_DIONUM and SBUS_ALL_DATA_DIONUM should not typically be used with SHT3x sensors.
Examples
SHT3x sensors (requires T4 firmware v1.0029+, T7 v1.0305+, T8 v1.0017+):
SHT3x sensors should not typically share data and clock lines, so only one sensor should be connected with default configurations. In this example we connect the wires from a probe to the lines specified by the default configuration:
T7/T8 | T4 | SHT3x |
---|---|---|
GND | GND | Ground (black) |
DIO0 (FIO0) | DIO4 (FIO4) | Data (SDA) |
DIO1 (FIO1) | DIO5 (FIO5) | Clock (SCL) |
DIO2 (FIO2) | DIO6 (FIO6) | Power (red) |
You can then read from SBUS0_TEMP and SBUS0_RH for the probe without writing any configuration values. In LJLogM, for example, just put the desired register name in any row. A read from SBUS0_TEMP will return the temperature, and a read from SBUS0_RH will return the humidity.
To add additional sensors an SBUS#_DATA_DIONUM and SBUS#_CLOCK_DIONUM register should be configured for each sensor. Each new probe should be connected to their own set of DIO. One exception is that any DIO set to output high or a DAC output set to 3.3V can easily power multiple sensors. For example, say you add two more sensors connected as shown in the table below:
T4/T7/T8 | SHT3x |
---|---|
GND | Ground (black) ProbeB, ProbeC |
DAC0 | Power (red) ProbeB, ProbeC |
DIO8 (EIO0) | Data (SDA) ProbeB |
DIO9 (EIO1) | Clock (SCL) ProbeB |
DIO10 (EIO2) | Data (SDA) ProbeC |
DIO11 (EIO3) | Clock (SCL) ProbeC |
You could then set SBUS1_DATA_DIONUM to 8 (DIO8) and SBUS1_CLOCK_DIONUM to 9 (DIO9). Reading SBUS1_TEMP and SBUS1_RH will return the temperature and humidity from ProbeB. You could set SBUS2_DATA_DIONUM to 10 (DIO10) and SBUS2_CLOCK_DIONUM to 11 (DIO11). Reading SBUS2_TEMP and SBUS2_RH will return the temperature and humidity from ProbeC.
EI-1050 probes using default configuration:
The EI-1050 has an enable line that allows multiple probes to use the same pair of data/clock lines. In this example we connect the wires from each probe to the lines specified by the default config:
T7/T8 | T4 | EI-1050 |
---|---|---|
GND | GND | Ground (black) |
DIO0 (FIO0) | DIO4 (FIO4) | Data (green) |
DIO1 (FIO1) | DIO5 (FIO5) | Clock (white) |
DIO2 (FIO2) | DIO6 (FIO6) | Power (red) |
FIO lines can only power 4 EI-1050 probes, so that is the limitation on number of probes using the default config. We can now connect the enable line from each probe to any DIO we want. Let's use:
T7/T8 | T4 | EI-1050 |
---|---|---|
DIO3 (FIO3) | DIO7 (FIO7) | Enable ProbeA (brown) |
DIO4 (FIO4) | DIO8 (EIO0) | Enable ProbeB (brown) |
DIO5 (FIO5) | DIO9 (EIO1) | Enable ProbeC (brown) |
DIO6 (FIO6) | DIO10 (EIO2) | Enable ProbeD (brown) |
You can now read from SBUS#_TEMP and SBUS#_RH for each probe without writing any config values. In LJLogM, for example, just put the desired register name in any row. For the T4, a read from SBUS8_TEMP will return the temperature from ProbeB, and a read from SBUS9_RH will return the humidity from ProbeC. For the T7/T8, a read from SBUS4_TEMP will return the temperature from ProbeB, and a read from SBUS5_RH will return the humidity from ProbeC.
Note that when using multiple probes this way, you might need to read one value from each probe before they will work. By default, digital I/O are set to input, which has a 100k pull-up, so all 4 probes in this example will be enabled at the same time, which will likely result in a read error. At the end of a read, the enable line is set to output-low, so once you do an initial read from each, they will all be disabled and on further reads only one will be enabled at a time.
EI-1050 probes with custom configuration (shared Data/Clock):
Say you connect 2 probes as follows:
GND | Ground (black) |
DIO8 (EIO0) | Data (green) |
DIO9 (EIO1) | Clock (white) |
DIO10 (EIO2) | Power (red) |
DIO11 (EIO3) | Enable ProbeA (brown) |
DIO12 (EIO4) | Enable ProbeB (brown) |
Write the following registers to configure and disable the probes:
SBUS_ALL_DATA_DIONUM = 8
SBUS_ALL_CLOCK_DIONUM = 9
SBUS_ALL_POWER_DIONUM = 10
EIO3 = 0
EIO4 = 0
You can now read from SBUS11_TEMP/SBUS11_RH for ProbeA values or SBUS12_TEMP/SBUS12_RH for ProbeB values.
EI-1050 with custom configuration (separate Data/Clock):
This example does not use the enable feature of the EI-1050, and thus applies to the SHT1x and SHT7x also.
In this example each probe has its own data and clock lines. Thus the enable line is not needed and we leave both probes enabled all the time. This technique requires 2 DIO per probe, whereas with the shared data and clock lines you need 1 DIO per probe (enable line) plus 2 DIO (data and clock). A couple downsides to sharing data and clock lines are that it can be difficult to get multiple wires in a single screw terminal and that increased wire capacitance can cause communication problems. Our testing has shown that 6 stock (6 ft cable) EI-1050 probes work fine with a single shared pair of data and clock lines.
Say you connect 2 EI-1050s as follows:
GND | Ground ProbeA (black) |
DIO8 (EIO0) | Data ProbeA (green) |
DIO9 (EIO1) | Clock ProbeA (white) |
DAC0 | Power ProbeA (red) |
DAC0 | Enable ProbeA (brown) |
GND | Ground ProbeB (black) |
EIO2/DIO10 | Data ProbeB (green) |
EIO3/DIO11 | Clock ProbeB (white) |
DAC0 | Power ProbeB (red) |
DAC0 | Enable ProbeB (brown) |
Since the EI-1050 enable lines are tied to power they will always be enabled. We can do that because we have assigned both probes dedicated DIO for data and clock.
In this example we use DAC0 to provide power for the sensors. The automatic power control is only supported on digital I/O lines, so we disable automatic power control and manually set DAC0 to 3.3 volts. Alternatively we could use a digital line to power the sensors, with or without automatic power control.
Write the following registers to configure and power the probes:
SBUS8_DATA_DIONUM = 8 // Automatic enable control disabled since DATA line is same as SBUS#.
SBUS8_CLOCK_DIONUM = 9
SBUS10_DATA_DIONUM = 10 // Automatic enable control disabled since DATA line is same as SBUS#.
SBUS10_CLOCK_DIONUM = 11
SBUS_ALL_POWER_DIONUM = 9999 // Disable automatic power control.
DAC0 = 3.3 // Power for both probes.
You can now read from SBUS8_TEMP/SBUS8_RH for ProbeA values or SBUS10_TEMP/SBUS10_RH for ProbeB values.
Note that the "#" in the register names above can be about anything you want. Say for ProbeB you instead did:
SBUS7_DATA_DIONUM = 10
SBUS7_CLOCK_DIONUM = 11
Now if you read SBUS7_TEMP/SBUS7_RH, the LabJack will use EIO2/3 to talk to the sensor. A possible problem, though, is that the LabJack will also control FIO7 as an enable even though FIO7 has nothing to do with ProbeB. It will set FIO7 to output-high, talk to the sensor, and then set FIO7 to output-low. The way to prevent control of an enable line is to use a "#" that is the same as the data or clock line.
SHT1x or SHT7x sensor using default configuration:
This example was made for the T7/T8. To adapt it for the T4 simply change the line numbers 0-2 to 4-6.
In this example we connect the 4 connections from the raw Sensirion sensor to the lines specified by the default config:
GND | Ground (black) |
DIO0 (FIO0) | Data (green) |
DIO1 (FIO1) | Clock (white) |
DIO2 (FIO2) | Power (red) |
Note that the SHT7x datasheet shows an added 10k pull-up resistor from Data to Power. The LabJack has an internal 100k pull-up that usually works, but some applications might need the stronger 10k pull-up (FIO0 to FIO2) and perhaps even a capacitor from Clock to GND. The filter cap should be near the sensor pins, not the LabJack terminals. Suggested value is equal to or less than 1 / (2 * pi * f * R)
, where f
is the clock frequency and R
is the source impedance—which is dominated in this case by the DIO (use 550 ohms for FIO and 180 ohms for EIO). 1nF or 10nF should be good for any DIO at the default SBUS clock frequency of 9100 Hz.
You can now read from SBUS0_TEMP & SBUS0_RH without writing any config values. In LJLogM, for example, just put the desired register name in any row. The SHT71 does not have an enable, so we set "#" equal to the data line (0) or clock line (1) which is a signal to the T-series device to not control an enable line.
Since the raw SHT sensors do not have an enable, each sensor must have its own Data and Clock lines.
If an SHT sensor is not working at this point, an oscilloscope or logic analyzer will likely be required to troubleshoot.