他们逼我做卧底

[Training Camp_Advanced Class] Smart socket based on Alibaba Cloud's WIFI

 
Overview
  • 1. Project Introduction
  • WIFI smart socket based on Alibaba Cloud. The microcontroller uses STM32F042F6P6, and the WiFi module uses EMW3080. The on-board relay on-off function is controlled through physical buttons or APP. At the same time, DHT11 is added to collect the ambient temperature and humidity, and is uploaded to the server regularly. Real-time data and historical temperature and humidity curves can be seen on the APP.
  • 1. The WIFI-based smart socket uses the Alibaba Cloud Feiyan platform, and the device is powered through the MICRO-USB interface.
  • 2. The microcontroller is STM32F042F6P6, TSSOP 20-pin package.
  • 3. The WIFI module uses EMW3080, Alibaba Cloud Feiyan firmware version.
  • 4. Control one relay output, and the output is normally closed by default.
  • 5. Expand 4-way buttons and 4-way LED lights for human-computer interaction and equipment status indication.
  • 6. Expand a temperature and humidity sensor, the default is DHT11, you can also connect to DS18B20.
  • 2. Hardware design
  • 1. MCU. We chose ST's STM32F042F6P6, 48MHz frequency, dual serial ports, and TSSOP20 package, which is very suitable for this project.1-MCU.jpg
  • 2. WIFI module. It was my first time to do an Internet of Things project. I followed the teacher and chose the EMW3080 module of Qingke Company. The circuit was directly based on the circuit of Zero Demon Master. One of the gains from this training camp.2-WIFI module.jpg
  • 3. Power supply part. Instead of using Zero Demon's solution, an AMS1117-3.3V from AMS was used to realize the 5V to 3.3V function of the entire system. The AMS1117-3.3 output current is 800mA, which meets the entire power supply of the system. The system can be powered by a USB interface or connected to a 5V DC power supply through the CN1 interface.
  • 3-AMS1117.jpg
  • 4. USB-TTL circuit. The CH340E chip was selected, referring to the Zero Demon circuit. Later, the CH340E power supply was modified to 3.3V, which is compatible with the TTL serial port level of the microcontroller and WIFI module. In addition, by adding the jumper J1 terminal, the USB can be switched to connect the microcontroller debugging serial port 1 or the serial port of the EMW3080 module, making it easy to debug the two parts of the circuit independently.4-CH340E.jpg
  • 5. Relay drive circuit. Adopting Song Gong's solution, since STM32 is different from 51 when it is powered on, it does not output a high level, so the inverter circuit is omitted. The NUD3105 chip is very easy to use, which is the second gain of this training camp.
  • 5-Relay.jpg
  • 6. Temperature and humidity sensor circuit. The DHT11 chip is used to collect the ambient temperature and humidity. This chip has strict sequencing requirements. During debugging, the driver of Punctual Atom was transplanted, which is very easy to use.
  • 5-DHT11.jpg
  • 7. LED indicator circuit. Due to the tight IO port, two IO ports are used to drive the LED, one IO port drives LED1, and the other IO port drives the other three LEDs.7-LED.jpg
  • 8. Button circuit. There are two keys, one of which shares the BOOT0 pin.
  • 8-key.jpg
  • 9. Buzzer circuit. A buzzer circuit is added, and 2N7002 drives the active buzzer.
  • 9-beep.jpg
  • 10. PCB circuit blank board.
  • 10-Empty board.jpg
  • 11. Physical picture.
  • 12-actual picture.jpg
  • 3. Debugging records
  • 1. The first car rollover. Song Gong's program was released and transplanted to the STM8S103 platform. After compilation, it was found that the code exceeded 8K, which was a major overturn! ! ! Decisively replace the STM32F042F6P6. I happen to have this film on hand. It has 32K FLASH and 4K RAM, which should be enough.
  • 2. The second rollover. The seventh pin of the CH340 chip should use +3.3V for power supply, but I used 5V. I didn’t look carefully when copying the circuit, so I preconceived it! ! ! Remember, don’t be empiric. For unused chips, you must read the manual carefully, read the manual, read the manual! ! ! Decisively cancel the new order placed last night. JLC will deduct 10 yuan, which is regarded as payment of tuition. Place a new order. The review completion time is 2020-08-14 09:39:09. I hope that the No. 16 board will arrive.
  • 3. From 8th to 17th, the debugging completed the basic functions of the switch control relay. The functions that have not yet been completed include FLASH storage data and DHT11 temperature and humidity collection, which will continue to be improved in the future. After the circuit board was welded on the 16th, the main focus was on the EMW3080 module networking configuration method. Finally, the hotspot distribution mode was adopted. The triplet data of the module was first configured through AT commands, and then the module was completed through the hotspot distribution network on the mobile phone APP. of binding.
  • 4. On the 8th-18th, the temperature and humidity collection and upload function was completed, and the relay switching logic was corrected.
  • 5. From 8th to 19th, the temperature and humidity curve APP page design was added and completed. The APP panel effect is as shown in the figure below.
  • APP-1.jpgAPP-2.jpg
  • APP-3.jpgAPP-4.jpg
  • 6. No. 8-23, realize a simple temperature hysteresis control function. The APP can turn on and off the temperature control function and set the temperature.
  • WK1.jpgWK2.jpg
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-22 18:17:39
  • How to strengthen the welding wires at the circuit interface
  • RT9266 boost range
  • A good way to practice English listening.
  • Kernel debugging method, a little confused or
  • FPGA and DSP data interaction
  • IGBT FZ600R12KE3 Module

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号