smallembedded

[Training Camp_Advanced Class] Internet of Things Socket-371541A

 
Overview



The introduction of IoT socket is as follows:


  1. Use ESP12f as the main controller, use 5V power supply, use AMS1117 to convert 5V to 3.3V, and use CH340E level conversion chip;
  2. Using Arduino programming language;
  3. Equipped with 3-way relay and DHT11 temperature and humidity sensor;
  4. It has 1 LED light and 1 button, which are used for testing and one-click network distribution respectively;
  5. Using MQTT to establish communication with the Alibaba Cloud platform, the relay on the hardware device can be controlled through the computer or mobile terminal, and the temperature and humidity data can be reported;
  6. The mobile terminal uses cloud intelligent APP for command control and data collection;
  7. You can use Tmall Genie to control the socket.

Note: Detailed steps to follow!


The specific debugging steps are as follows (2020-8-14):

  1. From Jiali’s singles board, let’s take a look at the picture first:

Front.jpgreverse side.jpg

This board initially looks okay, and the layout and wiring are also okay. Next, we are going to prepare for welding and debugging. 2. First start welding from the power circuit and download circuit. Prioritize welding the CH340E and microUSB here. A horseshoe-shaped soldering iron tip is used here. Do not add too much tin when welding, as it is easy to cause joint welding. Rosin is also essential; secondly, welding Power chip AMS1117, switches, resistors, capacitors and other small components, how to solder these components smoothly? I used Huanghua soldering iron 907S, and the soldering temperature was adjusted to about 300°C. Finally, after the soldering of this part of the circuit is completed, do a visual inspection Is there a short circuit? Then use a multimeter to measure the open short circuit. After it is correct, power on and measure whether the voltage is normal. What I measured here is 3.36V, and the voltage is normal (PS: I don’t know why this picture is turned upside down).

Power 1.jpg

After the power supply is normal, connect the computer and the board to see if the CH340E can be correctly recognized. The premise is that the CH340E driver has been installed. Here my device can be recognized by the computer, so it is normal. 3. Solder the ESP12f module and its necessary resistors and capacitors, and then test whether the firmware can be downloaded normally.

CH340.png

Download 1.png

Download 2.png

Through the test, the download is normal, and we can know that the ESP12f can run normally. 4. When welding other external components, priority is given to welding patch type components. I welded them in order from small to large, which is more convenient. The last welding includes relays, sockets, and connectors such as DHT11.

Whole board.jpg

The above is a picture of the whole board that has been welded. Overall, it is good. After the welding is completed, measure the open and short circuits and the voltages at various important points again to see if they are normal.


Next, start debugging the program. The program is programmed using Arduino. Because Arduino has corresponding library files, it is more convenient to use. The code written is not that complicated. The program flow chart is as follows.

Program flow chart.png

PS: The code will be open sourced later, and the code matches the schematic and PCB.

This project uses Alibaba Cloud Smart APP, which is easy to configure. You only need to drag and drop to build the APP.

Note:

  1. Since the ESP12f has not been certified by Alibaba Cloud, please pay attention to the following points when using the Cloud Intelligence APP.

Create product.png When creating a product, select the cellular networking method for the underlined part above.

chip.png When selecting the authentication module, choose Hezhou Air202. Only if you choose these two steps correctly can you use the cloud smart APP network configuration normally.

2. This project has a network distribution function, which can be configured through Anxinke’s WeChat network (you can follow the official account of Anxinke Technology to obtain it); the network cannot be successfully configured using the one-click network distribution method that comes with the Cloud Intelligence APP, because the ESP12f does not have Certification.


This project enables Tmall Genie to control the opening and closing of sockets (only 1 channel can be controlled).


Project summary:

  1. The average working current of this IoT socket is about 500mA when the 3-way relay and DHT11 work together. Therefore, when laying out and wiring, the current carrying capacity must be taken into consideration, and the power inlet should be laid with copper as much as possible. It is recommended to select a rated power chip. The current is above 1A;
  2. The DHT11 used at the beginning was purchased from Taobao. The quality was not very reliable, which caused the sensor to be burned out and the capacitor and other components to become hot. At this time, the measured current reached nearly 1A. This fault was eliminated and a temperature and humidity sensor was replaced. The circuit It operates normally and can read temperature and humidity values ​​normally. It can be seen that you still have to buy components from formal channels. Lichuang Mall is highly recommended as the quality is guaranteed;
  3. In the later stage, this project will be optimized, AC-DC circuits will be added, power circuits will be optimized, control circuits will be streamlined, and the size will be reduced.

IoT socket optimized version (2020.8.18)

Project link: https://oshwhub.com/txiaomi/dan-lu-wu-lian-wang-cha-zuo .

  1. This version adds AC-DC circuit;
  2. Reduce the 3-way relay in the original project to 1 way;
  3. Delete the download circuit of the original project and draw the downloader separately (link: https://oshwhub.com/txiaomi/esp12f-xia-zai-qi );
  4. Draw the ESP12f conversion board separately to make full use of the PCB board space (link: https://oshwhub.com/txiaomi/esp12f-zhuai-jie-ban );
  5. Expandable DHT11, DS18B20.

NOTE: This optimized version of the IoT socket contains 3 versions , which can be viewed in version switching. The main difference lies in the processing of the power circuit and the size of the PCB board. The differences between each version are as follows:

master ( this version has been verified, the following pictures and videos demonstrate this version ):

  • The core component of the power circuit adopts Hi-Link's AC 220V to DC 3.3V power module (model HLK-PM03). This module can be purchased at Taobao Hi-Link flagship store or Lichuang Mall;
  • The PCB size for this version is 60mm x 6mm.

V1.0:

  • The power circuit uses a 220V to 5V module purchased on Taobao (link: https://m.tb.cn/h.VvlVmt2 );
  • Some buttons have been deleted and the button packaging has been replaced;
  • The PCB size of this version is 38mm x 50mm , further reducing the size.

V2.0:

  • This version is a modification for the master version, the power circuit is the same, and some buttons are deleted;

  • The PCB size for this version is 50mm x 55mm.

    • -

1-1.jpg1-2.jpg The core chips of the download board in the picture above use CH340E and AMS1117, which can download ESP12f and ESP01s. NOTE: After clicking download, follow the steps below:

Press Boot -> Press Rst -> Release Rst -> Release Boot

1-3.jpg1-4.jpg

The picture below shows the normal operation of the IoT socket. For a project demonstration, see the attached IoT socket optimized version demonstration. Cover1.jpg

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-30 03:21:27

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号