Weather station with ESP32 C3 Mini

I'm thinking of finally dipping a toe in the ESP32 water and would like some constructive criticism of my idea.

Currently my weather station has a Wemos D1 mini pro (ESP8266), plus an ATtiny85. I've never been entirely happy with this arrangement. How many times have I lectured beginners on this forum about not using 2 "Arduino" (ie. 2 MCU) in the same circuit? Yet I did it myself.

My reason was that the wind speed anemometer, wind vane and rain guage need constant monitoring. All 3 sensors are based on magnets and reed switches. Something needs to detect their signal edges or resistance continuously.

Because the weather station runs on battery power (li-ion cell), I need to minimise power usage, so the Wemos D1 mini needs to spend most of its time in deep sleep. The ATtiny monitors the wind & rain sensors continuously.

The D1 mini wakes every 15 mins, gets the readings from the ATtiny via software UART, it also reads SHT31 temp/humidity and BH1750 light level sensor over i2c, connects to WiFi and POSTs the data off to a local server on my LAN.

The D1 mini has a UFL connector to connect to an external higher gain antenna to ensure a reliable connection to the WiFi despite poor signal strength where it is located.

I'm thinking I could replace the D1 mini pro and ATtiny with an ESP32 C3 Super Mini "plus". The "plus" just means it has a UFL connector for that important external antenna.

I'm reading up about the specs and capabilities of the C3 to try to figure out if it's a good fit to replace the D1 + ATtiny.

I'm thinking that, similar to the D1 mini, the C3 will spend most of its time in deep sleep. But unlike the D1 mini, the C3 can wake from deep sleep when there are signal edges from the anemometer or rain gauge. This involves using a feature called "wake stub" which is a user-defined function that runs from its RTC memory, which is retained during deep sleep, unlike most of the RAM memory. Variables can also be stored in this RTC memory.

The wake stub function could, I think, count the signal edges from the anemometer/rain gauge, read the resistance of the wind vane and go immediately back to deep sleep.

On a timed 6 second interval, it would wake and check for a new highest wind gust speed and go back to deep sleep.

Every 150 timed wakes (15 mins), it would finally properly wake the ESP32 up to connect to WiFi and POST off the results.

So I would ideally like advice from someone with experience using the ESP32 C3 about my plan/idea. Can I use it like this? Will it wake from deep sleep fast enough for this idea too work?

Some further details: the anemometer could generate up to about 50 interrupts per second during extremely high winds. Most of the time it will be far fewer interrupts per second. The rain guage will only generate a few interrupts per minute at most even in heavy rain.

Note that the Seeed XIAO version of the ESP32C3 has a better build quality and it has a builtin charger and LiPo battery connection. Well worth a few dollars more.
It also comes with a stick-on aerial.
Leo..

2 Likes

Thanks, I'll definitely consider the XIAO.

The built-in charger isn't needed in this particular case. I currently replace the empty battery with a fully charged replacement so the sensor is back up and running.

I didn't know about the 'Wake Stub', I need to find the docs now. I assume the wind gauge will trigger the wake, but I am curious to hear how well that works at 50 interrupts per second.

Just found the docs, very cool.

Sorry, I should have posted the link

Deep Sleep Wake Stubs - ESP32-C3 - — ESP-IDF Programming Guide v5.0 documentation.

On the link above it says

The wake stub code can only call functions implemented in ROM or loaded into RTC Fast Memory (see below.)

I wonder if that would include digitalRead() and analogRead()? Those may be the only two functions I would need in the wake stub.

There's also a way to increase speed of wake up from deep sleep described here

I was surprised to find a ROM implementation of printf. Now I need to investigate everything in ROM.
I recently discovered the tiny size of the XIAO including the model with a camera. Literally the size of my thumbnail. Now this super low power functionality will keep me busy for the coming winter months.

1 Like

My ESP32 Supermini C3 arrived today. So far, so good!

I tested its wifi sensitivity, using its built-in antenna.

15:23:40.574 -> Scan start
15:23:43.356 -> Scan done
15:23:43.356 -> 4 networks found
15:23:43.356 -> Nr | SSID                             | RSSI | CH | Encryption
15:23:43.356 ->  1 | granary                          |  -47 | 13 | WPA2
15:23:43.356 ->  2 | DIRECT-59-HP M283 LaserJet       |  -53 |  6 | WPA2
15:23:43.356 ->  3 | granary2                         |  -91 |  1 | WPA+WPA2
15:23:43.389 ->  4 | (redacted)                       |  -92 | 11 | WPA2

For comparison, here are the results for my Wemos D1 mini pro using its built-in antenna, in the same position:

15:15:06.649 -> Scan start
15:15:08.870 -> Scan done
15:15:08.870 -> 3 networks found
15:15:08.870 -> Nr | SSID                             | RSSI | CH | Encryption
15:15:08.870 ->  1 | DIRECT-59-HP M283 LaserJet       |  -50 |  6 | WPA+WPA2
15:15:08.870 ->  2 | (redacted)                       |  -84 | 11 | WPA+WPA2
15:15:08.870 ->  3 | granary                          |  -45 | 13 | WPA+WPA2

and the Wemos D1 mini pro using an external antenna (maybe 3dBi, I can't remember):

15:20:42.997 -> Scan start
15:20:45.215 -> Scan done
15:20:45.215 -> 5 networks found
15:20:45.215 -> Nr | SSID                             | RSSI | CH | Encryption
15:20:45.215 ->  1 | (redacted)                       |  -94 |  1 | WPA+WPA2
15:20:45.215 ->  2 | DIRECT-59-HP M283 LaserJet       |  -42 |  6 | WPA+WPA2
15:20:45.215 ->  3 | (redacted)                       |  -97 | 10 | WPA+WPA2
15:20:45.215 ->  4 | (redacted)                       |  -75 | 11 | WPA+WPA2
15:20:45.249 ->  5 | granary                          |  -40 | 13 | WPA+WPA2

I need to figure out how to configure the C3 super mini to use an external antenna. Any idea, anyone?

This post gives a clue. I can't see your board in details. Some of them already have a zero ohm resistor connecting the 2 antennas. Never tried it myself.

Thanks for the link, but it looks wrong to me.


If you did what they are suggesting, the external antenna and the built-in antenna would both be connected at the same time. That would result in having the wrong impedance connected to the chip, which would give a poor result and possibly damage the chip, I think.

Perhaps it's also important to remove the built-in antenna when you make that link.

just solder/swipe off the red aerial first.
It's just a piece of double-sided circuit board with a 3-4 turn coil etched on it.
It's only electrically connected on one side, the hot side. The other side is just for support.
Too bad you didn't get the Seed XIAO ESP32C3. It's smaller, shielded has external aerial included and more.
Have fun with your new toys.
Leo..