This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:iot-open:espressif_at [2023/10/10 10:27] – ktokarz | en:iot-open:espressif_at [2024/05/27 10:33] (current) – [ESP AT Networking] pczekalski | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | === === | + | ====== ESP AT Networking |
- | <box # | + | {{: |
- | <box # | + | ESP8266 SoC can work as the WiFi communication module for other microcontrollers. To use the ESP8266 chip as a modem (figure |
- | === ESP AT Networking === | + | |
- | <box # | + | |
- | <box # | + | |
- | + | ||
- | ESP8266 SoC can work as the WiFi communication module for other microcontrollers. To use the ESP8266 chip as a modem (Figure | + | |
<figure esp_at> | <figure esp_at> | ||
- | {{ : | + | {{ : |
- | < | + | < |
</ | </ | ||
< | < | ||
- | AT commands were developed to control telephony modems. | + | AT commands were developed to control telephony modems. |
</ | </ | ||
- | == Download | + | ====Preparing an ESP8266 chip with AT commands firmware==== |
+ | |||
+ | == Downloading | ||
* Download the latest ESP Flash Download Tool (v3.9.5 at the time of writing) from ((https:// | * Download the latest ESP Flash Download Tool (v3.9.5 at the time of writing) from ((https:// | ||
- | There are also other flashing tools like NodeMcu Flasher ((https:// | + | Other flashing tools like NodeMcu Flasher ((https:// |
* Download the latest AT release from ((https:// | * Download the latest AT release from ((https:// | ||
The newest version of Espressif firmware is not compatible with ESP8266 SoCs. In the case of using ESP8266-based boards, download older AiThinker firmware available on GitHub ((http:// | The newest version of Espressif firmware is not compatible with ESP8266 SoCs. In the case of using ESP8266-based boards, download older AiThinker firmware available on GitHub ((http:// | ||
- | The firmware can come in different versions. It can be a set of binary files which must be uploaded | + | The firmware can come in different versions. It can be a set of binary files that must be uploaded |
==Flashing Procedure with single binary file== | ==Flashing Procedure with single binary file== | ||
- | * Detect ESP8266 module parameters. Start the ESP Flash Download Tool (" | + | * Detect ESP8266 module parameters. Start the ESP Flash Download Tool (" |
<figure AT_flash> | <figure AT_flash> | ||
- | {{ : | + | {{ : |
- | < | + | < |
</ | </ | ||
* Gather information. Make a note of the flash memory size. In this example, we have a 32 Mbit flash. | * Gather information. Make a note of the flash memory size. In this example, we have a 32 Mbit flash. | ||
- | * Load the correct size of the combined AT binary firmware file (" | + | * Load the correct size of the combined AT binary firmware file (" |
<figure AT_load> | <figure AT_load> | ||
- | {{ : | + | {{ : |
- | < | + | < |
</ | </ | ||
- | * Then, click the START button and wait until the flashing process | + | * Click the START button and wait until the flashing process |
==Flashing Procedure with a set of separate files== | ==Flashing Procedure with a set of separate files== | ||
- | To flash the firmware from a set of files, or to restore the original firmware: | + | To flash the firmware from a set of files or to restore the original firmware: |
- | * Detect ESP8266 module parameters. Start the ESP Flash Download Tool (" | + | * Detect ESP8266 module parameters. Start the ESP Flash Download Tool (" |
<figure AT_flash1> | <figure AT_flash1> | ||
- | {{ : | + | {{ : |
- | < | + | < |
</ | </ | ||
- | | + | |
+ | | ||
< | < | ||
# BOOT MODE | # BOOT MODE | ||
Line 86: | Line 84: | ||
blank.bin | blank.bin | ||
</ | </ | ||
- | * Indicate -- correct for your ESP8266 flash size -- firmware files & addresses. The firmware is broken down into several files. They need to be provided to the ESP Flash Download Tool, together with the corresponding addresses | + | * Indicate -- correct for your ESP8266 flash size -- firmware files & addresses. The firmware is broken down into several files. They must be provided to the ESP Flash Download Tool and the corresponding addresses in the readme.txt file above. For our ESP8266 example, it should look like in figure |
<figure AT_reflash> | <figure AT_reflash> | ||
- | {{ : | + | {{ : |
- | < | + | < |
</ | </ | ||
- | * | + | * |
- | === Basic ESP8266 Networking === | + | ==== Basic ESP8266 Networking |
After uploading AT firmware and connecting the module to the PC, an ESP8266 can be used as a modem with simple AT commands. | After uploading AT firmware and connecting the module to the PC, an ESP8266 can be used as a modem with simple AT commands. | ||
- | It is possible to connect ESP8266 to a PC with a TTL-Serial-to-USB adapter. Connection to any microcontroller with a serial interface does not need an adapter. The default baud rate settings are 115200, | + | It is possible to connect ESP8266 to a PC with a TTL-Serial-to-USB adapter. Connection to any microcontroller with a serial interface does not need an adapter. The default baud rate settings are 115200, |
< | < | ||
- | If the response is " | + | If the response is " |
< | < | ||
- | < | + | < |
- | As a Wifi device ESP8266 can connect to the network in such modes: | + | |
- | * mode 1 -- client mode -- the ESP8266 connecting to an existing wireless network, | + | As a WiFi device, ESP8266 can connect to the network in such modes: |
- | * mode 2 -- access point mode (AP) -- other wireless network devices can be connected to the ESP8266, | + | * mode 1 - client mode - the ESP8266 connecting to an existing wireless network, |
- | * mode 3 -- dual mode (router) | + | * mode 2 - access point mode (AP) - other wireless network devices can be connected to the ESP8266, |
- | By default, the ESP8266’s stock firmware is set to AP mode. To confirm that, send the following command: | + | * mode 3 - dual mode (router) - the ESP8266 |
+ | * | ||
+ | By default, the ESP8266's stock firmware is set to AP mode. To confirm that, send the following command: | ||
< | < | ||
- | The response should look like +CWMODE:2, where 2 corresponds to AP mode. To switch ESP8266 to client device mode, the following command can be used: | + | The response should look like '' |
< | < | ||
- | To scan the airwaves for all WiFi access points in range the following command can be used: | + | |
+ | To scan the airwaves for all WiFi access points in range, the following command can be used: | ||
< | < | ||
- | Then the ESP8266 will return a list of all the access points in range. In each line will be an item consisting of the security level of the access point, the network name, the signal strength, the MAC address, and the wireless channel used. Possible security levels of the access point <0--4> mean: | + | |
- | * 0 -- open, | + | Then, the ESP8266 will return a list of all the access points in range. In each line will be an item consisting of the security level of the access point, the network name, the signal strength, the MAC address, and the wireless channel used. Possible security levels of the access point <0-4> mean: |
- | * 1 -- WEP, | + | * 0 - open, |
- | * 2 -- WPA_PSK, | + | * 1 - WEP, |
- | * 3 -- WPA2_PSK, | + | * 2 - WPA_PSK, |
- | * 4 -- WPA_WPA2_PSK. | + | * 3 - WPA2_PSK, |
- | The following command establishes the connection to the available access point with proper | + | * 4 - WPA_WPA2_PSK. |
- | < | + | |
+ | The following command establishes the connection to the available access point with proper | ||
+ | < | ||
If everything is OK, the ESP8266 will answer: | If everything is OK, the ESP8266 will answer: | ||
< | < | ||
Line 126: | Line 130: | ||
OK | OK | ||
</ | </ | ||
- | It means that ESP8266 is connected to the chosen AP and obtained a proper IP address. The following command checks what is the assigned IP address: | + | |
+ | ESP8266 is connected to the chosen AP and obtained a proper IP address. The following command checks what is the assigned IP address: | ||
< | < | ||
- | To set up ESP8266 to behave both as a WiFi client | + | To set up ESP8266 to behave both as a WiFi client |
< | < | ||