ESP32 / MQTT / BME280 problem..
Posted: Sun Mar 20, 2022 12:13 am
I'm getting somewhat frustrated because of a file I'm working on for... a while.
My goals is simple:
Sample a sensor (BME280), send the data to MQTT (Thingspeak) and go to deepsleep until the next sample about 5 mins later. All this with a ESP32 Wroom
But this has a few features that need to work.
1- It needs to see which of 4 known SSID he has the strongest connection with. And choose the strongest (this works).
-- I use 8 variables to make this work. 4 store the known SSID names, and 4 the paswords of the know SSIDs.
-- This feature seems to work
2- it should become a battery powered (mobile) device so the less power it needs the better.
-- this needs to be finetuned by using the different macro's in a smart way (not starting the WIFI before there is a valid sensor sample and...)
3- I need to add more checks if all steps work fine and if somethings wrong => go to deepsleep
Most of the stuff works. But for most of the time something goes wrong. The file doesn't work consistence.
If I look at the data on Thingspeak there are moments that for 30minutes there is no valid data posted.
In an earlier version I had UART enabled and send feedback for each and every step, but most of the time the initialization of the sensor gave a 0 as return.
My problem is that I can't seem to figure out why the project sometimes works and sometimes it doesn't.
By waking up from deep sleep, it starts from main every time so if there is nothing different from previous time, it should work like previous time.
Can someone please dive into this chart and think with me why it sometimes works and sometimes it doesn't?
The device is 1 m from the access point it uses so there was never a connection problem.
The brownout detection is been switched of in the sdkconfig
The flowchart is somewhat messy I know, but this changes every 15 minutes while I'm working on it.
Why does the BME280 gave a 0 after initialisation before? I did never change anything on the hardware...
Any suggestion/help is welcome.
My goals is simple:
Sample a sensor (BME280), send the data to MQTT (Thingspeak) and go to deepsleep until the next sample about 5 mins later. All this with a ESP32 Wroom
But this has a few features that need to work.
1- It needs to see which of 4 known SSID he has the strongest connection with. And choose the strongest (this works).
-- I use 8 variables to make this work. 4 store the known SSID names, and 4 the paswords of the know SSIDs.
-- This feature seems to work
2- it should become a battery powered (mobile) device so the less power it needs the better.
-- this needs to be finetuned by using the different macro's in a smart way (not starting the WIFI before there is a valid sensor sample and...)
3- I need to add more checks if all steps work fine and if somethings wrong => go to deepsleep
Most of the stuff works. But for most of the time something goes wrong. The file doesn't work consistence.
If I look at the data on Thingspeak there are moments that for 30minutes there is no valid data posted.
In an earlier version I had UART enabled and send feedback for each and every step, but most of the time the initialization of the sensor gave a 0 as return.
My problem is that I can't seem to figure out why the project sometimes works and sometimes it doesn't.
By waking up from deep sleep, it starts from main every time so if there is nothing different from previous time, it should work like previous time.
Can someone please dive into this chart and think with me why it sometimes works and sometimes it doesn't?
The device is 1 m from the access point it uses so there was never a connection problem.
The brownout detection is been switched of in the sdkconfig
The flowchart is somewhat messy I know, but this changes every 15 minutes while I'm working on it.
Why does the BME280 gave a 0 after initialisation before? I did never change anything on the hardware...
Any suggestion/help is welcome.