I want to do some battery powered sensing with an esp8266 - and to get a good battery life, I need to use the 'deep sleep' mode. Deep sleep requires a reset (including a bootloader and some radio calibration) to wake from. I decided to test how different pins behave when in deep sleep or undergoing a reset.
By switching the Arduino Uno outputs between high, low and high impedance, we can test a variety of pull up and pull down values applied to the pins of the module.
- These tests were performed on a 'WeMos D1 Mini V2' module carrying an 'ESP-12F' module carrying the esp8266. The modules include some pull and and down components. I've tried to note these below.
- As the picoscope has a 1 MΩ input impedance, a 100 kΩ pull up to 3.3v with no other load makes a resistor divider with a 3v output voltage.
- The timebase for the charts below is 100 milliseconds per division, and the vertical scale is in volts. The blue line is the reset signal and the red line is the pin being tested.
- The gap between 'Reset pulled low' and 'Chip restarting' is intentional, I put it in because of the GPIO0/GPIO2 bootloader behaviour (you'll see it when you scroll down).
- The two test programs are at the end of this post. I programmed the esp8266 using Arduino board support package 2.3.0 - as some of the behaviour is probably bootloader/SDK dependent, YMMV.
Stimulus circuit output without ESP8266
WeMos mini pin D0 / GPIO16
Special function - timer reset when in deep sleep
WeMos mini pin D1 / GPIO5
WeMos mini pin D2 / GPIO4
WeMos mini pin D3 / GPIO0
10k pullup on D1 mini schematic, and reset circuit connection to DTR/RTS/RST
WeMos mini pin D4 / GPIO2
10k pullup on D1 mini schematic, blue LED & 470 ohm resistor on ESP-12F
WeMos mini pin D5 / GPIO14
WeMos mini pin D6 / GPIO12
WeMos mini pin D7 / GPIO13
WeMos mini pin D8 / GPIO15
10k pulldown on D1 mini schematic
It takes 300ms from the reset pin rising edge for the user's program to start running (at least when deep sleep mode WAKERFDEFAULT is used)
Pins' values while in deep sleep, reset, and during restart are unaffected by the value the pin was set to before deep sleep.
Individual pins behave differently, and their behaviours are as follows:
|D1 mini pin||GPIO||Deep sleep||Reset held low||During restart||Note|
|D0||16||strong high||strong high||strong high||special role - wake from deep sleep|
|D1||5||high impedance||high impedance||high impedance|
|D2||4||high impedance||high impedance||high impedance|
|D3||0||~500 ohm high?||~875 ohm high?||~500 ohm high?||Pull up resistor & controls boot behaviour|
|D4||2||~5k pull up||~5k pull up||~5k pull up||Pull up resistor & blue LED|
|D5||14||high impedance||weak high||weak high|
|D6||12||high impedance||weak high||weak high|
|D7||13||high impedance||weak high||weak high|
|D8||15||high imp & 10k pull down||weak high & 10k pull down||strong low||Pull down resistor|