3001 TEMP AND RH EN
Keywords
Raspberry Pi, Raspberry Pi 5, CM4, USB to serial, SHT20, STM32F030, CH340G, Temperature and humidity collection
I. Introduction
The Raspberry Pi is a versatile maker platform, and many makers require temperature and humidity data when using the Raspberry Pi. However, the accuracy and consistency of some affordable temperature and humidity modules on the market (such as the DHT2x series) are often quite poor. So we have designed a temperature and humidity module that offers better precision at a reasonable cost. We have set up a microcontroller on the module to read temperature and humidity data, which sends data to the main controller via a TTL serial port or through a USB-to-serial adapter. The temperature and humidity sensor used is the SHT20 from Sensirion, with a typical humidity accuracy of ±3%RH and a typical temperature accuracy of ±0.3°C. We have conducted consistency tests, and in the same environment, the temperature difference among five modules is within 0.3°C, and the humidity difference is within 3%RH. The entire module can be powered and communicated with through a USB-C interface, or it can be powered via pin connectors. The module can measure the temperature and humidity near the Raspberry Pi or can be placed in the target environment for measurement using a USB-C cable up to 2 meters long.
II. Hardware Resources
1. The main controller uses STM32F030 to collect temperature and humidity data, which sends data to the host computer via a TTL serial port or a USB serial port.
2. The USB interface uses the popular USB Type-C connector, which is utilized for both power supply and USB-to-serial communication.
3. The USB-to-serial conversion chip used is the CH340G. After more than a decade of development, Nanjing Qinheng's USB-to-serial chips have become quite mature, with good stability and cost-effectiveness.
4. The temperature and humidity sensor chip used is the SHT20, with a typical humidity accuracy of ±3%RH and a typical temperature accuracy of ±0.3°C.
5. Reserve TTL serial ports/SWD interfaces/extra GPIO pins.
6. Solder a button for switching the output of data from the TTL serial port to the USB-to-serial port. Reserve a position for an unsoldered button.
7. A user LED, which is off by default and lights up after power-on. Users can modify it for other indicator purposes.
8. Size: 40*55mm, perfectly matching the dimensions of the Raspberry Pi CM4's core board; M2.5 mounting holes.
III. Test in Raspberry Pi OS
Hardware Platform: We use the Raspberry Pi CM4's core board paired with our expansion board for testing. The operation methods for other Raspberry Pi models such as the 5/4B/3/Zero series are the same. Please refer to the following picture for hardware connections:
We use the official Raspberry Pi OS for test. 版本为2024-07-04-raspios-bookworm-arm64.img.xz
The Raspberry Pi OS used in this document is: 2024-07-04-raspios-bookworm-arm64.img.xz(Raspberry Pi OS with desktop).
You can download the Raspberry Pi OS in:
https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit
In the Raspberry Pi system, We use a serial port tool to read the temperature and humidity data in the Raspberry Pi system.
Execute the following command in the terminal to install the serial port tool CuteCom:
sudo apt install cutecom
After installation, click on the Raspberry Pi logo in the upper left corner, go to System Tools, and click on the CuteCom icon:
After opening, the software automatically detects the serial port number ttyUSB0 of the temperature and humidity module. The default serial port parameters of 115200@8-N-1 can be used:
Click "Open" to open the serial port; the output box below will then display the current temperature and humidity data:
★ The board reserves I2C interface, which can be used to connect OLED display. If you have the requirement, you can write your own application to display the temperature and humidity information on the LCD screen.
IV. . Test in Windows
Under Windows 10, this module is recognized as a USB-to-serial converter. You need to install the CH340 driver first. The driver download link is:
http://www.mcuzone.com/down/Software.asp?ID=10000607
After installing the driver, use a USB A-C cable to connect the temperature and humidity module to the USB-A port on the computer, and the module will start automatically.
After a successful connection, we can see a USB-to-serial port (COM6 in this example) in the Device Manager:
Next, download the temperature and humidity measurement software:
http://www.mcuzone.com/wiki/3001_TEMP_AND_RH/THTB.zip
Unzip the compressed file, run TH TB.exe, open the software, and it will automatically detect the USB-to-serial port. Then click "Open Serial Port" to display the current temperature and humidity:
Contact Us
Email: mcuzone@vip.qq.com
Tel: +86(0)13957118045
If there are any omissions, errors, or infringements on this page, please contact us through the above methods. Thank you!
Copyright 2004-2024 Wildchip