B4R Question ESP8266: Deep Sleep & Timer

positrom2

Active Member
Licensed User
Longtime User
I am using a timer to read the BMP280 sensor periodically - maybe every hour. Meanwhile nothing is to be done, so the processor might go to Deep Sleep. Should one abandon the timer an just use Deep Sleep?
Or what is the right way to implement Deep Sleep in combination with a Timer?
 
I am not sure about the strategy. Should the DeepSleep run within an endless loop or calling it with the Timer?
I tried with the Timer, but it does not wakeup. The wiring on the Nodemcu 1.0 board already looks right (assuming the resistors have the right values (12k).
NODEMCU_DEVKIT_V1.0.PDF
Code:
tmr.Initialize("tmr_Tick",1000)
tmr.Enabled = True
Private Sub tmr_Tick 
    Log("timer")
    Log(k)
    k=k+1
    If k >= ssd.GFX.Width Then
    k= 0
    End If
   If k = 127 Then
    normalize
    plott
  End If
DeepSleep(100)
End Sub
 
Upvote 0
The log (using the Timer) looks like this (had a little trouble to assemble this since the ESP log is at 74800 Baud whereas the B4R log comes at 115200 Baud).
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v00000000
~ld
AppStart
Successful
timer
0
ets Jan 8 2013,rst cause:5, boot mode:(3,6)
ets_main.c
 
Upvote 0
had a little trouble to assemble this since the ESP log is at 74800 Baud whereas the B4R log comes at 115200 Baud
The baud rate is set when you call Serial1.Initialize.

I don't think that this error is related to the timer. Are you able to call DeepSleep without the program crashing?
 
Upvote 0
I found more information on DeepSleep:
Among others, GPIO16 has to be connected to RST.
When I make that connection, DeepSleep works and the program runs periodically. The drawback is that the wakeup-Reset clears the SRAM.
So data are lost.
So, we have to make use of the EEPROM probably.
Or might there be a different solution?
 
Upvote 0
Back
Top