Project owner: lichnak, PeterBay
License: Attribution-ShareAlike 4.0 International; CC BY-SA

NodeMCU HTTP Server

PeterBay hero

Deploy httpd to ESP8266

  • Download httpd.c here.
  • Copy file httpd.c to folder app/modules/
  cp httpd.c ~/nodemcu-firmware/nodemcu-firmware-2.0.0-master_20170202/app/modules/
  • Edit file app/include/user_modules.h and add one line to user modules.
mcedit ~/nodemcu-firmware/nodemcu-firmware-2.0.0-master_20170202/app/include/user_modules.h

  • Compile firmware as was descibed here or download compiled bootloader here and firmware here
  • Connect nodeMCU to USB

  • Upload bootloader bin/0x00000.bin and firmware bin/0x10000.bin to ESP8266 as was descibed for Windows 10 here and for Ubuntu here

  • Open ESPlorer and connect to nodeMCU
Formatting file system. Please wait...
Waiting answer from ESP - Timeout reached. Command aborted.
Formatting file system. Please wait...

NodeMCU 2.0.0 build unspecified powered by Lua 5.1.4 on SDK 2.0.0(656edbf)
lua: cannot open init.lua
  • Upload httpd files from here to ESP8266
> Uploading to ESP file about.tmpl...Success
> Uploading to ESP file api.tmpl...Success
> Uploading to ESP file assemble.lua...Success
> Uploading to ESP file console.tmpl...Success
> Uploading to ESP file edit.tmpl...Success
> Uploading to ESP file ext_httpd.lua...Success
> Uploading to ESP file ext_wifi.lua...Success
> Uploading to ESP file ext_wifi_settings.lua...Success
> Uploading to ESP file favicon.ico...Success
> Uploading to ESP file gpio.tmpl...Success
> Uploading to ESP file gpio_set.tmpl...Success
> Uploading to ESP file httpd.lua...Success
> Uploading to ESP file index.tmpl...Success
> Uploading to ESP file init.lua...Success
> Uploading to ESP file page.tmpl...Success
> Uploading to ESP file static__console.js...Success
> Uploading to ESP file static__favicon.ico...Success
> Uploading to ESP file static__node.css...Success
> Uploading to ESP file static__node.js...Success
> Uploading to ESP file static__svg.js...Success
> Uploading to ESP file wifi.tmpl...Success
  • Configure script ext_wifi_settings.lua for WiFi connection strings
> w = file.writeline
> w([==[wifiSSID="YOUR_WIFI_SSID"]==]);
> w([==[wifiPassword="YOUR_WIFI_PASSPHRASE"]==]);
> file.close();
  • On ESP8266 execute script assemble.lua
> dofile("assemble.lua")
remove: static/console.js
rename: static__console.js -> static/console.js
remove: static/node.css
rename: static__node.css -> static/node.css
remove: static/node.js
rename: static__node.js -> static/node.js
remove: static/svg.js
rename: static__svg.js -> static/svg.js
remove: static/favicon.ico
rename: static__favicon.ico -> static/favicon.ico
load content file: index.tmpl
build: static/index.htm
load content file: api.tmpl
build: static/api.htm
load content file: gpio.tmpl
build: static/gpio.htm
load content file: wifi.tmpl
build: static/wifi.htm
load content file: console.tmpl
build: static/console.htm 
load content file: edit.tmpl
build: static/edit.htm
  • Restart nodeMCU with RST button
  • Wait for nodeMCU start up
NodeMCU 2.0.0 build unspecified powered by Lua 5.1.4 on SDK 2.0.0(656edbf)

WIFI initialization - mode(STATION)

WIFI - Connecting to SSID (YOUR_WIFI_SSID)...
Starting Web Server - port: 	80
> IP Info: 
  • Open YOUR-NODEMCU-IP-ADDRESS in Web browser

  • project/nodemcu_httpd/en.txt
  • Last modified: 2017/03/25 10:44
  • by licho