#Exhausted... Been putting in a lot of late nights rewriting my #esp8266 weather station code this past week, but making good progress. The original code was a mess in a single file so my goal was to break up each sensor into their own files and make pieces more self-contained. Some bits have dependencies, like OTA requires the wifi module, but this should make it really easy to add new sensors in the future.
Most of my units are satellite stations that run on #solar power, they simply collect info every 5 minutes then sleep. The original code runs for about 1.8 seconds, which is pretty good for battery life. The new code has been running closer to 3-4 seconds. I did make good progress here though, I found one sensor initialization was blocking, but they had a method to run without blocking. I also rewrote my wifi connection function to be non-blocking. Still work to do, but close to 2.4s runtime now.
One of the biggest challenges has been trying to add in a DS18B20 temperature probe. My setup runs on a D1 Mini board,with 1wire attached to D3. I just learned that D3 has an onboard 10k resistor for booting, probably explaining why the recommend 4k7 didn't work at all (nor did a 10k). Adding a 47k across the probe seems to be working, but one of my test boards started failing again this morning. Guess I'll have to try another value.

I created a small board for the D1 mini to plug in to many years ago, it sets up an ads1015 and connectors to monitor battery voltage, solar cell input, a CdS cell to gauge sunlight, and a free analog input for things like soil moisture.

I've been thinking it's time to split this into two boards -- one for the satellite sensors, and one for the main (AC-powered) weather station. There are some hardware requirements differences between the two, and a single solution no longer seems to fit everything.

I think I worked out the #DS18B20 problem finally. My boards are set up to power sensors using D7 and D8 to control Vcc and ground going to each, and that dropped the voltage too much since this sensor is barely rated for 3.3v. So for my 1wire plug I connected Vcc directly to the battery and just switch the ground.

Well last night's test provided sensor reading down to 2.39v before the #esp8266 itself gave out, and I was able to eliminate the extra resistor I kept messing with. Success!

While checking amp readings to make sure the #ds18b20 was getting fully switched off, I realized that even in deep sleep the #d1mini board was still pull about 10mA. Yikes! Turns out the 5v regulator leeches power even when not being used. That probably explains why I only get a few days run time from a 14500 battery when I was expecting closer to 3 weeks. Now I'll have to pull the regulator from a board and see how long the battery lasts...

All right, first round of comparison testing, #esp8266 D1mini. It wakes up every minute to collect sensor data and send it out over wifi via MQTT, then goes back into deep sleep (awake time is ~2 seconds). The stations in the yard only wake up every 5 minutes.

The test last night had an incomplete battery charge, but still ran for just over 10 hours. I just need to note when the battery gets back down to the same level for an accurate comparison, but hopefully that won't be for a few days?

Wow, this test is blowing me away! For anyone running any battery-powered #esp8266 projects, I think removing the voltage regulator is a MUST.

So far I can report that there is a quick drop in battery voltage in the first four hours (from 3.50 down to 3.43v), then it levels off. In the last 15 hours the battery has only dropped 0.06v (down to 3.37). I mean, that's just incredible for collecting sensor data and sending out a wifi burst once every minute. At this point it might be another 4 days before the battery drops to where the first test started (at 3.17v, which only lasted 10 hours with the regulator).

Also for reference... the connected sensors on this board are an ads1015 (adc) for monitoring battery and charger voltages, a CdS cell to roughly measure sunlight, and an input for ground moisture; an SHT31 to measure temperature and humidity (other boards have a BME280); plus the DS18B20 for measuring pond temp and I hope to also start measuring ground temp from another unit.

Back to the new #weather station code on the #esp8266, I've been poking at the bits that measure wind speed. The code accumulates data over 3-second periods and calculates average, gusts, and lulls. Well that's great and all, but 3 seconds to measure gusts?

It hit me last night that I can take this the opposite way, and instead record the shortest period between anemometer rotations, giving instantaneous results. Pretty windy today so I have a lot of data, and the results are looking really good!

It's actually giving results that closely match the long-term measurements, which tells me I did the math right, but sometimes there are bursts that exceed the old readings. That tells me that I've been missing quite a lot of micro-bursts... oh a small one just happened. Wind speed of 2mph, the old method didn't even see a gust but the new code captured a 7.91mph blast. Very cool!