走马观花

Open source | ESP32C3 temperature and humidity sensor AHT20+SHT30

 
Overview

Project Origin
Since I have to hand in the Internet of Things Communication course project recently, and I am playing with ESP32C3 at the same time, I used ESP32C3 to draw such a sensor to serve as the sensor part in the course project.
 
Board Introduction
The main control uses ESP32C3, the download chip uses CH340K, and a WS2812 RGB light. Its wiring is the same as that of the Espressif ESP32C3 development board. At the same time, the I2C interface is led out, which can easily connect to other I2C sensors. With power management IC: TP4057, it can be connected to a lithium battery. Through a MOS tube, it can be connected to the battery and the Type-C cable can be plugged in at the same time, charging the battery and powering the ESP32C3. (I have learned little about analog circuits, so if there are any problems here, please point them out.)
 
Works appreciation
BH1750 light sensor
3D shell The source files of the web development board
built by our group are developed using Arduino IDE. The development board actually has several source files, which are our course project codes, and need to be connected to our own MQTT server and used when we build our own web pages. All the rules are set by ourselves, and the reference value is not great. So I modified the official source file of Bafa Cloud to connect it to Mijia and make it a temperature and humidity sensor and a light device. Note: The temperature and humidity sensor currently uses AHT20 (SHT30 cannot be sent due to the epidemic). Since the default I2C pins in Arduino are GPIO8 and 9, and the default in ESP-IDF is GPIO5 and 6, you need to modify the Arduino library file and change the I2C pins to GPIO5 and 6. You need to install the "DFRobot_AHT20" library in the Arduino IDE first. The modification method is as follows: find the "libraries" file in the "arduino" file, find "DFRobot_AHT20" in its file, find "DFRobot_AHT20.cpp" in its folder, open it, and modify line 64 to: if(!_init) _pWire->begin(5,6);, then save it, so as to set the I2C pins to GPIO5 and 6. The Bafa Cloud platform settings require you to copy the secret key to the code first, so that the transmitted data will be your own. Then create the topics "temp004" and "led002" written in the code in the "MQTT Device Cloud". The suffixes 002 and 004 represent different devices, 002 represents a light, and 004 represents a sensor. If you are interested, you can take a look at the development documents of Bafa Cloud. Mijia settings Open Mijia, find "Other platform devices" on the "My" page, click Add in the upper right corner of its page, find Bafa Cloud, enter the account and password, and then synchronize the device (the device name is modified on the Bafa Cloud webpage and can be modified at will). After that, you can use Xiao Ai to control it. The demonstration video is as follows: [Bafa Cloud access to Mijia test-Bilibili] https://b23.tv/tEvjfEk said that in the end, it will be connected to more IoT platforms and more IoT devices will be designed. There are three problems with it: 1. You cannot use the serial port assistant of Arduino IDE directly, and you need to use other serial port assistants, but it has no effect in ESP-IDF. I will change the serial port chip to find out the reason later . 2. When using the USB interface of ESP32C3 instead of CH340K serial port chip, the serial port does not respond when powered on, and the program cannot be downloaded in ESP-IDF. I will find out the reason later. There is no effect when using CH340K serial port to download. 3. The board has the default I2C pins of Arduino, GPIO8 and 9, but they cannot be used, so I have to modify the I2C interface. Maybe there is no pull-up resistor? The problem needs to be thought about and found.
 




 


 




 






参考设计图片
×
Design Files
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2024-11-14 23:39:48

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号