Foreword:
With the help of this activity carried out by Lichuang EDA and Tuya Smart, a temperature and humidity sensor module was customized. The initial requirement is that the APP can obtain the temperature and humidity of the device through the WiFi module. Since this is my first time to participate in an event and post, there will be many deficiencies in the document description, software and hardware design, video introduction, etc.
This design is mainly based on the development and design of STC microcontroller and Tuya WiFi module. The temperature and humidity sensor uses the SHT30 recommended by this event. The display module uses the readily available LCD1602. The Tuya WiFi module is created and purchased through the Tuya Smart IOT platform. All other Components are purchased through the Lichuang Mall platform.
The MCU solution is used to report and deliver data through the Tuya WiFi module, and Tuya has a free public version of the APP, which makes it easy to obtain the temperature, humidity, and status of the device through the mobile APP.
According to the design software and hardware requirements, the prices of major MCUs at home and abroad have increased to varying degrees this year. Considering the cost factor, I chose the MCU and finally chose the STC8G1K17 in TSSOP-20 package. Since it was my first time to get started, and since I was not born in software, my programming ability was limited. The initial requirement was only to obtain the temperature and humidity of the device, and I was able to successfully transplant the MCU SDK. We also encountered many problems during the completion process (most of the program problems), but fortunately they were able to be solved. As the design progressed, we gained a certain understanding and added functions to meet actual needs. It is still possible to add or reduce optimization functions in the later stage. .
Current main functions:
1. LCD1602 LCD screen displays temperature and humidity in real time, unit 0.1 degrees Celsius, 0.1 percentage.
2. It has a temperature control function, controls the operation of a relay, and comes with button settings, which can be used in cooling and heating scenarios.
3. With a remote switch, it can be remotely controlled through the APP cloud, and it also supports cloud intelligent linkage automation control.
Features to be considered later:
1. Add humidity control function.
2. Add network time display to facilitate checking the time.
3. Add AC-DC power circuit, which can be conveniently used for daily life control installation.
...
Design completion progress
================================================== ================================================== ====================
1. Schematic diagram and PCB design
2. PCB component welding and preliminary debugging
3. Peripheral debugging (SHT30, LCD1602, buttons, etc.)
4.Port Tuya MCU SDK
5. Joint debugging and testing
6. Document editing, software and hardware optimization
3D model diagram
================================================== ================================================== ====================
This is the first time I have used EasyEDA to complete a complete project design. EasyEDA has certain advantages from component library to packaging library to 3D library. This picture is a 3D diagram directly exported by Lichuang EDA. Basically, each component has a corresponding library, and it is relatively fast for new users to get started.
Physical map
================================================== ================================================== ====================
The PCB files generated by Lichuang EDA are sent directly to the Jialichuang platform. The prototype production speed is very fast and highly recommended. It can basically be shipped in one day.
The more difficult part in the physical production process is the welding of SHT30. A hot air gun is used. If the welding is not good, it is very likely that the following design will not be possible. At the same time, in order to prevent inconvenient maintenance due to welding and component problems, the display is not directly welded to the PCB, but connected through female headers and pin headers to facilitate inspection of the circuit and solder joints, so the appearance may look smaller. high.
Function Description
================================================== ================================================== ====================
power supply:
Powered by MIcro USB, the actual measurement is about 100mA when the LCD backlight is turned on, WiFi is connected, and the relay is not turned on, and about 250mA when the relays are all turned on.
It is recommended to use an adapter with a supply voltage/current of 5V/0.5A or above.
Controller composition:
1. Press the button: 1 network distribution button + 3 setting buttons.
2. Indicator lights: WiFi status LED (blue), power LED (red), two-way relay switch status display LED (green).
3. Display: 1 LCD1602 liquid crystal display, which can display real-time temperature and humidity, setting information, and switch status.
4. Buzzer: 1 active buzzer, used as a power-on prompt and alarm prompt.
5. Relay: 2 normally open relays, 1 routing module setting startup, 1 routing APP cloud control.
6. Others: MCU, WiFi module, temperature and humidity sensor, etc.
Display instructions:
Real-time temperature: Real-time temperature measured by SHT30
Real-time humidity: Real-time humidity measured by SHT30
Opening temperature: The opening temperature set by the user
Stop temperature: user-set stop temperature
Set the selected flag: the user sets the start temperature and stop temperature selected flags
Relay status display: K1 and K2 are relay K1 and relay K2 respectively.
Off: The relay status is off and displays "X"
Open: The relay status is closed and displays "-"
Distribution network:
1. After the module is powered on for the first time, it automatically enters the network ready state (anti-accidental touch mode), and the WiFi indicator light flashes quickly to enter the next step;
2. Download and open the "Tuya Smart" APP on your mobile phone and make sure it is under the 2.4G WiFi network. Add a device on the homepage, select "Sensing", select "Temperature and Humidity Sensor (WiFi)", enter the network name and password, and wait for the connection to be successful; this design uses Tuya WiFi and Bluetooth dual-mode chip WBR3. After clicking to add the device, it will automatically The device is displayed and can be quickly added. After successful addition, proceed to the next step;
3. After the addition is successful, the temperature and humidity of the device can be viewed in real time through the APP, and the device relay K2 can be controlled through the "switch" of the APP, and the status is displayed synchronously.
4. If the device needs to change the connection network, you can reset the WiFi by pressing and holding the KEY1 button for more than 2 seconds. At this time, the WiFi indicator light (blue) flashes and enters the first step.
WiFi indicator (blue) status description:
1. Flashing quickly: in Smart configuration state.
2. Flashing slowly: It is in AP configuration state.
3. Steady off: Wi-Fi configuration is complete and connecting to the router.
4. Heartbeat status flashes: The router is connected successfully.
5. Steady on: WIFI has been connected to the cloud server.
Note: The current default is Smart configuration state, and switching distribution mode has not been programmed.
Temperature control mode setting:
The buttons KEY2 and KEY4 are the buttons to decrease and increase the set temperature respectively, and KEY3 is the button to switch the start temperature and stop temperature. The LCD has a corresponding display for the corresponding selection.
1. When the starting temperature > the stopping temperature, the equipment executes the cooling mode, and the relay K1 controls the cooling device (such as a fan). That is: when the real-time temperature >= the start temperature, the relay K1 is opened until the real-time temperature drops to the stop temperature, then the relay K1 is closed.
2. When the starting temperature < the stopping temperature, the equipment executes the heating mode, and the relay K1 controls the heating device (such as a heater). That is: when the real-time temperature <= the start temperature, the relay K1 is opened until the real-time temperature rises to the stop temperature, then the relay K1 is closed.
3. When start temperature = stop temperature, both modes are turned off.
other instructions:
LCD display contrast: Use a screwdriver to adjust the potentiometer on the lower left side of the LCD screen to change the contrast.
Relay: The maximum parameter of the relay control equipment is 10A 250V AC/10A 30V DC.
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