DesconBelgrade / Klimerko

☁ DIY Air Quality Monitoring Device
https://klimerko.org
GNU General Public License v3.0
114 stars 21 forks source link

Klimerko stops working - dots in serial monitor #15

Closed dcabro closed 3 years ago

dcabro commented 3 years ago

Not sure why it stops working, but I only see dots in serial monitor. This has happened at least 5-10 times so far.

Is there a way to debug this? Or do you know what those dots mean?

epiller commented 3 years ago

Can you double check your AllThingsTalk credentials? Try generating a new Token if you're sure they're correct.

dcabro commented 3 years ago

Everything starts working without issues after hard reset (power off/on)

dcabro commented 3 years ago

So it happened again: image

dcabro commented 3 years ago

And again.

epiller commented 3 years ago

What you're seeing is the device trying to connect to something (either WiFi or AllThingsTalk - the blue LED on the NodeMCU should be fading in/out). I'm assuming you opened Serial Monitor after the device stopped responding and if that's the case, make sure to have Serial Monitor open before this issue happens so you can see exactly what it says before it fails. Before you do this, I'd recommend changing line 113 device.debugPort(Serial); to device.debugPort(Serial, true); which will enable verbose debug output from the AllThingsTalk SDK.

dcabro commented 3 years ago

Correct, I opened the Serial Monitor after the device stopped responding. I've changed the line 113 and will leave the serial monitor open. Will let you know when it stops working again. Thanks.

dcabro commented 3 years ago

Asset: wifi-signal, Value: Good AllThingsTalk Connection Dropped! Reason: Network connection was broken Connecting to WiFi: <redacted-wifi-name>.....................................................

So the wifi connection was dropped. But why doesn't it reconnect?

epiller commented 3 years ago

Are you running the latest ESP8266 core? If you are, I have no idea what could be causing this as I don't have a way to test it because it works on my end (and seems to work on other people's devices as well).

dcabro commented 3 years ago

I'm running ESP8266 2.7.4. So do you think it's a hardware issue or a software one? I do have a spare NodeMCU that I can switch to if you think it's a hardware issue.

epiller commented 3 years ago

It could very well be a software issue, but it's really hard to tell what's up. I'd say go for it and change the board, but before you do that, check your WiFi: Try changing the channel, seeing how many devices are connected to the 2.4GHz network (if it's a dual band router), connecting to a different WiFi, etc.

dcabro commented 3 years ago

I have other wifi clients (like cell phones) and they are all working fine, or at least they do not get stuck if they are disconnected.

Furthermore, I don't believe that wifi client that never gets disconnected from the AP/Router even exists. Instead this probably happens often and its no big deal as long as they reconnect and continue working.

The real question is which part of the code is responsible for the wifi connection? I'm gonna ping those devs if that's not you.

On Tue, Jan 12, 2021, 21:54 Vanja notifications@github.com wrote:

It could very well be a software issue, but it's really hard to tell what's up. I'd say go for it and change the board, but before you do that, check your WiFi: Try changing the channel, seeing how many devices are connected to the 2.4GHz network (if it's a dual band router), connecting to a different WiFi, etc.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DesconBelgrade/Klimerko/issues/15#issuecomment-758974298, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAX5TGYUQZDSRVWDBW5IIS3SZSZIVANCNFSM4VTRRXDQ .

epiller commented 3 years ago

Of course the device will disconnect and reconnect eventually, but the thing is that I can't replicate your problem - no matter what I try, it always reconnects successfully. I wrote the AllThingsTalk WiFi SDK and methods connectWiFi and maintainWiFi are responsible for WiFi.

dcabro commented 3 years ago

Hasn't happened since then. But if it does, is there a way to debug it further?

On Tue, Jan 19, 2021 at 2:54 PM Vanja notifications@github.com wrote:

Of course the device will disconnect and reconnect eventually, but the thing is that I can't replicate your problem - no matter what I try, it always reconnects successfully. I wrote the AllThingsTalk WiFi SDK and methods connectWiFi https://github.com/allthingstalk/arduino-wifi-sdk/blob/604d27218aed429b4271d1b3b7955d74eef7640e/src/ATT_ESP8266.h#L280 and maintainWiFi https://github.com/allthingstalk/arduino-wifi-sdk/blob/604d27218aed429b4271d1b3b7955d74eef7640e/src/ATT_ESP8266.h#L308 are responsible for that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DesconBelgrade/Klimerko/issues/15#issuecomment-762852925, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAX5TG32RSDXNHC4KGWOVR3S2WFIHANCNFSM4VTRRXDQ .

epiller commented 3 years ago

Nothing pops in my mind right now except going deep into ESP Arduino Core WiFi classes.

Milutix commented 3 years ago

Filename: ATT_ESP8266.h Line: 292

There is a while loop which never ends. It prints out the '.' character every 10000ms.

I presume you should be trying to reconnect instead? Line 291 should be placed within this while loop if I understand this correctly.

dcabro commented 3 years ago

How about this?

https://github.com/esp8266/Arduino/issues/7432

epiller commented 3 years ago

Filename: ATT_ESP8266.h Line: 292

There is a while loop which never ends. It prints out the '.' character every 10000ms.

I presume you should be trying to reconnect instead? Line 291 should be placed within this while loop if I understand this correctly.

It does end - once the device reconnects to WiFi but in your case it doesn't. The sketch you upload to your ESP8266 is not the sole thing that's going to run on it. There's some additional stuff happening in background, one of them being WiFi connection handling (which is the reason why delay(x) for prolonged periods crashes the connection). Once WiFi.begin is executed, credentials are passed to the underlying WiFi handling functions and the device is given permission to start connecting to WiFi. If it ever disconnects, it should automatically try to reconnect again, but this is invisible to the user/library. I will look into this in more detail, try to replicate the issue on my Klimerko and figure out a fix. @dcabro I saw that thread sometime last year but I'll have to look at it again. Thanks!

dcabro commented 3 years ago

Pulled the device out of use.

epiller commented 2 years ago

Hey @dcabro, the new 2.0.0 release may fix this issue.