A simple captive portal HTTP server for NodeMCU ESP8266 devices running Lua
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENSE
Makefile
README.md
preview.png

README.md

Forked

This is my fork of nodemcu-lua-server. I added the DNS redirection / captive portal via esp8266-captive-portal and modified the send commands to send valid HTTP responses (though I think I could have just used the http module 🤷)

IoT NodeMCU webserver

IoT Webserver for NodeMCU (written in Lua)

Setup

If you don't have any experience with ESP8266 and Lua, please check: IoT Esp8266 Lua Guide

  1. Clone / Download this repository.
  2. Install nodemcu-tool using npm:
npm install nodemcu-tool -g
  1. Optional: You can install lua linter - luacheck:
luarocks install luacheck

Configuration

Before you start you have to update config.lua file and set WiFi credentials:

module.SSID["NAME"] = "PASSWORD"

Connect your NodeMCU to USB port and upload all lua scripts (/dev/cu.wchusbserial1410 - your device name might be different)

$ nodemcu-tool --port /dev/cu.wchusbserial1410 upload src/*.lua

If you're done you can try to connect to your NodeMCU:

$ nodemcu-tool --port /dev/cu.wchusbserial1410 terminal

In order to see NodeMCU / server logs press RESET button on the board - the webserver will restart and try to establish wifi connection again:

Connecting to YOUR_WIFI_NETWORK...
====================================
ESP8266 mode is: 1
MAC address is: 5e:cf:7f:1b:df:19
IP is 192.168.1.100
====================================
Server Started
Open 192.168.1.100 in your browser
====================================

Follow the instruction and open your browser with given IP address:

NodeMCU WebServer Preview

Happy Hacking.

Resources:

License

This project is distributed under the MIT license.