Flashing NodeMCU on the ESP8266

Background

First, a great overview here: http://jeelabs.org/2010/12/16/voltage-3-3-vs-5/

And a guide on how to flash here: http://blog.quindorian.org/2015/01/esp8266-wifi-led-dimmer-part-3-of-x.html

View from the top, my pins are sticking out the bottom, but orient based on the antenna (swiggly line)

Wire the ESP-01 for normal (boot from flash) mode

ESP-01 VCC - Connect to 3.3v

ESP-01 GND - Connect to Ground

ESP-01 RX - Connect to TX on Serial Adapter

ESP-01 TX - Connect to RX on Serial Adapter

ESP-01 CH_PD - Connect to 3.3v via a 10k pullup resistor

Some other things to try if this isn't working:

Per http://www.esp8266.com/viewtopic.php?f=13&t=1730

For a regular boot both GPIO0 and GPIO2 need to be floating, or pulled up with a resistor to Vcc. If at a regular boot either GPIO0 or GPIO2 is LOW, it will not boot.
I had the same problem and I fixed with a 2,2k pull up resistor (4,7k or higher was not working).
Doing this GPIO2 will be high by default while it resets (1-2 seconds), but you allways can write to low.

Per http://www.sheffieldhardwarehackers.org.uk/wordpress/2015/02/rfid-access-system-using-esp8266-01-part-1/

Pull GPIO0 high via a 10k resistor

Per https://github.com/esp8266/Arduino/issues/95#issuecomment-95935654

Pull up = 10K resistor to Vcc (3v3)
Pull down = 10K resistor to Gnd (0v)

ESP8266-01

Using 10K resistors

Pull up, GPIO0
Pull up, GPIO2
Pull up, Rst (Reset)
Pull up, CH_PD

To program using the esp bootloader (like you are doing with the arduino
IDE)

Short GPIO0 to Gnd for the duration of loading the code.
Momentarily short RST to Gnd to trigger a reset or alternatively
powercycle the board.

This puts the bootloader into listening mode and you can then load your
code onto the board.

When loading is complete

Remove the Gnd short on GPIO0 and do a reset again.

Board comes up and runs your app fine.

This also works fine on other of the variants of the ESP8266 like 03 and
07. except ones with GPIO15, this should be pulled down to gnd via a 10K
resistor.

https://hackaday.io/project/3253-esp8266-native/log/11726-deep-sleep

10K is a weak pull up/down value that will not do the device any harm if
a pin is brought up in a output mode (Spare serial TX for instance). the
current is about .33 mA so tiny. But will ensure that if in an input
mode it has the default level set so it will always be known what state
it is in. The states as noted above work.

To flash, connect GPIO0 to ground.

ESP-01 GPIO0 - Pull low by connecting to ground / minus

Since we need multiple pins taking ground / VCC I ended up using a breadboard and some dupont connectors to get everything wired up

Uploading lua

Use ESPlorer

or luatool

git clone https://github.com/4refr0nt/luatool.git
cd luatool/luatool

If you're using python virtual environments:

mkvirtualenv luatool
pip install pyserial

GPIO

GPIO pin IO index GPIO0 3 GPIO1 10 GPIO2 4 GPIO3 9 GPIO4 2 GPIO5 1 GPIO6 N/A GPIO7 N/A GPIO8 N/A GPIO9 11 GPIO10 12 GPIO11 N/A GPIO12 6 GPIO13 7 GPIO14 5 GPIO15 8 GPIO16 0

e.g.

Set GPIO2 to output mode

gpio.mode(4, gpio.OUTPUT)

Set GPIO0 to interrupt mode:

gpio.mode(3, gpio.INT)

Reading

GPIO http://esp8266.co.uk/tutorials/introduction-to-the-gpio-api/

Flashing http://www.whatimade.today/loading-the-nodemcu-firmware-on-the-esp8266-windows-guide/

Examples https://github.com/dannyvai/esp2866_tools/tree/master/nodemcu/scripts

E.g. Connecting to a WiFi network: https://github.com/dannyvai/esp2866_tools/blob/master/nodemcu/scripts/connect_wifi

A NodeMCU driven water heater http://www.whatimade.today/esp8266-and-the-water-heater/