This post was last edited by sylar^z on 2020-3-17 13:45
SHT31 is a new digital sensor that has an analog signal or I2C interface to obtain temperature and humidity data. The SHT31 Smart Gadget is equipped with an I2C interface SHT31 chip. Its maximum I2C speed can reach 1MHz. This test was intended to verify its 1MHz speed, but the performance and main frequency of the development board on hand were insufficient, and neither the hardware I2C nor the analog I2C (tested to reach a maximum of 500+KHz) could reach a speed of 1MHz. Therefore, this time, the I2C speed of nrf51822 on the SHT31 Smart Gadget was tested, and the SHT31 data was read and displayed through the NUCLEO-L011K4 development board on hand.
First, lead out the terminal wires needed on the SHT31 Smart Gadget.
Connect the logic analyzer through the SHT31 I2C terminal, and you can see the I2C communication timing of nrf51822.
This is the timing for writing instructions to collect temperature and humidity data.
The write instruction is 0x2416.
According to the instructions in the SHT31 manual, this is to set the acquisition mode of SHT31 to non-constantly widened slow acquisition.
This is the timing for reading temperature and humidity data.
From the timing period of 2.6us, the frequency is 384.62KHz, and the I2C speed set by the program should be 400KHz.
Next, connect the NUCLEO-L011K4 development board and try to communicate with SHT31 and read data. The NUCLEO-L011K4 board has an STM32L011K4 chip with a main frequency of 32MHz.
The nrf51822 debug port was previously soldered on the SHT31 Smart Gadget. The nrf51822 chip program was erased through the debug port to prevent the NUCLEO-L011K4 development board from conflicting with the nrf51822 when reading SHT31 data.
NUCLEO-L011K4 is connected to SHT31 and OLED display. The picture is a bit blurry, showing the temperature is 13.4℃ and the humidity is 57.6%.
The figure below is the timing diagram of NUCLEO-L011K4 reading SHT31 data.
According to the SHT31 manual, the formula is used to calculate
Temperature T = (175 * 0x550F / 65535) - 45 = 13.14°C
Relative humidity RH = 100 * 0x931A / 65535 = 57.46%
This time series is not the same as the screen display in the above figure, so the data does not completely correspond. In general, the accuracy of temperature is ± 0.2℃, and the actual collected data is relatively stable. The accuracy of relative humidity is ± 2%, and the actual collected data also fluctuates a bit, but it is within ± 2%.
This content is originally created by sylar^z, a user of EEWORLD forum. If you want to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source