ESP8266 and NodeMCU

First flash the ESP8266 with the Nodemcu firmware using this guide: http://www.whatimade.today/flashing-the-nodemcu-firmware-on-the-esp8266-linux-guide/.
Vcc on the Esp is powered by an LM1117 as in xxx. Gnd to gnd, rx to tx and tx to rx on the serial adapter. CH_PD to Vcc, Gpio0 to Vcc via a resistor (1k) and to ground via a push button. Push the button, toggle Vcc to the Esp, release button, run the command to flash the firmware.

Then install Esplorer, a Java tool to work with the Esp:
http://esp8266.ru/esplorer/.
To run the tool in Linux:

sudo java -jar ESPlorer.jar

In Esplorer, select the correct serial port (as given by dmesg) and click Open. You can then try the button Chip Info and Chip Id, if all is good you'll get an answer.

Next we save to code from https://github.com/dannyvai/esp2866_tools/blob/master/nodemcu/scripts/server_hotspot_untill_connect_lua to a file. Then this file is opened in Esplorer and uploaded to the Esp by clicking "Send to esp". The Esp now runs a Hotspot to which we can connect with a Smartphone or other wireless device. The server shows it's IP-address in Esplorer, we now use this address in the Smartphone's browser. This gives a simple page with two textboxes. Here we fill in the network that the Esp shall connect to in the future and also the password for this network. Click config and the Esp will reset and connect to the selected network.
Now we use the Fing app on the Smartphone to find the device again. In this example the Esp (named "Espressif") got the IP 192.168.1.131. This address is now used in a browser on the computer, and if all works the ESP/server will print "Connected" the browser window.

Next test is to upload the code from https://github.com/dannyvai/esp2866_tools/blob/master/nodemcu/scripts/relay_server_lua_commands_buttons. The webpage is reloaded, and the Esp shows a textbox and two buttons.
We also connect a resistor and a led between Gpio0 and ground on the Esp. Now we enter the secret (found in the code) in the textbox and clicks the buttons. If all works the led will toggle on and off.