ohahaha

ESP8266 smart socket based on STM32

 
Overview

This project is the 2020 Lichuang EDA Summer Training Camp Advanced Class Training Project (Version 1 Microcontroller Version AT Command)

Note: This version is not recommended to be packaged into a smart socket. Since the space at the bottom of the PCB is extremely small, it is only suitable for welding some chip resistors and capacitors or some lower-height chips. The bottom of this version uses an STM32 chip with an 8M patch. Chip crystal oscillator, so it cannot be installed when it is installed into the socket shell, so version one is suitable for use as a microcontroller board, and then version two was launched (of course, this is not absolute, if you really don’t know how to directly develop ESP8266 , it is recommended that you draw a 3D shell yourself, and then 3D print it for installation and use. The effect of using version one is the same!) (The link for version two is as follows: https://oshwhub.com/414048A/xun-lian-ying_-jin- jie-ban-li-chuangeda-shu-ji-xun-lian-ying-ban-ben-er )

The following is a physical demonstration: A.jpg606897F32CC418B6490E6949100FAB89.jpgB.jpg3D renderings of the project 5X5EUY~Y@}5WDH[KO(H0HL5.png]<img src='https://www.eeworld.com.cn/huodong/yunpan/img101/05f88b6d98d6d3e99ffa12e15563cd80052a75fd.png' > ![N%ZC~]`~ [KD@_CC7D}8.png]<img src='https://www.eeworld.com.cn/huodong/yunpan/img101/40cb653f8255abfe040a96c0dbfd16cbb9617cb1.png' > ![)12DF%FB3O{P]M%C~ B82AK1.png /////////////////////************************ *The following are the notes and instructions************************ ![RV}07[]8R~)U%RYP1V3Q[SM.png] 220V purchased online Convert to 5V small size/low power consumption AC-DC regulated isolated power supply module. Of course, it is more recommended to use Lichuang Mall, because the quality is more guaranteed (I bought a sample, it only costs 0.1 yuan) The following link :https://item.taobao.com/item.htm?spm=a1z09.2.0.0.30452e8d4SPe3Z&id=622061165535&_u=c3ucg7ggff41 ![AW~G56_{)UGR4(RZG8X)@Z%4W4EZBSD[%72WDP.png] Purchase online Shell kit, after debugging, you can directly install it using the following link: https://item.taobao.com/item.htm?spm=a1z09.2.0.0.30452e8d4SPe3Z&id=527479647754&_u=c3ucg7ggc78f (They have many other shells of this type. Type, you can choose a cheaper and more suitable one. The one I bought is 8 yuan for a complete set, and the starting price is 5 sets. "We are studying! Of course, the cheaper ones are better")

Then purchase the corresponding components at Lichuang EDA based on the BOM table (as known from the BOM table) Note: Since I still have remaining relays, I drew the package myself. My own relays are from Songle (remember, as long as Possibly small size): 1597201918805.jpgNote on welding debugging: (The following are just suggestions, suggestions, suggestions. Please follow the following order, based on your own situation. Here are just some suggestions for friends who have never done strong current work) (If you are from the CH340 plate To start, please solder the socket first, then solder CH340G, and then others, leaving enough space for the chips to be soldered later) 1. Insure first, then (D1, U6, ESP8266, POWER, R7); 2. 220V to 5V power supply module; 3. Solder the 220V interface U9; 4. At this time, please take a multimeter, wear insulating gloves, plug the socket into the plug-in board, adjust the multimeter to AC 400V, measure the AC-AC two pads on the 220V to 5V module, use the multimeter Adjust the DC range to 40V and measure whether the voltages of the "+" and "-" pads on the output terminals of the 220V to 5V module are normal. If normal, unplug the plug and cut off the power and solder the "+" and "-" pads of the module. The disk is short-circuited and "discharges" for 1 second; (Tip: When welding U9, the length of the insulated wire should be about 5cm, not too long, just household wires) InkedAC26D003DD692B180BE1598EE235312D_LI.jpg 5. Weld the polar capacitor "electrolytic capacitor", 1117 module circuit, as well as the USB to TTL circuit; 6. Test whether each point is normal. If not, please check whether there is a weak solder, missing solder or short circuit, etc.; 7. If everything is normal, please continue to solder. The whole process follows the instructions given by Low Yuan According to the principle of welding from component to high component, follow the principle of power first and then signal, please treat it carefully; 8. Please weld a 4P header at the position of the OLED screen for OLED screen plug-in; 9. Please clean your hands before welding. Maintain personal hygiene, wear anti-static bracelets, goggles, and smokers (if available), do not touch the IC directly with your hands, and do not weld each solder joint for more than 10 seconds, etc.); 10. During debugging: (1) Do not connect to the power supply 220V, please note that the debugging pins SWDIO and SWCLK should not be connected in reverse, and VCC and GND should not be connected in reverse. If the program cannot be recognized when downloading with KEIL5, the power supply may be insufficient. Please be careful not to touch the components directly with your hands. . 11. If you directly use the 32 downloader ST-Link for debugging, it is recommended to only connect GND, SWCLK, and SWDIO to P1, and then plug in a data cable to connect it to the computer (because the relay is powered by 5V, if it is powered directly by 3.3V, The relay will not work, which may affect the debugging effect, and it is more stable.) As shown in the picture: The left side is plugged in with the data cable for separate power supply, and the right side is for ST-LINK3.3V power supply. Remember that ST-LINK must connect GND to the "common ground" ” 12. When welding the two-color plug-in LED lamp, the LED lamp pins must be improved, as shown below 7UZ7F3%~4TV0(GF{9KN8LRP.png ![AK3]Y6}[@CW5G1X@WP[8P@B.png]

PCB design precautions (the following matters are mainly for those who want to modify the PCB): 1. Do not route wires under the capacitors, resistors are OK (because the space in version 1 is too small, the author ignores this point, but then Version 2 is designed, link to version 2:); 2. The wiring should be horizontal, vertical, and horizontal. It is recommended that the shortest wiring is the best; 3. According to the requirements of the electronic technology project of the World Skills Competition: (1) The soldering pad should go out of the signal line or it should be a straight line. Or directly use the diagonal lines. The red box in the picture below indicates the correct wiring, and the basket indicates the wrong wiring (designers should keep this in mind) (2) The power supply of the IC must first pass through the filter capacitor of the IC and then flow into the IC chip. It is dedicated to IC. The filter capacitor should be as close as possible to the IC pin (as shown in the figure below, the four yellow rectangular boxes are filter capacitors, the purple arrow is the direction in which the power flows into the IC, and the 3.3V power supply has been marked as a white trace) (3) The power supply passes through the IC filter capacitor After entering the IC pin, do not lead it out to the next level device (4) The shorter the signal line, the better (5) The positioning hole design is reasonable (6) The size and direction of the silk screen, no silk screen coverage, clutter (7) Components Arrange them in reasonable groups (8) The narrowest part of the GND paving should not be less than 0.254mm (9) The board should be "equal to the ground" (10) The fewer the number of vias, the better (too many vias will result in a certain fee from the board manufacturer) (additional charges) etc....... ![0]3JD0( A@FPBXK4RB6KGYT.png] $HHN}I7K.png 4. High-voltage and high-current lines must be kept at a certain distance from signal lines. It is best to isolate or layer them For example, wiring: relay circuit (the purple box in the picture is the isolation area, two wide high-voltage lines are routed in layers and there is a certain safe distance between them and the signal lines) below is the 3D rendering, ![1]9FVA2 } ] As shown by the blue arrow in the figure (C28 and C22 are the filter capacitors next to the VCC output after converting 220V to 5V) ![9X)V3 [A@X.png] Installation and operation: Since the PCB board space is limited, the friends also need Make a small change, as shown below, otherwise your two electrolytic capacitors will get stuck on your buttons and they won’t be able to be pressed. After doing all this, you can fix the screws and use it! ! ! Of course, you have to debug the program! ! ! LAN1L9BS(439}(~Q(M5E(HO.pngright! There is also the operation of the networking part. Our microcontroller version sends the corresponding AT commands to the ESP8266 through the serial port of the microcontroller for operation, so below I will give the relevant commands for my networking use, and send them to the ESP8266 in order to connect to the server. (1) The first part is to connect to the server. It is recommended to edit it before use, and then write the program or debug through the serial port debugging assistant using AT+RST AT+RESTORE AT+CWMODE=1 AT+CIPSNTPCFG=1,8,"ntp1. aliyun.com" AT+CWJAP="Your own WIFI name (English recommended)","Your own WIFI password (more than 8 characters)" (AT+CWLAP queries the attachment router) (AT+CIFSR queries the route on the connection) For example: AT+CWJAP="HUAWEI MATE 30","88888888" AT+MQTTUSERCFG=0,1,"NULL","e4ufDyw********************** **********WmQ","3A3EF02C**************************************** ********A3B6E18EE",0,0,"" Note: ("=" corresponds to a total of 8 data following it (each data is separated by ","), as follows: 0, 1, "NULL ", "Username", "Password", 0, 0, "" format) ("Username" and "Password" are encrypted through the triplet of your device on the Alibaba Cloud server. The specific usage method is as follows) FR9HET6W78{OY1[IPTJPUVP.png]<img src='https://www.eeworld.com.cn/huodong/yunpan/img101/2fa9db10754d744b2c6208e5f3761cff80889e59.png' > The following two operations must be connected in the shortest time, otherwise Will be kicked off by the server AT+MQTTCLIENTID=0, "Test|securemode=3,signmethod=hmacsha1|" (add before the comma) (This content is: 0, "ClientID" As shown above, your "ClientID" has been generated , just copy and paste it in) AT+MQTTCONN=0,"a17aZP30WmQ.iot-as-mqtt.cn-shanghai.aliyuncs.com",1883,1 (This content is: 0, "Connect domain name" as shown above, Your "connection domain name" has been generated, just copy and paste it in) After the above operations, your device will be online** (2) The second step is data transmission** **First of all, we need to know To communicate, you must first subscribe to the message, and then receive the message as soon as possible (this process is equivalent to: you need to transmit data to the server, and you need to let the server know what you want so that he can give you what you want. We Subscribing to this message first is equivalent to telling the server that I don’t want to do anything)** First log in to the Alibaba Cloud platform, log in to your account, and click on the console**![)Y)Z)]GLSC$9V9F.png 4. Upload your switch information or other microcontroller data information (the author has been struggling with this step for four days. For four days, he has not found a solution. Finally, in (Fu Jieli Maker Editor: 503317A) friend With some guidance, I finally solved this problem, thanks to my friend) AT+MQTTPUB=0,"/sys/a17a************mQ/e4uf************U7I3/ thing/event/property/post","{"method":"thing.service.property.set","id":"1834390959","params":{"PowerSwitch":1},"version":" 1.0.0"}",1,0 Note: (There are 5 data after "=" (each data is separated by " , "). The data is modified according to the data information sent by the server. The first Do not modify the data and the last two data. In the second data, replace the second "/" with the first "." of your own connection domain name."The content in front of it, the third "/the content after it is your own "Username") (Remember in the third data, "PowerSwitch" should be replaced with your own definition of the switch button. Since the data is in JSON format, so Add a "" symbol before commas and double quotes. Friends who don't know much about this data can first use the data I gave above to operate and experience it.)

Mobile phone screen 08BD698263E60CA3C86CA83EBBF67228.jpg 272E7254051ECAC381DA04A8B6B5ACB8.jpg

Since the author recently participated in the "First Vocational Skills Competition of the People's Republic of China - Municipal Selection Competition" and "Sensor Network 1+X Training Training", the whole day was training + assembly and debugging, and I was exhausted every day. I went back to the dormitory at 10 o'clock. I was exhausted, so the program update was too slow. I'm really sorry. I hope my friends can understand. I will eventually give a very detailed tutorial, and I will also open source the finished product. I hope everyone can understand it, thank you! Sorry for the slow update! Version 1 is updated here first, and then I will also update version 2!

参考设计图片
×
 
Related Devices
Devices Class introduce Datasheet
RC-02K6812FT SMD resistor Download
GRT21BR71H104KE01L Download
TFPT0603L1001FV Passive components;The resistor Power: 3/4W Operating temperature: -55℃~+150℃ Normal temperature resistance value (25°C, ohms): 1K Resistance accuracy: ±1% Download
MM32F103C8T6 The embedded processor and controller;Microcontrollers and processors Working voltage: 2V ~ 5.5V CPU bits: 32 CPU core: ARM® Cortex®-M3 Main frequency (MAX): 96MHz ROM type: FLASH - Download
8345/012-1Z7AR Download
保险丝透明座 - Download
MHL5019EGTD LED optoelectronic/LED;Light-emitting diodes (leds) Meihua Electronics LED lamp plugs directly into the Φ5mm long bracket, white mist colloid, high-bright red + yellow-green two-color light, voltage VF: R: TYP2.1V/G: TYP2.2V, brightness Iv: R: TYP30mcd/G: TYP20mcd, main Wavelength λd: R: TYP622nm/G: TYP570nm, luminous angle 2θ1/2: R: TYP120deg/G: TYP120deg Download
MCP9700AT-E/TT Temp Sensor Analog Automotive 3-Pin SOT-23 T/R Download
C08000J060 Analog mixed-signal IC;SMD crystal resonator (passive) Equivalent series resistance (ESR): 40Ω Main frequency: 8MHz Frequency tolerance: ±20ppm Load capacitance value: 20pF - Download
LM1117S-3.3 Power/power management;Low dropout linear regulator (they) Output type: fixed Maximum input voltage: 12V Output current: 1A Output voltage (minimum value/fixed value): 3.3V 3.3V 1A Download
ETCR0603F1M00K9 Passive components;SMD resistor Resistance (ohms): 1M Accuracy: ±1% Power: 1/10W 0.1W Download
CR0805JR025P05Z Passive components;Patch low resistance of sampling resistor Power: 1/8W Accuracy: ±5% Resistance (ohms): 0.025 Temperature coefficient: - Download
TFPT0603L1001FV Passive components;The resistor Power: 3/4W Operating temperature: -55℃~+150℃ Normal temperature resistance value (25°C, ohms): 1K Resistance accuracy: ±1% Download
742C1631002FP Network exclusion Download
CRCW0603330MJPEAHR SMD resistor Download
1N4148W Discrete semiconductor;Switching diode Reverse recovery time (trr): 4ns DC reverse withstand voltage (Vr): 75V Average rectified current (Io): 150mA Forward voltage drop (Vf): 1.25V @ 150mA Seagull pin 75V, 150mA, trr=4ns, VF =1.25V@150mA,PD=400mW Download
PR100A23831CWGT0 Passive components;The resistor Array/Network Resistor, Isolated, Thin Film, 0.1W, 3830ohm, 35V, 0.25% +/-Tol, -10,10ppm/Cel, 0806, Download
PR100A23831CWGT0 Passive components;The resistor Array/Network Resistor, Isolated, Thin Film, 0.1W, 3830ohm, 35V, 0.25% +/-Tol, -10,10ppm/Cel, 0806, Download
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2024-11-24 20:18:21

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

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号