The device is connected to the Internet through the emw3080wifi module to receive the control information sent from the mobile phone and the return of the device information. After receiving the information, the data is processed through the microcontroller, and then fed back to the device to realize cloud control of the device. Through the temperature The sensor can also transmit the current temperature to the mobile phone. Because it was the first time I came into contact with PCB design during the summer vacation, there were some shortcomings in the design process. In the schematic diagram, the CH340 and the D+D- of the USB interface were accidentally connected reversely, which resulted in the computer being unable to recognize the MCU after it was soldered. After getting to the chip, I discovered this problem with the help of the big guys in the group.
As a newbie flying cables for the first time, I finally succeeded in getting the computer to recognize the CH340 chip after a busy morning. Then when compiling the example code, an error of insufficient data data space was reported. Baidu found that using xdata data space was enough.
After adjusting the settings in keil, the compilation was successful and the MCU was burned in. The LED started to flash. The next step is The network is configured. I didn't pay attention to the 11.0592MHZ used for burning at first. It turned out that the microcontroller sent garbled information. Change it to 22.1184 and it is normal. Press and hold the button and the microcontroller enters the network configuration mode. After that, the mobile phone scans the code to configure the network. After a short time After waiting, the network configuration is successful, and the indicator light starts to flash quickly to indicate that the WiFi is connected. At this time, you can control the opening and closing of the device in real time through the mobile APP (I haven’t figured out how to connect the electrical appliances, so I will temporarily turn off the relay. to represent), since the function of the inverter was not considered during the design, I originally wanted to use LED to represent the current power-on status of the device. As a result, the LED's on and off are opposite to the power-on status. The LED goes off when the relay is closed, that is, when the socket is opened. The LED lights up when disconnected. . . Prepare to re-wire the LED later, and re-board the board. Correct the wiring errors of CH340, and then use spare components to make another one. Currently, two buttons and two relay positions have been reserved. I will study Song Gong's code and add the control of the two relays myself.
At present, the code of the three-way switch has been changed. Through the app, you can remotely control the on and off of the three switches through wifi, or you can manually control it through the buttons. When the buttons are controlled, the device status will be uploaded in real time, and the status can be seen synchronously on the app. The change. At the same time, Alibaba Cloud's interface design is used to record the hourly temperature and display it through a curve chart. There is a C file in Song Gong's code that specifically operates keys, because at first only one key was used and one key was reserved, and I used three keys. After changing the macro definition of key count to When it is 3, it cannot be controlled by keys. After checking, it is found that the number three is used for the third key. In the for loop, because 0 starts from 1 and corresponds to the key number, the for loop ends when it reaches 2. When reading, The third button cannot be detected. You can successfully control it by changing the number of buttons to 4 in the macro definition.
There are 4-pin OLED headers reserved on the PCB, and the status information can be viewed on the device in real time through the 0.96 screen later.
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