fish001

Alibaba Cloud emw3080 IoT switch function verification board

 
Overview

This document is an excerpt from the summer advanced class document, with some added experience based on my own experience.

Required items and tools:

Hardware: USB power supply, WIFI control, relay (with load within 100W), mainly PCB circuit board. Need to do it yourself. Embedded: Respond to the instructions of the WIFI module to perform corresponding actions and control the WIFI module to enter the corresponding state. Use the WIFI module EMW3080 to connect to the Alibaba Cloud IoT platform (Tmall Elf) and respond to the instructions of the WIFI module to control the 51 microcontroller to perform corresponding actions (relay on and off). Mobile APP: Different users can configure the network, control the relay status, read the relay status, and manage multiple devices. Alibaba Cloud has a public version of the APP for easy debugging. If you have the ability, you can also write it yourself. Server: Can connect WIFI module and mobile phone, can maintain user information, and is not easy to crash. Alibaba Cloud provides IoT servers. If you have the ability, you can rent your own server to store data.

Hardware planning:

1. Select 51 microcontroller as the main control chip, model STC15W4K56S4-LQFP48. The general-purpose chip is easy to use and is available on Lichuang Mall. It is affordable and has complete packaging and 3D packaging. QQ screenshot 20200813174357.png

2. The board must first be designed with a USB to TTL converter to burn code into the microcontroller. The model is CH340E. The peripheral circuit is simple. There are many examples on the Lichuang open source platform for reference.

QQ screenshot 20200813174357.png



3. The STC microcontroller needs to be powered off to complete the reset. Use an LDO with an enable pin and a button to achieve the purpose. The LDO model is ME6215C33M5G. This project has designed 2 sets of LDO power supply circuits, one is to power the microcontroller and the other is to power the wifi module. Please see the circuit diagram for details .

QQ screenshot 20200813174357.png



4. Just choose an ordinary relay, HK4100F-DC5V-SHG. Pay attention to the driving voltage of the relay coil. The output of the USB interface is 5V.  The price of HK4100F-DC5V-SHG is slightly expensive, but the circuit diagram is easy to understand, making it suitable for novices like me. Other cheaper relays can also be used .

QQ screenshot 20200813174357.png


6. The relay driver requires special design (as long as it is a board with relays, it is recommended to specially design the driver circuit). For reliability, the special chip NUD3124LT1G was chosen. This drive circuit is high-level triggered. The IO port of the 51 microcontroller defaults to high level after power-on. In order to shut down reliably at the moment of power-on, an inverter SN74LVC1G04DBVR is added.

QQ screenshot 20200813174357.png



6. Select EMW3080 as the WIFI module. The communication module has been officially certified by Alibaba Cloud and is safe and reliable. AT commands are directly connected to the Alibaba Cloud platform to simplify development and ensure reliable supply of commercial modules. (Purchase version: Alibaba Cloud Feiyan Firmware Global Version)

Purchase link https://item.taobao.com/item.htm?spm=a1z09.2.0.0.67002e8dU8xwNY&id=552081365687&_u=bekcj834b4

You can also choose "Anxingke's" esp8266" WIFI module, both of which have been certified by Alibaba Cloud.

This project uses the "Qingke emw3080" wifi module. When drawing the wifi module, please read the data manual and remember to leave space around the antenna. The best ones have windows underneath the adventure. My approach is to design the wifi module on the back, firstly, to reduce the board area, and at the same time, open a window at the antenna to prevent affecting the signal.QQ screenshot 20200813174357.png

 

Schematic design

**1, USB to TTL. **Classic design, copied from specifications. D1 in the picture is to prevent the TXD pin of the chip from supplying power to the microcontroller, causing the microcontroller core to be unable to completely power down. The purpose of adding a 100uf tantalum capacitor near the VCC pin is to provide the chip with strong current supply capability and prevent the CH340 chip from being reset the moment the relay is opened.



2. LDO step-down. WIFI and microcontroller are powered separately to ensure stable power supply for the communication module. An LDO with an enable pin was selected to facilitate external control of the output status of the LDO. You can see in the schematic diagram that there is a distinction between LDO1 and LDO2****


**3, DS18B20 and other peripherals. **A DS18B20 interface is reserved for easy access to the temperature sensor, a button is used to reset the device and re-configure the network, and four LEDs are used to indicate different device statuses. If you are interested, you can study access to peripheral products, such as LED displays, various sensors, etc.

**4, relay drive circuit. **The inverter ensures that the relay is reliably turned off when the MCU is powered on, and the NUD3124 ensures that the relay is reliably driven.

5. WIFI module, EMW3080. A highly reliable commercial WIFI module that has undergone official rigorous testing when connected to Alibaba Cloud. The firmware we choose is Alibaba Cloud Feiyan's dedicated firmware, also called ILOP firmware. You need to confirm with the seller when purchasing.

