All basic functions have passed the test and are all normal. All functions have been realized. Except for the amplification design of the op amp part that is too high, the rest of the circuit is normal (V2 version has been corrected).
In the PCB layout, the Tuya module uses a module with an IPEX interface. If the antenna is not plugged in, no radio frequency will come out. You need to plug in the radio frequency antenna (V2 version has been corrected).
The code is shared on GitHub, there is a link at the end of the article, and only the firmware is provided in the attachment.
Finished product renderings:
To facilitate debugging, the panel is not attached.
Actual circuit board:
Component side
screen surface
1. Function overview:
1. Supports detection of C02, temperature, humidity, illumination, formaldehyde, PM2.5, and noise.
2. With 2.8-inch TFT touch screen, supporting color display and touch control.
3. Supports battery power supply, using 3.7V lithium-ion battery.
4. Support battery power detection, overcharge, over-discharge, and low-voltage protection.
5. With buzzer, it can be used for detection and alarm.
6. With a one-button power-on circuit, under normal circumstances, when the machine is turned off, the lithium battery will only draw a few microamps of current.
7. Support LCD backlight adjustment.
2. Design functions:
1. User operation interface
realizes the operation interface of the machine that interacts with the user (for example: sliding screen, parameter setting, parameter viewing, etc.).
2. The cloud service
directly uses Tuya Cloud to provide cloud services, and the box detection parameters can be viewed at any time on the mobile phone.
3. Power management
controls the working conditions of different circuits when the power is plugged in, not plugged in, or the battery is low, and maintains stable operation of the box under specific conditions.
4. Intelligent warning:
When a certain detection value exceeds the standard, the buzzer will sound the alarm, and the screen will display the specific alarm item. The user can cancel the alarm by pressing the button.
3. Function realization
1. The user interface is divided into main interface, details page, settings page and information page.
1) The main interface mainly displays the actual parameters of several important detection data (PM1, PM2.5, PM10, temperature and humidity, formaldehyde, carbon dioxide). The main page has weather and calendar functions, which can display weather information released by the current city.
2) Details page, this page can display the data of all sensors, and the data is updated in real time.
3) Setting page: This page can modify some parameters of the control box (such as temperature scale, calibration time, reset WIFI, etc.).
4) Information page: This page can display the box’s operating information and author-related information.
2. Cloud services
Choose Tuya's wbr1d module and go directly to Tuya Cloud. Regarding the module, the module selected in the V1 version does not have an ipex interface, because it is installed in the box. It is recommended to choose a module with an IPEX socket, which has a better signal.
3. Power management
The power of the box can be turned on/off through the power button to turn it on and off. At the same time, after the box is running normally, the buttons can also be used as ordinary buttons, allowing one button to be used for multiple purposes.
It has a built-in 3.7V 2000mAh lithium-ion rechargeable battery. The board is equipped with power management and boost circuits, which can realize functions such as charging management, battery power supply, power supply + battery, single power supply, and battery over-discharge protection.
Equipped with battery power monitoring, it can adjust the power consumption of the box according to changes in power to protect the battery from damage.
Built-in lithium battery boost circuit, with high boost efficiency, low loss and high output power.
4. The shell and sensor
shell use a common mode shell, and the appearance is a little different.
Since the shell is a common-mode shell, the dimensions are a bit inappropriate in some places during installation, but they are within the acceptable range.
The sensors use off-the-shelf modules. As follows:
Dust sensor, model: PMS7003, has high accuracy, stability, and relatively low power consumption.
Formaldehyde sensor, model: DART WZ-S, has high accuracy and low power consumption. It just takes a while after power-on for data to be returned.
Carbon dioxide sensor, model T6703-5K, has high accuracy and low power consumption. Please pay attention to keeping the detection port away from debris and stains.
Personally, I think this module should be led out with a flat cable, otherwise it will take up too much space when soldered on the board, and it will be difficult to disassemble.
5. Description
1. The program is written using a firmware library, and the code is constantly updated to fix bugs.
2. The box uses an LCD screen, which supports Chinese character display and picture display. Since Chinese characters and pictures are to be displayed, a Chinese character library and a picture library (used pictures) are required.
The font library and image library are stored in external Flash (W25Q128). If there is no image library and font library in W25Q128, the box cannot operate normally.
3. The font library and image gallery are written together with the STM32 program when downloading the box program. The principle is to load the STM32 external SPI Flash programming algorithm through MDK to program W25Q128.
It only needs to be programmed once, and there is no need to modify the internal data of W25Q128 later. Modifying any part of the microcontroller program will not affect the font and library data inside W25Q128 (except for full chip erasure).
4. Compared with the capacitive screen, the resistive screen used for the display screen has a slower touch response and is prone to error detection, so do not click too fast during operation.
5. Please refer to the instructions in the attachment for how to download the font library and image gallery.
Code repository: https://github.com/VCJ-550/SmartAirSTM
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