jhughes1010 / weather

30 stars 17 forks source link

24hr Counter Resetting every 1-2hrs #14

Closed jeremyruffell closed 1 year ago

jeremyruffell commented 1 year ago

Hey There,

I am not sure if you have/had encountered this issue before so I thought I'd ask before diving into it. My Rainfall 24hr counter seems to reset every hour or two and I have also noticed things like my boot count, time enabled pretty much all "time stored metrics" are resetting to 0.

The only changes I have made is waking up every 60s as I have a decent battery and lots of sun.

Any Ideas?

image
jhughes1010 commented 1 year ago

I have a few ideas on possibilities. What version of software are you using (just to get a baseline)? What LDO do you have on your PCB (the TO-92 package or the SOT SMD)?

Just focus on the boot parameter, if it resets, history items will be reset also. This is most likely the "real" problem.

Possibilities that I've seen so far:

  1. LDO cannot deal with inrush current (TO-92 package)
  2. Poor WiFi signal, or inability to connect. I tried to correct this in software, but have not done extensive testing.
  3. The PCB may actually be getting wet.

Item 3 is probably the easiest to try to rule out. Watch for boot RESET events when it's dry and sunny. Item #2 can be seen if you increase WDT_TIMEOUT (say 4x) to see if we can get a visible delay between last reported non-zero boot count and RESET to zero. Item #1 was something I observed, but do not know if most people saw it. Let's answer the easy questions first about LDO type and the other items I outlined.

jeremyruffell commented 1 year ago

Thanks for the reply! So from what I can see my LDO is a TC1262, I bought the pre-built v3.2 weather station from PCBWay, Debasish stated it had a 500mA LDO ( TC1262-3.3V ).

I will start with increasing the WDT_TIMEOUT to 240, keep it inside overnight next to my UniFi AP, and see if over the next 12 hours it drops out.

jhughes1010 commented 1 year ago

You have the better LDO I chose. Do you know the software version?

jeremyruffell commented 1 year ago

I am running v1.3.1, minor changes to MQTT topic structures. I also had to comment out the setCpuFrequencyMhz (80); line as it was causing my SI1145 to always return 0. I did some googling and someone else had a similar issue.

I can say, after running it all night with WDT set to 240 & stronger RSSI I have a boot count of 104! So something you recommenced fixed it!

jhughes1010 commented 1 year ago

This also means my maximum retry for WiFi connection is not solving my issue on RESET and watchdog timer. FYI, 1.3.2 is not a big deal for you and not worth using

jeremyruffell commented 1 year ago

Is it worth me rolling back m the WDT_TIMEOUT to 60 and testing that over the day or are you happy you know what the issue is? I now have an AP < 5m from my station so this shouldn’t be an issue again for me but I am more then happy to lock it to an AP ages away to test a fix of you implement one.

jhughes1010 commented 1 year ago

The goal of adjusting WDT_TIMEOUT was to not have that time identical to the timer wake parameter. We can look at MQTT explorer and see when boot goes back to zero if the time from the last counter reading matches WDT_TIMEOUT or not.

jhughes1010 commented 1 year ago

I can force a poor RSSI on my end and investigate more. I'll try to make it more failsafe.

jeremyruffell commented 1 year ago

I have put the WDT_TIMEOUT back to the default (60), And boot interval of 5mins. So far 2 hours no issues. I will post an update later today and let you know how I got on.

jhughes1010 commented 1 year ago

Do you know what your signal strength was at the original location? One theory would be that you could connect to WiFi, but not TX/RX packets reliably (still timing out) and hanging up and hitting the WDT limit.

jeremyruffell commented 1 year ago

RSSI was around -80, Now I am chilling around -50. Seemed to run fine today inside so I have put back outside on a 5min wake time with a WDT of 60.

On another side note have you managed to get OTA Updates working?

jhughes1010 commented 1 year ago

Have not messed with OTA at all yet. Working functional items and enhancements first. Keep me posted on how it performs back outdoors.

jeremyruffell commented 1 year ago

Can confirm overnight it ran well.

186 boots @ 5min wakeup interval, not sure if this increments when rain gauge tips, I'd have to double check the code.

image