Based on the WIFI+BLE module WB3S, GD32F350 is used as the main control to realize the basic functions of the temperature and humidity sensor. In addition, there are other external expansion functions, including:
1. Infrared remote control (for remote control of air conditioners, TVs, etc.);
2. OLED display;
3. One relay (for 220V electrical switch);
4. Eight-way servo interface (for robot arm control, etc.);
5. RTC real-time clock, the time will not be lost even if the power is lost;
6. Available with TYPE-C interface for power supply;
7. It can also be powered by 3.7V lithium battery or 1.5V dry battery, and the battery voltage can be detected;
8. In addition, there are 2 user buttons, 1 RGB, and 1 power indicator light.
It integrates multiple functions into one and can flexibly adapt to IoT control in different scenarios.
As of release, the following functions have been completed:
1. Basic functions:
(1) Collection and reporting of temperature and humidity.
(2) Communication between the Wifi module and the MCU, and the device is connected to Wifi and the cloud.
(3) Mobile phone interface, various parameters are displayed through the interface, and corresponding functions can be controlled by issuing parameters.
(4) GUI interface design of device-side OLED.
(5) 3.7V battery voltage detection, OLED display and App interface display.
(6) RGB light display, the Wifi module will display different colors when it is in different states.
2. Extended functions:
(1) RTC real-time clock, OLED display, once connected to the cloud, the time will be automatically calibrated, and the device will not stop timing even if it is powered off (but the error will become larger as time goes by, so time correction is required).
(2) Infrared learning, receiving infrared signals through the infrared receiving tube and transmitting the received signals. For example, the air conditioner remote control button receives the coded value of one button at a time, and then presses the button of the device to emit the learned signal (mainly used to read the infrared coded value during the debugging phase, which is commented out in the code).
(3) Air conditioner remote control (air conditioner brand: Changhong), the coded value stored through infrared learning is recorded (currently only the three buttons of power on, power off, and full automatic are recorded, and can be expanded later if necessary), which can be accessed through the App interface Control air conditioning.
3. Functions to be completed:
(1) The App interface controls the servo and then controls the light switch. The software has been implemented and the hardware has yet to be implemented.
(2) The App interface controls the relay and then controls other electrical appliances. The software has been implemented, but there are no other devices that require relays in the dormitory, so it cannot be displayed.
1. SHT3x temperature and humidity sensor
Refer to the SHT3x chip manual, mainly the preparation of command and data timing, and the 8-bit CRC check to prevent data transmission errors.
2. WIFI module WB3S
Using the Wifi firmware library and connection package provided by Tuya Smart IOT platform, functions such as temperature and humidity sampling time setting, temperature and humidity cycle reporting, battery voltage, battery power status, temperature alarm, and switch are used.
3. Infrared learning/air conditioning remote control
It is written with reference to the NEC protocol of infrared. It uses the timer input of GD32 to capture and receive infrared, and uses the PWM output 38kHz carrier wave to transmit infrared. The brand of air conditioner is Changhong KK29A. After testing, it is similar to the NEC protocol, and the coded value of the button is easier to parse. The picture below shows the waveform obtained after infrared learning the switch of the air conditioner, and the emitted infrared is demodulated and amplified by the receiving tube. After comparing with the waveform transmitted by the air conditioner remote control after passing through the receiving tube, it is basically the same except that the waveform is unstable when the high level changes to low level, and the air conditioner switch can be controlled.
4. GD32F3x0
The GD32 official website of GigaDevice has GD32 chip manual, firmware library user guide, user manual, routines and other information. It is very complete, making it easy for me to switch from STM32 to GD32. This time I mainly used the timer, ADC, RTC, external interrupt and other functions of GD32.
5. Tuya Smart App Interface
It is convenient and fast to use the graphical setting panel of the Tuya Smart IOT platform. The panel is as shown below:
1. Board making and welding.
2. Be sure to check the user library of Lichuang EDA when using it. I accidentally used the WB3S package backwards, so I could only install it in reverse.
3. The layout of the infrared emitting diodes is based on the one made by DL from the first Internet of Things training camp. Seven diodes require a larger current for emission, so it was later changed to five. The two extra diodes will not be removed and are only for decoration. If you need more current, you can replace the 500mA fuse with one above 1A.
1. GD32 routines and manuals can be found on the GD32 official website, see the appendix.
2. Infrared NEC protocol, CSDN.
3. Tuya Smart IOT platform support documentation.
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