HS-S26P Temperature and Humidity Sensor

HS-S26P Temperature and Humidity Sensor

1. Introduction

Data format: 8-bit humidity integer data + 8-bit humidity decimal data + 8-bit temperature integer data + 8-bit temperature decimal data + 8-bit parity bit.

The data transmission process: the master sends a start signal - > DHT responds with a signal - > DHT notifies the master that it is ready to receive the signal - > DHT sends the ready data - > DHT ends the signal - > DHT internally retests the environmental temperature and humidity, records the next data, and the master starts sending the signal.

Obtained through this process, the controller of the data collected each time is always the last DHT data.If we want to get real-time data, the master can collect two consecutive data, but officially, it is not recommended to read DHT continuously multiple times.If the interval time between each read exceeds 5 seconds, it is sufficient to obtain accurate data.The DHT needs 1 second to stabilize when powered on.

2. Schematic

Humidity and Temperature Sensor - HS-S26P SchematicClick to view

Module Parameters

Pin Name

description

G

GND (Negative Power Input)

V

VCC (Positive Power Input)

S

Digital Signal Pin

  • Power Supply Voltage: 3.3V / 5V

  • Connection method: PH2.0 terminal wire

  • Installation Method: Double Screw Fixed

4, Circuit Board Size

5 of Arduino IDE example program

Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Arduino IDE Library Download and Import Tutorial:
Click to view

Example program (UNO development board):

//DHT11传感器接引脚D6
#include <DHT.h>//调用温dht湿度库

volatile float wendu = 0;//设置温度变量
volatile float shidu = 0;//设置湿度变量
DHT dht6(6, 11);//定义温湿度传感器引脚

void setup() {
  Serial.begin(9600);//设置波特率

  dht6.begin();//启动
}

void loop() {


  delay(2000);//延时2秒
  shidu = dht6.readHumidity();//将湿度读取为摄氏度(默认值)赋给变量
  wendu = dht6.readTemperature();//将温度读取为摄氏度(默认值)赋给变量
  Serial.print(wendu);//串口打印温度
  Serial.print("℃");
  Serial.print("                         ");
  Serial.print(shidu);//串口打印湿度
  Serial.println("%");

}

6, ESP32 Python Example (for Mixly IDE/Misashi)

Choose the development board Python ESP32 [ESP32 Generic(4MB)] and upload in code mode

Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Download and import tutorial for Mixly IDE ESP32 library:
Click to view

Example program (ESP32-Python):

import machine
import dhtx
import time


while True:
    print(dhtx.DHT11(2).temperature(),end ="")
    print('    ',end ="")
    print(dhtx.DHT11(2).humidity())
    time.sleep_ms(200)

7, Mixly example program (graphical language)

Example program (UNO development board):Click to download
Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Download and import tutorial of Mixly IDE Arduino library:Click to view

Example Program (ESP32 Development Board):Click to download
Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Download and import tutorial for Mixly IDE ESP32 library:
Click to view

8. Setting up the Test Environment

Arduino UNO Test Environment Setup

Prepare Components:

  • HELLO STEM UNO R3 DEVELOPMENT BOARD *1

  • HELLO STEM UNO R3 P EXPANSION BOARD *1

  • USB TYPE-C DATA CABLE *1

  • Humidity and temperature sensor (HS-S26P) *1

  • PH2.0 3P Connector to DuPont Wire *1 or PH2.0 3P Dual Head Connector Wire *1

Circuit wiring diagram:

ESP32 Test Environment Setup

Prepare Components:Pending update...

Circuit wiring diagram:Pending update...

9, Video tutorial

Video tutorial:Click to view

10, Test results

Arduino UNO test results:

After the device is connected and the wires are in place, upload the above program to the development board, and then open the serial port monitor. You will see the current temperature and humidity data displayed in the window.

ESP32 Test Results:

Pending update...