Reset helper for NodeMCU ESP8266 modules

A common scheme for Lua scripted NodeMCU modules with automatically start the script init.lua is to incorporate some logic to test the condition of a GPIO pin to determine whether to boot to the application or drop to the lua prompt for programming etc. In fact the scheme can be elaborated to provide a simple multi level selection based on the time the input condition is applied.

The obvious pin to use is the pin that commonly has a “BOOT” or “FLASH” button on it, GPIO0 or D3. It is used to activate the ESP8266 boot loader if it is low during boot, so it must be left high at boot to allow the lua interpreter to run, but it can be pulled low shortly after boot up and tested from init.lua.

An example init script follows.

print("\n\nHold Pin00 low for 1s t0 stop boot.")
print("\n\nHold Pin00 low for 3s for config mode.")
if == 0 then
  print("Release to stop boot...")
  if == 0 then
    print("Release now (wifi cfg)...")
    print("Starting wifi config mode...")
    print("...boot stopped")
print("Starting app.lua")


Above is a pic of the helper. The DIP switch allows selection of the BOOT pulse in 1s increments. It has four connections, ground, Vdd, BootOut, and Reset (optional). The button near the DIP switch resets the helper which in turn will apply a 10ms reset pulse to the Reset line.

The minimum connection is ground, Vdd (from the target), and BootOut; the device will initiate when the power is applied and this is the means to reset targets that do not have a usable reset line.

Above is the underside of the helper.

The helper uses a PIC12F510, C source code follows:

The device emits a 20ms low reset pulse on GP4 on power up, and about 700ms after power up emits a timed low ‘Boot' pulse on GP5 for interaction with the init.lua script …  The DIP switches set the duration of the Boot pulse in seconds.

The capture above shows the power trace, the tx line from the ESP8266 showing its activity, the ResetOut line and the BootOut line. The traffic on the early part of the BootOut line is from the ESP8266.

If you choose to connect the ResetOut line to the target, resets on that line will also recycle the helper.

The helper has turned out to work very well with the modified relay board, and with ESPlorer, it makes development and testing nearly as convenient as the NodeMCU dev board.