sigma

[Training Camp_Advanced Class] Based on stm32f103 Gizwits IoT Control Board

 
Overview

Basic Information

  1. stm32f103rct6 is used as the main control, and the download interface uses 4-pin SWD download
  2. There is a CH340E module onboard, which does not require an external crystal oscillator to save space.
  3. 5V input is obtained through a USB micro interface, and the AMS1117-3.3 converts it to 3.3V to power the microcontroller.
  4. There are 2 LEDs on board, one is the power indicator light, and the other is for user use (used to display the current WIFI module status)
  5. There are 2 buttons on the board, one is the reset button of the microcontroller, and the other is the user button (used for)
  6. The WiFi module uses the punctual 8266 module, which is developed using AT commands, uses the mqtt communication protocol, and links to the Alibaba Cloud Feiyan platform. You can view and control the closing and opening of the relay through the mobile APP
  7. It seems that using the public version of the APP requires transplanting the AliOS system, which has never been done, and there is no reference procedure or idea. In the end, I can only switch to another IoT platform
  8. The attachment contains some summaries of Alibaba Cloud (although it is not comprehensive, but there is still a lot of useful information), as well as information on Gizwits
  9. OLED displays the current relay status, whether the wifi initialization link is normal, and can also display the network time.
  10. The relay remains disconnected when power is turned on to prevent accidents.
  • The ESP8266 module is used, and there is no ready-made firmware for the Feiyan platform, so I can only configure the network by myself.

Debugging process

  1. First of all, I used the ATK-esp8266 module of Zhengdian Atom. The firmware used is the factory firmware. The factory firmware cannot support the mqtt command, so I found the 8266 firmware on the Internet that supports the mqtt command.
  2. When downloading the firmware, I used a lot of firmware programming software, and many of them had inexplicable bugs. Finally, after many trials, I found a usable programming software.
  3. Since I have never been exposed to the Internet of Things or mqtt, I can only slowly understand it based on the blogs of some big guys.
  4. The access domain name, mqttclientId, mqttUsername, and password have corresponding formats and acquisition methods on the Alibaba Cloud IoT platform.
  5. The access domain name is generated by adding the ProductKey you created and a fixed format, and the port number is fixed at 1883.
  6. mqttclientId consists of a clientId + security mode + signature algorithm type + current time millisecond value and other data. The non- clientId data is framed with a | (or operator) symbol, and the information in the middle is separated by (comma).
  7.  mqttUsername is composed of DeviceName&P~~~~roductKey among three elements
  8. The format of password is clientId + “yourclientId” +deviceName + “yourdeviceName” + productKey + “yourproductKey” + timestamp + “yourtimestamp” is the message of the hash algorithm, with DeviceSecret as the key, and the algorithm is the encrypted string generated by sha1~~ ~~

I first used mqttfx to debug on the computer and found that I could connect to the Alibaba Cloud Feiyan platform. After becoming familiar with the basic working methods of mqtt, proceed to configure 8266.

It's overturned. It's overturned.

After a few days, I found that I was connected to the Feiyan platform. I could subscribe to and publish topics, but I couldn't use the public version of the APP. I didn't know how to write the network distribution code, and I couldn't find the information. In the end, I had no choice but to change to another platform and try it later. Use AT commands to connect to the distribution network yourself

Find other ways out

  1. After turning over, I searched for some information and found that Gizwits Cloud can be tried.
  2. Gizwits can generate the code of the device you create for reference.
  3. There is enough information for me to quickly learn to use Gizwits.
  4. There are ready-made firmware available. You only need to transplant Gizwits and you don’t have to manually code and configure the network yourself.
  5. Finally, we successfully realized the use of mobile APP to control the relay switch. However, the mobile APP interface is relatively simple and not as good-looking as Alibaba Cloud's public version APP.
  6. Moreover, the code is relatively complicated, and a small system for information interaction must be transplanted.

Summarize

  1. Although I did not use the Alibaba Cloud Feiyan platform to complete this project, I learned how to use mqtt firmware, how to connect to the server, and how to subscribe and publish topics.
  2. Since this is my first time to come into contact with the Internet of Things, I only want to complete the most basic use of the server to light up the lights in the air. I have not added other peripherals, and the designed button circuit is a bit small. The distribution network requires only one button. I want to realize other You have to add some functions yourself
  3. This is the first time that low voltage is used to control high voltage in the circuit part. I have heard others talk about optocoupler isolation before, so I used it this time, but the effect is average. I feel that it is not as effective as the NUD31 series recommended during the live broadcast.
  4. I have learned some more standardized layout and copper pouring knowledge. In the past, I poured a whole piece of copper onto the ground. Now I know that the bottom of the crystal oscillator must be hollowed out, and the bottom of the relay must also be hollowed out to prevent interference with the stability of the ground.
  5. Each module must be put together. Note that the power input must correspond to the schematic diagram. It must first pass through the filter capacitor before it can be supplied to the chip. The voltage output by the chip must pass through the capacitor before it can be supplied to other places.

Final picture display (the picture shown is the first version, some changes were made later to reduce the layout)

IMG_20200815_171150.jpgIMG_20200815_171158.jpg The capacitor next to CH340 is a problem with the original version of the schematic. The new version of the schematic has been corrected. IMG_20200816_203157.jpg

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-29 14:30:43

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号