Replies: 1 comment 1 reply
-
Try:
import time
import machine
# during development
if machine.reset_cause() == machine.SOFT_RESET:
print('you got a SOFT_RESET, so do a machine.reset()')
time.sleep(1)
machine.reset()
print('wait 2 seconds for a CTRL-C')
time.sleep(2)
import my_program
BTW, the sleep(1) after calling deepsleep() is never run. Remove the 2 second delay after getting things to run properly, if it is not wanted. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am a first time user of esp8266, I have been testing it in preparation to use it in connection with a soil moisture at home.
The board seems to work fine. REPL works fine when connected to serial (using picocom) webREPL also works. Several other modules work as expected (e.g. using sockets to write to local server, blinking LEDs, reading digital sensor, etc).
However, I am at a loss as to how to get it to wake up properly after a deep sleep. In a nutshell, I'm following the documentation here, However, when the defined sleep period elapses, the board flashes the small LED that is on the ESP8266 itself (not the kit) but does not continue with the boot process, i.e. I don't see the test LED going ON and OFF.
It only restarts after connecting the RST pin to any GND pin and then disconnecting it. In this case it boots up and runs the boot.py scrip indicated by the LED flashing and when connected to serial it prints 5 when
machine.reset_cause()
and returns True forif machine.reset_cause() == machine.DEEPSLEEP_RESET:
Any help is appreciated.
My set up
Below are more detailed description of the set up I have, the behaviour that I am observing and the online resources that I have checked.
1- The board: AZ-Delivery NodeMCU LUA Amica V2 (pinout diagram)
2- Firmware: micropython ESP8266 Port, latest release v1.22.2 (2024-02-22) .bin
Flashed using esptool and I am using ampy to upload python scripts while the board is connected to USB port (/dev/ttyUSB0)
3- The circuit I have to test the deepsleep code is simple, connecting D0 to RST and wiring up an LED and a resistor for visual aid to check if board is rebooting properly when it is not connected to a serial port. The image at the bottom shows this circuit.
4- My custom script to go into deepsleep and wake up using RTC was added to boot.py, added below. In the beginning I had it as a separate main.py and the board behaved the same way, I added my scrip to boot.py as a precaution in case there is an issue in filesystem.
5- Not sure if relevant, but I'm using Debian Bookworm
Resources that I checked and tutorials that I tried:
I tried adding a resistor (10k ohm) between D0 and RST but that does not make the board wake up properly. However, it changes the behaviour so that a small LED on the board, close from the RST pin turns ON constantly. It also stays ON after disconnecting the RST pin from the 10k resistor. Rebooting the board in this case, requires the RST pin to be connected and disconnected twice to a GND pin.
I'm also starting to suspect that this esp8266 kit does not have the capability to wake up from deep sleep using RTC, because the pinout diagram linked above does not show a "WAKE" tag next to D0, although the schematic (what's the difference?) does show that schematic
I would really appreciate any help to figure this out, it's been 3 days...
boot.py script
Beta Was this translation helpful? Give feedback.
All reactions