How to Wake ES8266 from deep sleep on Dev board without connecting GPIO 16?

Basically, my project uses a force-sensing resistor to detect occupancy on the chair. The ESP8266 WiFi would wake from the sleep mode and send an update to the server. If there is no occupancy, the ESP8266 goes back to sleep. My project uses Wiolink, a dev board that uses a ESP8266 WiFi chip. Hence, it is quite impossible to connect GPIO 16 to RST to wake up ( or reset ) the device. Deep sleep is predefined at a set amount of time using this function ESP.deepsleep(). Is it possible to wake up with an external interrupt such as the force sensing resistor?

1 Like

A quick look at the schematic for the Wiolink (linked from here) shows gpio16 is connected to reset through R3. Do you have the same board and have you tried a deep sleep example to confirm the board does not wake from deep sleep?

Yes I am using the same board but I’ve not tried a deep sleep example. How do I implement the deep sleep code through R3?

Below is my code logic, please take a look. Thank you!

if(sensorReading >= 150) // Condition when someone is sitting
//Wakes up
//Performs measurement
if(sensorReading <=149) // Condition for no one sitting;
Serial.println(“Going into deep sleep”);
ESP.deepSleep(); //

Google "esp8266 deep sleep arduino example" to find example code for testing an esp8266 deep sleep and then run it on your board to confirm if the board does do deep sleep already.

Your example from above (ESP.deepSleep():wink: will put the ESP to sleep until an external event wakes it. you could either make the ESP8266 wake every x seconds to read the resistor detector and then perform some action if the chair is occupied else go back to sleep or use external circuitry to trigger the ESP to wake when the resistance reaches a threshold.

Would the external interrupt fail to trigger a reset on the ESP (Wake)? The only way to wake ESP8266 from deep sleep is to connect GPIO16 to the RST pin. This seems virtually impossible with the Wiolink development board.

Could you expound on R3 which you have mentioned on 16 Jan? Is R3 connected to any of the groove connectors that you have sent on the link?

Much Appreciated

When the ESP8266 is in deep sleep the only way I know of waking it is to pulse reset that reboots the ESP.
If you connect GPIO16 to the reset pin then the ESP can wake/reboot itself after a programmable amount of time.
The Wiolink schematic shows that GPIO16 is connected to RST (blue boxes in image) through resistor R3 (Red box in image) so should be capable of waking itself from deep sleep.
The reset signal does not appear to be broken out on the Wiolink connectors so probably the only way to trigger an external reset is to solder a wire to the reset button on the Wiolink board.


If that is the case, I will implement deep sleep at night. Would "System Clock" be able to tell real time? Or must the Wiolink board be sync with a server to know what time it is?

I am looking into implementing Modem or light sleep mode in the day. Just wondering if the ESP8266 wake itself using a pulse reset for Modem or light sleep mode too?

It seems that the CPU is "PENDING (On/Off)" for light sleep and "ON" for Modem Sleep. May I ask what difference does it make?

While using Modem or Light light sleep throughout the day. Which would be a better sleep mode to trigger an external reset? (Without soldering a wire on the board would be preferred)

Thank you once again!

You would need to set the time from NTP as the RTC is just a counter, and memory that survives reset.

Most of your questions can be answered by looking at the document here.
I think the ESP can wake from sleep using a GPIO pin when in light sleep.

Why the need for sleep mode? Are you running from battery and need them to last as long as possible or some other reason. Not knowing your setup, if it's battery power then maybe a different system/MCU would be better suited.

Yup, I'm running on a battery and I need it to last for a month for monthly replacement.

I've gotten deep sleep mode to work with a self-wake using this code
ESP.deepSleep(10000000, WAKE_RF_DEFAULT);

As usual, I can't wake using the Force sensing resistor.

The doc you sent showed this code for external wake-up
void gpio_pin_wakeup_enable(uint32 i, GPIO_INT_TYPE intr_state);
may I ask what variable is there to change? eg, pin
and is there additional code needed?

Thanks once again!

I wonder if the ESP8266 will last a month using light sleep. Depends on battery size and other components on the board.

From the expressive document for light sleep, i is the GPIO pin number and GPIO_INT_TYPE is either GPIO_PIN_INTR_LOLEVEL or GPIO_PIN_INTR_HILEVEL depending on what type of signal (high/low) will trigger the interrupt.
You do appear to need extra code to work this (I have never used light sleep) and the potential best example I could find with Google is here. The ask refers to using multiple IO pins but the example code is just for one (AFAIK you need extra hardware to use multiple IO’s)