- TCP communication
- MQTT communication
- Connecting to a microcontroller
- Mobile APP development - communicating with STM32 - MQTT
Basic Info
The ESP8266 itself:
Wiring is as follows:
Connecting to WiFi
| Command | Response | Purpose |
|---|---|---|
AT+UART=115200,8,1,0,0 |
OK | Set the baud rate |
AT |
OK | Test whether AT commands are available |
AT+RST |
OK, then init info | Restart the ESP8266 |
AT+GMR |
Version info | Check the firmware version |
AT+CWMODE=1 |
OK | Set the WiFi mode (STA mode) The ESP8266 can act as a client (STA), a hotspot (AP), or both at once (AP+STA). 0 turns WiFi off, 1 is STA mode, 2 is AP mode, 3 is AP+STA mode |
AT+CWJAP="name","password" |
WIFI CONNECTED WIFI GOT IP OK |
Connect to WiFi |
AT+CWJAP? |
+CWJAP:"your WiFi name","xx:xx:xx:xx:xx:xx",channel,signal_strength | Check the connection status (verify the connection succeeded) |
AT+CIFSR |
+CIFSR:STAIP,"192.168.1.100" +CIFSR:STAMAC,"a4:e5:7c:26:1a:3f" OK |
Get the assigned IP |
AT+CWQAP |
OK | Disconnect from WiFi |
Workflow
First understand the principle, then test further with MQTTx, and finally implement it on the ESP8266. Following this order means that if you hit a problem, you can track it down right away.
Check Whether the Firmware Works
AT+MQTTUSERCFG=0,1,"ESP8266Client","myname","password",0,0,""
If it doesn't throw an error, it works.
If it errors out, that means the firmware doesn't support MQTT — please flash the following firmware:
All the rest of this series is explained based on that firmware. If you really don't want to use the firmware below, please don't watch this video.
The previous video covered how to use the ESP8266 for MQTT communication, but it used a computer to send the serial data to the ESP8266;
In this video, let's talk about how to use an STM32 to send data to the ESP8266 to achieve serial communication.