I'm using an ESP32 running the ESP-AT firmware (currently v1.3) in a device that reads a temperature every 15 minutes, sends the data to a server, and then it goes to sleep. We completely cut power to the radio when the device is asleep so we don't take advantage of the ESP32's sleep modes.
When things are working and connecting, I don't have any issues, but it's when things aren't connecting that my issues with the ESP32 seem to be compounded.
Here's a rundown of how the ESP32 operates within my device:
1. Initialization - This is where the WiFi radio's settings are set
AT Commands used:
AT+RESTORE - to erase the radio in case it's already programmed with older settings
AT+CWMODE=1 - to set the device as a station
AT+UART_DEF=115200,8,1,0,0 - setup the comm settings
AT+CWHOSTNAME=\"%c%c%c%c\"
AT+CIPDNS=1,"8.8.8.8","1.1.1.1"
AT+CWDHCP=1,1 - to set to DHCP mode
AT+CWJAP="SSID","passkey"
Are there any important settings here that I might be missing?
2. Connection check
I poll the device with AT+CIPSTATUS for ~30 times (once every second) or until I get 2 or 3. If at the end of 30 polls I still haven't gotten 2 or 3, I'll power cycle the radio and wait a set amount of time until I start polling with CIPSTATUS again.
Essentially the only method I'm using to attempt a reconnection is power cycling the radio with the AT+CWAUTOCONN (which is set to enabled by default). Is this sufficient? Is there any more direct way to getting the ESP32 to attempt to reconnect to the AP?
3. If I get a good response from CIPSTATUS, I'll open a socket with AT+CIPSTART and then send my data with AT+CIPSEND
I don't really ever have issues when I get to this point. It's more that I have issues when I get disconnected from the AP. I know there's a new firmware version for ESP-AT (v2.1) and it looks like CWJAP has some new additions for staying connected to the AP, but I'm wondering if there's anyway to improve getting reconnected on v1.3 other than power cycling the radio.
Thanks for your help in advance.
Best Practices for Using ESP-AT?
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- 全国大学生物联网设计竞赛乐鑫答疑专区
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: tomy983 and 255 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.