ESPhome cant connect to Wi-Fi 'Association Expired'

TLDR; minimal yaml file from the ESPhome wizard will not connect to Wi-Fi. What else is needed ?

I recently purchased a DFR0602 ESP32-CAM Development Board thinking it would be an easy introduction to ESP environment.

First step was to get serial comms working - done using minicom
Next step is a minimal yaml configuration to check Wi-Fi connection - NO GO !

Using the ESPhome wizard, selecting ESP32 platform, board “esp32cam” (as per AI Thinker ESP32-CAM — PlatformIO latest documentation), my SSID and Password; and then adding static IP address I get this YAML:

esphome:
  name: esp32-cam

esp32:
  board: esp32cam
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: ""

ota:
  password: ""

wifi:
  ssid: "erykah"
  password: "**redacted**"
  power_save_mode: none

  # Optional manual IP
  manual_ip:
    static_ip: 192.168.1.123
    gateway: 192.168.1.1
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp32-Cam Fallback Hotspot"
    password: "RiYYkI0mWCkc"

captive_portal:

Looking back through the output from esphome wizard I find some warning messages …

Library Manager: Installing Hash
Library Manager: Warning! Could not install dependency {'name': 'Hash', 'platforms': ['espressif8266']} for package 'ESPAsyncWebServer-esphome'
Library Manager: Installing ESP8266WiFi
Library Manager: Warning! Could not install dependency {'name': 'ESP8266WiFi', 'platforms': ['espressif8266']} for package 'ESPAsyncWebServer-esphome'
Dependency Graph
Compiling .pioenvs/esp32-cam/FrameworkArduino/esp32-hal-touch.c.o
/home/don/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c: In function 'spiTransferBytesNL':
/home/don/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:922:39: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
                 uint8_t * last_out8 = &result[c_longs-1];
                                       ^
/home/don/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:923:40: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
                 uint8_t * last_data8 = &last_data;
                                        ^
Compiling .pioenvs/esp32-cam/FrameworkArduino/esp32-hal-uart.c.o

Since it appeared to work, I continued by running “esphome -v run ESP32-CAM.yaml”, I get

