This article will share with you how to implement the code running on ESP8266. In other words, it uses ESP8266 to send the data of hardware devices to the Gizwits AIoT platform through the MQTT protocol, write it to the cloud, and then pass it to the data. Users can remotely control the hardware devices through the mobile phone APP.
The steps to achieve this are as follows: 1. Register a Gizwits account
Register your own account on the Gizwits self-service development platform, and any IoT devices you design in the future can be placed on this account.
2. Create a new device and generate source code
First create a new device
Then add the data points
The data point is light_onoff, and the name can be other letters defined by yourself.
You will see the basic information of this data point in the basic information. Note that if you want to see the complete Secret, you need a second password verification.
Select MCU Development
Then choose the SOC solution
Then enter the secret to generate a code package
After downloading I found that the structure of this code package is similar to that of Espressif (this sentence is for friends who have used Espressif's official code)
3. Compile ESP8266 source code
The source code generated in the previous step runs inside the ESP8266 module. How to compile and burn it?
The following document explains:
https://dwz.date/fpVy
About the development environment construction:
About ESP8266 platform file description:
The content is similar to the previous compilation learning. Just like Espressif, a new VM folder is created on the D drive.
Then put all the files in this folder. I named the folder SoC_ESP8266, which is shorter and easier to type.
First, let Linux and Windows share folders
Enter the user password: "espressif", press Enter to confirm.
At this time, you can see that the sharing has been successful through the folder manager in the VM VirtualBOX virtual machine.
The purpose of this article is to control this module with a mobile phone APP to realize the switch of GPIO12, that is, the conversion of high and low levels.
The source code generated by the above steps cannot realize the control of specific pins. In order to realize the control of this pin, the code needs to be modified.
The modification steps are to find the corresponding .c or .h file under the VM folder, open it with Notepad or other software and edit it.
Only modified a little bit.
In the keyinit function in user_main.c, add the code to initialize GPIO12.
Then in gizwits_product.c, add the code to flip the light.
Yes, it is that simple, just like the 51 single-chip microcomputer , initialize the pin, and then make it high or low level in the function.
4. Compile the source code and burn it into ESP8266
Next, start compiling this source code.
Next, enter the app directory. The following interface is the LX client running in the VM VirtualBOX virtual machine. The simulation is the Linux operating system .
The cd command is used to enter a directory.
Run the compilation script: ./gen_misc.sh
Compile very fast
Next, start burning
There is a picture in the code automatically generated by Gizwits, which shows which address to program into.
Now start burning.
To make it easier for beginners to understand, here is a brief introduction to the hardware connection. The ESP8266 module consists of two parts, the upper one is the ESP8266 function board, and the lower one is actually a USB -to- serial board. The chip is CH340, but it is made the same size as the ESP8266 function board. In fact, its function is the same as the USB-to-serial module you buy. Use a micro USB data cable, which is the charging/data cable commonly used by mobile phones. Note that it is not a TYPE-C data cable. After connecting to the computer , the driver will be automatically installed. Of course, make sure that the computer is connected to the Internet. After the driver is successfully installed, the current serial port will be displayed in the device manager as COM number. Write down the serial port number and select this serial port number when burning.
Click the burning software START on the computer, then press the FLASH button on the board and hold it, then press the RST button, release it, and then release the FLASH button. Generally, the burning can be successful in one time. If it fails, please click the burning START again and follow the FLASH and RST button steps to burn again.
After burning, the module can be used.
Previous article:Application of WTK6900H voice recognition chip in rice cooker
Next article:What are the uses of bone conduction headphones? What are the better bone conduction headphones?
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Samsung closes another factory in China! N+5 compensation higher than national standards
- Summary of msp430 built-in functions __bic_SR_register(), __delay_cycles(x)
- IMX6-A9 series: display function test
- Flathead RVB2601 board ultrasonic ranging
- Gifts redeemed
- Let’s talk about creativity with the contestants
- The square wave filters out the third harmonic distortion. What is the cause of the distortion? How to improve it? Please help.
- USB Memory Stick Development Kit for TMDX5535EZDSP Series
- STLINK V3SET cannot emulate STM32H750
- Summary of knowledge points for getting started with STM32 microcontrollers