jomjol / AI-on-the-edge-device

Easy to use device for connecting "old" measuring units (water, power, gas, ...) to the digital world
https://jomjol.github.io/AI-on-the-edge-device-docs/
5.67k stars 612 forks source link

Cannot connect to Wifi #168

Closed zoltanszalontay closed 3 years ago

zoltanszalontay commented 3 years ago

My device cannot connect to my Wifi network. My other ESP32 devices have no problem with it so it may not be a security or channel config problem. The critical line is marked with "==>". I guess MAC address is not set, but I do not know how to do that.

The LED flashes 4 times (not 5!) in a second infinitely.

Any ideas? Also, a serial log from a normally working device would be appreciated. Thanks

ssid = "XXXXXX" password = "XXXXXXX" hostname = "watermeter" ;hostname is optional

;if you want to use a fixed IP you need to specify the following 3 parameters (ip, gateway, netmask) with IP4-Addresses "123.456.789.012" ;ip = "IP4-ADDRESS" ;gateway = "IP4-ADDRESS" ;netmask = "255.255.255.0"

;in some cases you want to specify the DNS server as well (especially, if it is not identical to the gateway - this is optional for a fixed IP dns = "192.168.1.1" WLan: XXXXXX, XXXXXX Hostename: watermeter Fixed IP: , Gateway , Netmask , DNS 192.168.1.1 Connect to WLAN with dyn. IP ==>␛[0;32mI (5994) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE␛[0m ==>␛[0;32mI (5994) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE␛[0m ␛[0;32mI (6114) phy: phy_version: 4180, cb3948e, Sep 12 2019, 16:39:13, 0, 0␛[0m ␛[0;32mI (6124) gpio: GPIO[33]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 ␛[0m ␛[0;32mI (8854) gpio: GPIO[33]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 ␛[0m ␛[0;32mI (12904) gpio: GPIO[33]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 ␛[0m ␛[0;32mI (16024) gpio: GPIO[33]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 ␛[0m ␛[0;32mI (20074) gpio: GPIO[33]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 ␛[0m ...

jomjol commented 3 years ago

Hi @zoltanszalontay,

the marked lines are not a problem, they are normal. The infinety blinking is strange. Because slow blinking means, that it is connected. Maybe it is thrown out of the WLAN immedeatly and reconnects infinitly.

Here is a serial log of my device, which connects without any problem:

ssid = "XXXXXXXX"
password = "YYYYYYYY"
hostname = "watermeter"
;hostname is optional

;if you want to use a fixed IP you need to specify the following 3 parameters (ip, gateway, netmask) with IP4-Addresses "123.456.789.012"
;ip = "192.168.178.26"
;gateway = "192.168.178.1"
;netmask = "255.255.255.0"

;in some cases you want to specify the DNS server as well (especially, if it is not identical to the gateway - this is optional for a fixed IP
dns = "192.168.178.42"
WLan: XXXXXXXX, YYYYYYYY
Hostename: watermeter
Fixed IP: , Gateway , Netmask , DNS 192.168.178.42
Connect to WLAN with dyn. IP
␛[0;32mI (5964) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE␛[0m
␛[0;32mI (5964) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE␛[0m
␛[0;32mI (6094) phy: phy_version: 4180, cb3948e, Sep 12 2019, 16:39:13, 0, 0␛[0m
␛[0;32mI (6094) gpio: GPIO[33]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 ␛[0m
␛[0;32mI (7944) esp_netif_handlers: sta ip: 192.168.178.26, mask: 255.255.255.0, gw: 192.168.178.1␛[0m
␛[0;32mI (7944) gpio: GPIO[33]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 ␛[0m
IPv4 :  192.168.178.26
HostName :  watermeter
zoltanszalontay commented 3 years ago

Thanks for your answer! Now I see what to expect.

Yesterday, I have just put together my initial config and the power is provided by the serial USB connection. According to the link below, that may be the problem so I’ll follow your complete schematics today. https://esp32.com/viewtopic.php?t=6743

zoltanszalontay commented 3 years ago

OK, I got it working. It was the built-in wifi antenna. It's simply too weak to connect to AP. I connected a a 2.4GHz antenna to the IPEX port and I was up and running immediately.

Now, I'll move the whole stuff to my water meter to check whether it can classify the figures.

P.S.: My goal is to add an LMIC library to connect my house via LoRa.

Great work! Thanks!

jomjol commented 3 years ago

Good to know - if you have input for the LMIC library, let me know. It would be intersting for the others as well and we could incorporate in one of the next versions.