========================================================================== [SUCCESS] Took 3.59 seconds ==========================================================================
INFO Successfully compiled program.
DEBUG Running:  esptool.py --before default_reset --after hard_reset --baud 460800 --port /dev/ttyUSB0 --chip esp32 write_flash -z --flash_size detect 0x10000 /home/don/.esphome/build/esp32-cam/.pioenvs/esp32-cam/firmware.bin 0x1000 /home/don/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader_dio_40m.bin 0x8000 /home/don/.esphome/build/esp32-cam/.pioenvs/esp32-cam/partitions.bin 0xe000 /home/don/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin
esptool.py v3.2
Serial port /dev/ttyUSB0
Connecting.....
Chip is ESP32-D0WD (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: a4:e5:7c:d5:4a:14
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00010000 to 0x000fafff...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Compressed 959680 bytes to 533111...
Wrote 959680 bytes (533111 compressed) at 0x00010000 in 13.1 seconds (effective 584.9 kbit/s)...
Hash of data verified.
Compressed 17104 bytes to 11191...
Wrote 17104 bytes (11191 compressed) at 0x00001000 in 0.6 seconds (effective 236.2 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 144...
Wrote 3072 bytes (144 compressed) at 0x00008000 in 0.1 seconds (effective 401.5 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 630.9 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/ttyUSB0 with baud rate 115200

[17:32:58]ets Jun  8 2016 00:22:57
[17:32:58]
[17:32:58]rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[17:32:58]configsip: 0, SPIWP:0xee
[17:32:58]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[17:32:58]mode:DIO, clock div:2
[17:32:58]load:0x3fff0018,len:4
[17:32:58]load:0x3fff001c,len:1044
[17:32:58]load:0x40078000,len:10124
[17:32:58]load:0x40080400,len:5828
[17:32:58]entry 0x400806a8
[17:32:58]ets Jun  8 2016 00:22:57
[17:32:58]
[17:32:58]rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[17:32:58]configsip: 0, SPIWP:0xee
[17:32:58]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[17:32:58]mode:DIO, clock div:2
[17:32:58]load:0x3fff0018,len:4
[17:32:58]load:0x3fff001c,len:1044
[17:32:58]load:0x40078000,len:10124
[17:32:58]load:0x40080400,len:5828
[17:32:58]entry 0x400806a8
[17:33:07]ets Jun  8 2016 00:22:57
[17:33:07]
[17:33:07]rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[17:33:07]configsip: 0, SPIWP:0xee
[17:33:07]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[17:33:07]mode:DIO, clock div:2
[17:33:07]load:0x3fff0018,len:4
[17:33:07]load:0x3fff001c,len:1044
[17:33:07]load:0x40078000,len:10124
[17:33:07]load:0x40080400,len:5828
[17:33:07]entry 0x400806a8
[17:33:09]\xff[I][logger:214]: Log initialized
[17:33:09][C][ota:461]: There have been 1 suspected unsuccessful boot attempts.
[17:33:09][D][esp32.preferences:114]: Saving preferences to flash...
[17:33:09][I][app:029]: Running through setup()...
[17:33:09][C][wifi:037]: Setting up WiFi...
[17:33:09][D][wifi:373]: Starting scan...
[17:33:11][D][wifi:388]: Found networks:
[17:33:11][I][wifi:432]: - 'erykah' (64:66:B3:ED:08:C4) ▂▄▆█
[17:33:11][D][wifi:433]:     Channel: 1
[17:33:11][D][wifi:434]:     RSSI: -84 dB
[17:33:11][D][wifi:437]: - 'TelstraBA7ECC' (D4:35:1D:BA:7E:CC) ▂▄▆█
[17:33:11][D][wifi:437]: - 'Belong325DEE' (48:D2:4F:32:5D:F4) ▂▄▆█
[17:33:11][D][wifi:437]: - 'aitkenhome' (B0:39:56:C2:A6:9A) ▂▄▆█
[17:33:11][D][wifi:437]: - 'WiFi-5581' (10:27:F5:48:55:81) ▂▄▆█
[17:33:11][D][wifi:437]: - 'Vodafone2.4G-26526' (A4:91:B1:22:65:27) ▂▄▆█
[17:33:11][D][wifi:437]: - 'TPLINK_EXT' (F8:CA:59:39:44:29) ▂▄▆█
[17:33:11][D][wifi:437]: - 'Telstra16CF21' (D4:35:1D:16:CF:21) ▂▄▆█
[17:33:11][D][wifi:437]: - '' (FA:8F:CA:8A:3D:EF) ▂▄▆█
[17:33:11][D][wifi:437]: - 'Vodafone-2.4' (F8:CA:59:CC:C7:D0) ▂▄▆█
[17:33:11][D][wifi:437]: - '' (72:32:B1:FD:85:29) ▂▄▆█
[17:33:11][I][wifi:248]: WiFi Connecting to 'erykah'...
[17:33:13][W][wifi_esp32:495]: Event: Disconnected ssid='erykah' bssid=64:66:B3:ED:08:C4 reason='Association Expired'
[17:33:13][W][wifi:557]: WiFi Unknown connection status 0
[17:33:13][W][wifi:557]: WiFi Unknown connection status 0
[17:33:13][W][wifi:557]: WiFi Unknown connection status 0
[17:33:13][W][wifi:557]: WiFi Unknown connection status 0
[17:33:13][W][wifi:557]: WiFi Unknown connection status 0
[17:33:13][W][wifi:557]: WiFi Unknown connection status 0
[17:33:13][W][wifi:557]: WiFi Unknown connection status 0
[17:33:13][W][wifi:557]: WiFi Unknown connection status 0
[17:33:13][W][wifi:557]: WiFi Unknown connection status 0
[17:33:13][W][wifi:557]: WiFi Unknown connection status 0
[17:33:13][W][wifi:557]: WiFi Unknown connection status 0
[17:33:13][W][wifi:557]: WiFi Unknown connection status 0
[17:33:13][W][wifi:557]: WiFi Unknown connection status 0
[17:33:13][W][wifi:557]: WiFi Unknown connection status 0

It appears to spend max 2 seconds trying the Wi-Fi connection, so I guess it’s not actually trying.

What else needs to be added to a minimal install to get Wi-Fi working ??

1 Like

Hi Donald,

While I havent setup an ESP-CAM using ESPhome before, Diego has an awesome project setting a CAM module up here: ESP32 IR-Triggered Camera with Home Assistant Integration - Tutorial Australia

Diego mentions using a a static IP address to connect on. Also worth noting is that antennas in general can behave in odd ways when you put some metal near them, if you’re experimenting on a breadboard, I’d test with the ESP-CAM disconnected and in the air away from other metal/electronic devices.

Liam

Thanks Liam,

I had already added a static IP, but that didn’t make any difference.

SOLVED (I think).
My phone works fine in my study, but it seems that the ESP01 and ESP32-CAM aren’t getting a good enough wi-fi signal there. Going at an angle through 4 concrete walls, a pantry and a closet cuts the signal down to -80dBm which is probably not enough for small aerials. And then there’s that meatbag sitting at my desk also in the way, while I’m trying to do this testing :wink:

I have added a Wi-Fi extender and devices now connect without any problem :slight_smile:

Now to add to the YAML code to get them to do something :wink:

2 Likes