toothache

[Training Camp_Advanced Class] WiFi Smart Socket

 
Overview

1. Schematic design

1. USB to TTL

Adopt a classic design and follow the specifications. It adopts a stylish, trendy, blind-pluggable TypeC interface and strong current supply capability, which can effectively prevent the CH340 chip from being reset the moment the relay is turned on. 1.png

2. LDO step-down

The AMS117, which engineers are no longer familiar with, is used to ensure stable power supply for communication modules and microcontrollers. No more worrying about power supply. 2.png

3. DS18B20, DHT11 and other peripherals

Onboard is a DS18B20Z+T&R temperature sensor, a DHT11 temperature and humidity sensor, a popular RGB light and buzzer. At the same time, 2 serial ports are led out, namely serial port 3 and serial port 4. If you need 5V power supply, please use serial port 3. If you need 3.3V power supply, please use serial port 4. Onboard RGB and onboard buzzer can be used to prompt users for running status. (The DS18B20Z+T&R patch package used in this design is based on the perspective of "strict diligence and thrift and opposing extravagance and waste", which consumes inventory and also appears more advanced ) 3.png

4. The relay drive circuit SN74LV1T04DBVR inverter can ensure that the relay is reliably turned off when the MCU is powered on, and the NUD3124 can ensure that the relay is reliably driven. 4.png

5. EMW3080WIFI module adopts the classic WiFi chip of home appliances, mass-produced and shipped, mature and stable. Classic design, supports stamp hole SMT or pin installation, suitable for various smart home appliance application scenarios. Use Alibaba Feiyan version firmware to quickly access Alibaba Cloud firmware download address: https://mxchip.yuque.com/books/share/8ac5e519-671d-4444-a93d-20e0aadfc793/pornca 5.png

6. STC microcontroller

It adopts the classic 51-core microcontroller that is the first choice for entry-level engineers. The drive circuit is simple, the peripheral interfaces are relatively rich, and there is a lot of information, which can fully meet the project needs, and the development is simple and easy to use. 6.png

2. Programming

The program is modified based on the code shared by Teacher Lingyao. It retains functions such as queues and timers, and changes the method of data reporting, using segmented reporting. //Consolidate and report data

void Report_Data(void)

{

unsigned char DHT11_Temperature[7]; //存放DHT11温度信息

unsigned char DHT11_Humidity[4]; //存放DHT11湿度信息

unsigned char DS18B20_Temperature[5]; //存放DS18B20温度信息


Read_DHT11_Temperature_And_Humidity_Data(DHT11_Temperature,DHT11_Humidity); //读取温湿度数据

Read_T1(DS18B20_Temperature);

Send_Str2("AT+ILOPSENDJSON=property,150 {"EnvHumidity":");

Send_Str2(DHT11_Humidity); //上报DHT11湿度数据

Send_Str2(","temperature":");

Send_Str2(DHT11_Temperature); //上报DHT11温度数据

Send_Str2(","motherboardTemp":");

Send_Str2(DS18B20_Temperature); //上报DS18B20温度数据

GetRelay();

Get_Buzzer();

Send_Str2("}");

return; }

3. Problems encountered

1. The DS18B20 temperature sensor in the chip package is used, but after the board running temperature rises, the detected temperature is higher than the room temperature, which becomes the motherboard temperature detection instead of the originally designed ambient temperature detection (this package is used because I only have This package, destocking design; this question tells us that choosing the right package is important)

2. Use without checking the package library (especially components with polarity). After getting the board, weld all the packages directly according to the silk screen marks, causing the RGB lights to be pasted upside down.

3. When designing the shell, you did not pay attention to the pin length of the direct plug-in component, and did not leave enough space for it after opening the hole, causing the printed model shell to be invalid.


4. Photos and pictures

IMG_20200823_235128.jpg

IMG_20200823_235948.jpgIMG_20200824_000021.jpgIMG_20200824_000038.jpg


5. Learning experience

Through this summer class study, I learned how to use existing materials and commonly used components to make a set of smart sockets. At the same time, I can connect to Tmall Genie to realize voice control of the device. With the self-designed 3D printed shell, I can say that I have it. The prototype of the finished product appears high-end, grand and classy. During the production process, I also learned that I should test patiently and not be careless. When writing programs, I should concentrate on checking carefully to avoid low-level errors such as missing spellings of function names, missing punctuation marks, etc. Only if I put in the effort Only in this way can we get good results.

Finally, I would like to thank Lichuang EDA for organizing this event, and also thank the teachers and students for their mutual help, patient explanation, and enthusiastic sharing. I would like to say thank you to everyone, Lichuang EDA’s activities would not be possible without you! come on!

6. Video demonstration

Because the video is too large, the attached version is uploaded in standard definition. If you want to view the high-definition version, please go to Station B to view the address: https://www.bilibili.com/video/BV1Mh411o7cm


illustrate:

1. In order to avoid accidental contact and reduce the size, the distribution network IO is deliberately set in the lead-out serial port. If network distribution is required, use a DuPont wire to connect TXD4 to GND and pull it low.

2. The touch switch is a normally closed switch. Just press it once when downloading the program. If the device is completely powered off, it is recommended to press and hold it for 3 seconds.

3. The red light turns on when the device is started but not connected to the Internet, the blue light turns on when the device is connected to the network, and the green light turns on when the device is connected to the cloud platform.

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-15 22:03:41

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号