黄土马家

[Training Camp_Advanced Class] Alibaba Cloud Temperature Measurement Socket +636382A

 
Overview

### **【Overview】**

Due to time constraints and safety issues, the 220V lamp is temporarily replaced by a 3.3V LED lamp to show whether the relay is working.

Alibaba Cloud smart socket based on EMW3080, main control chip STC15W4K56S4,

peripherals: three relay control switches, three buttons, a temperature sensor, a buzzer, four LED indicators, WIFI module EMW3080, etc.;

power supply: a power indicator, 5V power supply interface, Type-C interface (for power supply and program burning), etc.;

pins: OLED four-pin interface, external expansion pins, etc.;

others: an LDO reset button, CH340E, etc.

Demonstration diagram description:

![123png.png]
### [Function description]

1. The three buttons control the switches of the three relays respectively, and upload the switch status to the cloud smart app for real-time display;

2. The mobile cloud smart app can also control the switches of the three relays and a buzzer;

3. The temperature sensor uploads the measured temperature to the cloud smart app for display (upload once every 1 minute);

### [Drawing board and welding experience]

1. Check the schematic diagram to make sure there is no problem with the network. I forgot to add a 5V network identifier to a place in the 5V power supply network before. After proofing, I found that the voltage could not be supplied, so I had to jump the wire manually. . .

2. Think about the PCB layout in advance, and then adjust the IO port position of the schematic diagram. At the beginning, I didn't consider the schematic diagram. I just picked a few IO ports of the microcontroller and laid them out in any way I wanted. When I connected the network, I found that many lines had to cross and many vias were placed. In the end, I couldn't even solve the vias.

So I thought about the layout in advance for the second time, changed the positions of different IO ports in the schematic diagram, and the network of the IO ports also followed the package of the microcontroller. Finally, it succeeded!

3. The antenna area of ​​the wifi module can be grooved, and copper should not be laid. If conditions permit, it can be directly extended out of the PCB.

4. The width of the 220V line should be more than 2mm. The relay and 220V terminals should not be laid with copper. Grooves can be dug between the two points of the terminals to protect the circuit.

5. When welding, first weld the more difficult patches or components that are easier to weld. Otherwise, weld the other difficult ones after welding. If you accidentally weld them, the previous efforts will be wasted.

### [Debugging experience]

1. The program is modified with reference to the source code given by the WeChat public account of IoT Zero Demon. The logic in some places is not very rigorous.

2. The switch-case statement needs to add break, otherwise sometimes the program runs differently than you think.

3. The separation of business and underlying code is very useful, efficient and neat, and also improves versatility. This structure should be used more in the future.

4. The product attribute identifiers of the Alibaba Cloud Life IoT platform are case-sensitive, so pay attention to whether they are consistent with the program.

5. The products created by the IoT platform did not have one-click network configuration set at the beginning, and it took a lot of time to manually configure the network.

6. After the 51 microcontroller IO port is powered on, it is in high-impedance state by default, and needs to be manually set to a normal IO port. When the buzzer is used, the buzzer never sounds. After a long time, I remembered the characteristics of the 51 IO port. After checking the information, I found that the ordinary IO port is weak pull-up, and the current that can pass is very small (150uA~270uA), which cannot drive the buzzer to ring. By setting the corresponding IO port to push-pull mode (strong pull-up, the current that can pass is 20mA), the buzzer can be driven normally.

7. The OLED display can be expanded and the timing function and countdown function of the switch can be added.
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-23 08:50:23
  • KW41Z multi-function track recorder (analog serial port part)
  • About the transplantation of ucos on C167CR
  • Sincerely ask vs2005 to compile VdwLibs.dsw
  • Problems with the coexistence of EVC and Visual Studio 2008
  • Verilog SOS
  • How to configure J-Link when debugging external norflash program?

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号