This module can upgrade and modify the firmware through the serial port: https://www.yuque.com/lingyao/jing/isdnec

Resistors R10 and R11 can be removed under special circumstances and the pads can be used as test points.

AT command description of ILOP firmware: https://www.yuque.com/lingyao/jing/fpiyi2

**6, STC microcontroller. **Classic 51-core microcontroller. The peripherals are simple and there are not many peripherals used. According to the plan, the microcontroller here needs to have a serial port, a timer, and several ordinary IO ports. For students who don’t understand, you can search on Baidu, there is a lot of information.

Issues needing attention in PCB drawing

1. Do not lay copper on the strong current part. Pay attention to the safe distance between strong current and strong current, strong current and weak current (try to 3mm, consider trenching if it is lower than 2mm, but the PCB strength issue must be considered); (This is very important)

2. It is recommended to use terminals when the relay is connected to an external 220V. It is not recommended to use pin holes. The wire diameter from the relay to the terminal should be thick; (This is very important. Generally, the wire width between the relay and the terminal should be set above 1.0.)

3. Place the terminal blocks and microUSB on the edge of the board, otherwise it will be difficult to wire them. You can use 3D preview;

4. The button is too close to the high voltage, and the button is in the middle of the board, making it difficult to press;

5. The power supply must filter the filter capacitor first and then to the microcontroller/WiFi module; (This is very important. The filter capacitor must be filtered first and then to the chip. Otherwise, it will cause unnecessary trouble, such as unstable command execution)

6. WIFI will generate heat when working properly, so pay attention to the heat dissipation design; (if the funds are available, you can stick a heat sink on the back and then lead out the antenna. 3080 has an external antenna version)

7. A clear area is required below the WIFI antenna, and slotting is best; (such as PCB diagram)

8. If there is a plastic mold, you should pay attention to the size of the mold space when selecting components. (It is recommended that after designing the board, you can design the 3D printing mold and print the shell on a certain store; you can also find the finished shell and then design the PCB according to the size of the shell)

PCB component welding problems

Newbies are advised to place an STM order (SMT). Don’t be afraid of spending money and weld it yourself. 9 out of 10 welds will cost 8 out of 10 failures. Although STM is expensive, it saves trouble. Less error rate

The most difficult thing to solder on the whole board is the 51 microcontroller chip, which has many pins, and novices are recommended to use "solder paste" to solder it~~As shown below, you can use an air gun or an electric soldering iron. An electric soldering iron is recommended.

IMG_20200816_165014.jpgThe pins climb smoothly

During the first welding, a large rollover occurred. The pins were too small and misaligned, causing the pins to shift and the welding to fail.

Cache_663101eec2ef05a7..jpg


So I did the second welding~,

IMG_20200816_175212.jpg


No problem with the second welding

When welding, the excess tin can be handled with an electric soldering iron (blade) and just take out the excess tin.

IMG_20200817_172323.jpg




Debugging process

During debugging, the microcontroller chip could not be recognized, and it was stuck at "Detecting target microcontroller..." motionless.Cache_5df0979f42cbc9bb..jpg


At the same time, during the process of writing the code, there was a problem with the code and the compiled file could not be generated.Cache_-3183397b1fb7a448..jpg

After checking, it was found that there was a problem with the software environment. I reinstalled the programming software and the problem was solved.

But the microcontroller chip still cannot be recognized. After checking the information, it is necessary to connect 330R resistors to the RXD and TXD pins of the C340E chip (the schematic diagram only adds TXD. In theory, it can be omitted, but in order to eliminate the problem, it is better to add one ), but the board has to be laid, so it can only be connected to the RXD line. Physically connect the 330R. Use a knife to scrape the surface of the line to leak out the copper, and then solder it.IMG_20200818_114109.jpg


After welding, the burning software still cannot recognize the microcontroller chip. After comparing the schematic diagram, it is found that the output RXD and TXD signals of the C340 chip are connected in reverse (it should be RXD connected to MCU_TXD, TXD connected to MCU_RXD, the two are reversed) as shown below.QQ screenshot 20200820174625.png


After the change, flying wires were processed on the board, but the chip still could not be recognized, and the problem is still being solved. . . . . . . As of August 25, this solution still cannot recognize the chip, and this solution is invalid. According to everyone's plan, there should be a problem with my PCB component layout. The second version (revised) of the board is still on the way~~I don’t know if it will work.

The significance of doing this project

Understanding the basic IoT implementation process can lay a solid foundation for subsequent projects. Our smart homes (lights, curtains, water boilers, etc.) are basically based on this principle; lights are the simplest, and others need to be expanded. Other functional circuits)





参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-20 02:15:10

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号