Skip to content
Rewrite of popstas/nodemcu-httpserver-ws2812 with MQTT, OTA updates and lighter httpserver
Lua C++ Shell Makefile
Branch: master
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
Makefile
README.md
test-mqtt.sh
user_modules.h

README.md

MQTT LED Strip, see last video here - https://photos.app.goo.gl/HRHqkKH5LeZuXorPA

Features

  • Control ws2812 led strip over MQTT
  • Control by defined segment
  • New year mode

Wiring

Connect LED strip to D4.

Setup NodeMCU

  1. Flash firmware (see user_modules.h for nodemcu-firmware), use nodemcu-firmware v3.1+ for avoid memory leaks.
  2. Rename config_secrets.default.lua to config_secrets.lua
  3. Upload files:
make upload_all

OTA update (v1)

You can send POST request to /ota with filename and content data. HTTP request processed with http-request.lua from marcoskirsch/nodemcu-httpserver.

OTA client

Setup client with npm install. Or better use nodemcu-ota-uploader.py

Health

You can see basic info on /health

OTA update (v2)

Telnet based OTA server consumes much less RAM:

  • after start: 7K -> 2K
  • during upload: 2K -> ~0
  • after upload leak: 500 bytes -> 50 bytes

Other improvements:

  • upload more faster (about 1 second for file)
  • check file size after upload
  • replace file only after success upload

Upload process:

  1. Receive command, aborting previous command
  2. Receive command arguments
  3. Receive body (file contents)
  4. Finalize: check, replace file

Process protocol:

  • #!cmd:name - start command 'name' execute
  • #!arg:name=value - add argument, after command, before
  • #!body - start body
  • ... - any content, except #!endbody, receive body bytes
  • #!endbody - end of body, finalize

OTA v2 commands:

  • upload - upload file. Arguments: filename, length (file size)

OTA v2 client

Use nodemcu-ota-uploader upload filename.lua

You can’t perform that action at this time.