1. Project introduction:
This design project is used for the project work of the Internet of Things winter vacation training camp activity jointly carried out by Lichuang EDA and Tuya Smart Platform. The theme is indoor temperature and humidity sensor based on Tuya Smart IoT module + MCU control.
The WiFi IoT module designed for this circuit selects the WBR3 module under the Tuya Smart Platform , and the MCU main control chip selects ATmega328PB-AU (note B) . The indoor temperature and humidity sensor uses the high-precision digital temperature and humidity sensor SHT30-DIS , which supports Micro 5P [5V] power supply and lithium battery [3.7V] power supply. It is designed to automatically switch power supply, lithium battery charging and lithium battery power . display and other functions . The circuit schematic drawing and PCB design were both done using the Lichuang EDA client; the casing was designed using SolidWorks 2020, and its manufacturing process was made using 3D printing technology, and the material was PLA.
The IoT temperature and humidity sensor of this project can collect and process indoor temperature and humidity data in real time . Through intelligent distribution of WBR3, it can be viewed through the Tuya APP on the mobile phone. At the same time, the temperature and humidity data can also be viewed through the 0.96-inch 4-pin OLED screen. real-time display. The collected indoor temperature and humidity change data can be stored in the cloud and displayed on the APP in the form of a line chart . At the same time, the main control chip leads to four pins and is connected to four LEDs of red, green, blue and orange , which can be customized . Develop temperature and humidity alarm mechanisms , network distribution mode instructions , etc.
2. Function introduction:
1. The IoT WiFi module WBR3 is developed based on the Tuya Smart platform, and data can be remotely monitored and viewed through the Tuya Smart App;
2. Configure SHT30 high-precision digital temperature and humidity sensor to collect indoor temperature and humidity data;
3. The 0.96-inch 4-pin OLED screen displays temperature and humidity data in real time and refreshes every 20 seconds ;
4. It has WiFi intelligent distribution network function and can be controlled wirelessly when connected to the Internet;
5. Supports Micro 5P 5V power supply and lithium battery 3.7V power supply;
6. The power supply circuit can automatically switch and can terminate the power supply of the lithium battery when powered by 5V;
7. Lithium battery power display function, indicating the remaining power of the lithium battery;
8. Micro 5V can charge lithium batteries when powered ;
9. Lead out the ISP programming port to facilitate the programming adjustment of the bootloader ;
10. The MCU leads to 4 pins, which can control LED indicators of 4 colors : red, green, blue, and orange.
3.Design features:
4. Component selection:
1. The IoT module uses Tuya Smart ’s low-power embedded WBR3 module, which supports wireless communication methods such as WIFI and Bluetooth ;
2. MCU chooses ATmega328PB-AU . Compared with ATmega328P , it has new multi-group iic , spi , and uart hardware communication serial ports , which are more powerful and supports Arduino programming. It also supports changing to ATmega328P; (the pin functions are the same)
( You need to download and configure the corresponding MiniCore development board library from Github : Add the development board management URL in the preferences of Arduino IDE: https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json ,
Search for MiniCore download in development board management. )
3.5V供电口选用micro 5P接口,与安卓接口的手机数据线通用,使用方便;
4.温湿度传感器选择SHT30,测量精度高,反应灵敏,功耗低,价格合适;
5.LED、电容、电阻均选择0603封装,节省空间,又锻炼焊接技巧;
6.锂电池充电模块选择TP4095,使用方便,充电电流稳定,搭配LED指示效果强;
7.电量显示模块选择HM1160,成本低廉,原理易懂,节省设计内容,效果稳定,功耗低,不过要去淘宝采购;
8.显示屏选择0.96寸4针OLED-黄蓝屏,采用I2C通讯,成本低廉,显示效果稳定,功耗低;
9.USB转TTL电路选择CH340C管理,成本低,效果稳定,原理易懂,常用选择;
10.选择PS7516作为3.7V转5V升压电路的DC-DC管理芯片,升压效率高,升压效果棒。
5.APP界面:
配网步骤:
Tuya模组调试成功截图:
6.程序设计:
GitHub地址:https://github.com/BlackRain543/Indoor-temperature-and-humidity-sensor.git
1.所使用的Arduino库文件:
#include <U8g2lib.h> //OLED驱动
#include <ClosedCube_SHT31D.h> //SHT30驱动
#include <SoftwareSerial.h> //通信串口设置
2.LED指示设置:(蓝,绿LED指示湿度,红、橙LED指示温度)
7.外壳设计:
【SolidWorks建模,Keyshot 9渲染。】
外壳设计思路:
3D打印参数(总共4件):层高0.15mm,填充(15%),无需支撑。
8.成品展示:
9.设计心得:
经过本次的物联网训练营基于MCU方案的PCB项目设计,学习到了许多与实际设计PCB中相关的新知识,例如锂电池的电量检测,锂电池的充电电路,ATmega328p基于供电电压对晶振的选择等,同时进一步熟悉了立创EDA的操作,了解到了更多关于PCB器件布局,布线的设计细节。
本次设计在电源管理方面进行了较多尝试,初次尝试了设计与MCU相关的电路。在起初设计过程中,跟着训练营的课程与去开源广场的参考并未感觉到有多少困难,但是当收到PCB板并焊接完成后上电的那一刻才发现到了第一次崩盘:无法烧录bootloader引导程序。毕竟Arduino开发与STM32相比更简单是因为IDE里有很多铺垫,但当自己铺不上的时候就倍感难顶。而且由于本人工具缺少难以拆焊,飞线本领也不到家,所以本人当即修改引出烧录口后与调整下载电路后进行了第二次打板,毕竟新年将至时间不多了。
然而第二次打板后的硬件调试过程依旧阻碍重重。。。
After this Lichuang Tuya IoT training camp, I feel that I have really learned a lot, because if I don’t learn so many things, I wouldn’t be able to get to this point, haha, haha. The production of this project took a total of three layouts (three colors were changed hehe). The changes made when each stuck difficulty point is finally solved are basically not many places. The reason why it is time-consuming is that you have to screen all the possible problems and continue to narrow down the scope of the bug before you can basically determine it. What exactly went wrong. Although Ardunio is easy to use in daily life, it is actually not simple to build from the hardware and bottom level. The reason why it is convenient in many places is that many pioneers have already paved the way. I hope that I can become more proficient in subsequent MCU development projects.
[But if I develop an MCU next time, I decide to choose STM32.ヾ(・ω・`。) ]
Lichuang EDA platform and Tuya Smart provide developers with a good display and communication platform. What I especially like are the weird and innovative PCB designs on the Open Source Square. Many of them I want to make and play with. Tuya Intelligence also provides developers with a good communication platform, paving the way for developers to develop a very complete basic platform and creating a good ecosystem in terms of Internet of Things development. During this period of time, a series of training camp live broadcasts and exchanges filled the gap between my circuit PCB design bridge between modeling and programming, thinking that I would also work hard to become a person who can provide many complete and excellent open source tools. The developer of the project. I am very grateful to Lichuang EDA and Tuya Smart for providing a good training opportunity.
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet