B4R Question Wemos D1 + BME280 + Thingspeak: No more Logs after first iteration.

Mark Read

Well-Known Member
Licensed User
I am using a Wemos D1 Mini and BME280 Sensor. I read the data from the sensor and upload to thingspeak. I have logs set in the various subs for debugging. On the first run, I see all the logs till the upload is reached, then the logs stop. The program continues to run perfectly. I know this as the data is visible in thingspeak. I have included the zip file. The Thingspeak channel is a test channel which I can delete later so I included the API Key.

Further library requirements: BME280 with ESP8266

My queston: Why do the logs freeze or stop? Have I forgotten something?


DEBUG StatusLogger All asynchronous threads have terminated
DEBUG StatusLogger RollingFileManager shutdown completed with status true
DEBUG StatusLogger Shut down RollingFileManager E:\Arduino-1.8.13\portable/logs/application.log, all resources released: true
DEBUG StatusLogger Appender RollingFile stopped with status true
DEBUG StatusLogger Shutting down OutputStreamManager SYSTEM_ERR.false.false
DEBUG StatusLogger Shut down OutputStreamManager SYSTEM_ERR.false.false, all resources released: true
DEBUG StatusLogger Appender Console stopped with status true
TRACE StatusLogger XmlConfiguration stopped 2 remaining Appenders.
TRACE StatusLogger XmlConfiguration cleaning Appenders from 2 LoggerConfigs.
DEBUG StatusLogger Stopped XmlConfiguration[location=jar:file:/E:/Arduino-1.8.13/lib/pde.jar!/log4j2.xml] OK
DEBUG StatusLogger Stopped LoggerContext[name=1e6f5c3, org.apache.logging.log4j.core.LoggerContext@535154] with status true
********************* PROGRAM STARTING ****************
sdl��|�l�|�l�c|����{�c�c��gg�lnn���cp�l{d{dx�n��l�� cn�|�$��c��gg�d��d`�ggd`o{���o bl`s��ocl`�c ��d{�`��'�AppStart
disconnecting Wifi
Connected successfully to: READ-Wlan
192.168.2.23
Trying to read sensor ...
Temperature: 22.9000
Pressure: 940
Humidity: 23
HeatIndex: 0
DewPoint: 0
Temperature: 22.9000
Trying to upload ...
trying to connect to: api.thingspeak.com port: 443 ssl: 1
connected: api.thingspeak.com
 

Attachments

  • WeatherStation_Ver_1_00.zip
    3.6 KB · Views: 60

Mark Read

Well-Known Member
Licensed User
The example works fine, I see everything in the logs.

Try to eliminate different features and see which one causes it.

I don't really have any features I can eliminate!
I only make a Wifi connection, read the sensor and send the data to Thingspeak. I cannot not do one of the three. I have tried pasting the result of

B4X:
Log("https://api.thingspeak.com/update?",postStr)

directly into my chrome browser and the answer is eg 110, which is the number of entries in the channel, so this is okay.

I do not do the environmental calculations or the UDP broadcast at the moment.

The JobDone sub is definately running as the LED is turned off and Wifi is disconnected but also the logs are not printed.
 
Upvote 0

Mark Read

Well-Known Member
Licensed User
I am a little further:

If I comment out the ReadSensor sub and just pass 0 for all values, the logs are correct. Data is uploaded and I see the logs from JobDone sub. If I include the ReadSensor sub again (or add a delay of 5 seconds after reading the sensor), the logs don't work.

The example from the library post works without problems.

????
 
Upvote 0

Laurent95

Active Member
Licensed User
Unfortunately not, no sensor found. I have everything working in the Arduino IDE but wanted to port it to B4R. The Arduino library is https://github.com/finitespace/BME280.

Hi,
I didn't know if you have fixed your issue ?
You can try the example project here : low memory µC stay alive
The library for BME is CactusIO, i use it several time, work fine with BME280. It's included in zip file to add it in additonnal libraries of Arduino.
In the example the using of this library is in Inline C but work fine.
Don't care about all other features about DS3231, OLED and Oregon.
You can see the final result in the video 👍
Note: Generaly most of BME with dual interfaces, I2C and SPI, have 0x77 like I2C address not the 0x76.
With a D1Mini no reason that you will can't adapt this Inline C code.

Another important thing with the BME280 is the mode used. If ever you use the default i believe to remember that Siemens have default mode on SLEEP.
So the program need to give a bit time before getting the values from the sensor, better to use the FORCED mode
Also, as i used many BME since while ago, believe me, the best algorythm i saw for the sealevel pressure is unconditionnally those of Adafruit (it's in the Adafruit library).
Others i saw let a bit incertitude, because of their other algorythm integrated about altitude.
Hope that help.

Have fun,
Laurent
 
Upvote 0
Top