Sunday, 5 April 2015

Progress on the esp8266 NodeMCU / Lua Captive Portal

I'm making good progress on the ESP8266 based captive portal. - That is: if the name captive portal really fits, as it doesn't lead anywhere but holds the device captive. - So I named it "CaptiveIntraweb".
I've been working on this on-and-off for about two months and once it sort-of worked, I put the code in the dev-tree of the github project. Tonight I made good progress when I had figured out how Apple's IOS devices handled captive portals. Now we can play games on the logon-screen.
Windows mobile devices were less picky and worked weeks ago.

Currently it requires:
  1. an ESP-01 module (others will do as well)
  2. two AA batteries of a 3.7V lithium cell with a 1N diode in series to drop 0.6V
  3. some dupont jumper cables
On the software side:
  1. modified NodeMCU firmware
    I use an older version 20150213 with two modifications:
    Reduced the 4* LUALBUFFERSIZE back to the original value.
    Switched on the DNS-feature of the DHCP server in softAP mode
  2. the .lua and .htm files found in the dev-branch here:
    https://github.com/reischle/CaptiveIntraweb/tree/dev
The firmware apparently contains binary blobs of unclear copyright, so I won't distribute the custom firmware. Building the firmware is well documented. Send a PM if you need help.

One of my friends already figured out where this all is going to lead eventually. So I didn't bother removing the clues from the code and html files.

The files in the dev branch are only partly translated.

8 comments:

  1. Can you please describe how to Switched on the DNS-feature of the DHCP server in softAP mode.
    Where do I have do edit something?

    ReplyDelete
    Replies
    1. I started out with the NodeMCU source dated 20150213 this version had an issue with the LUAL_BUFFERSIZE in app/lua/luaconf.h . I changed that back to “#define LUAL_BUFFERSIZE BUFSIZ”. This might be fixed in newer versions.
      The other thing is that the DNS feature of the DHCP server just needs to be switched on. It is already implemented in the code, just waiting to be used:
      So in: ./app/include/lwip/app/dhcpserver.h (Line 55) simply add a “#define USE_DNS 1″

      Delete
  2. Hi, your article looks very helpful.

    I have a question. I am fine with uploading the lua and html files but what about PNG and MP3 files? I am using Esplorer and couldn't find a way to upload these files.

    ReplyDelete
    Replies
    1. The "Upload..." button in the lower right corner of the left half of the windows lets you upload any file type, including all sorts of binary files.

      Delete
  3. Hi i work also on thos project but i find problems when the function reads a picture. The tim from starting to fish the picture reading is near 10s for 56kb. This is too slow!Any idea?

    ReplyDelete
    Replies
    1. Do you see any concurrent get requests on the serial console when loading the image?

      Delete
  4. Hi, I'm kind of new to ESP8266.

    I can't figure out how can I register ESP8266 on a local DNS?

    Like give it a hostname, reason for that is I could use the name to find my device rather than scanning for IP address.

    Your advice is most appreciated.

    ReplyDelete
    Replies
    1. Yes, see here: https://www.youtube.com/watch?v=uwwsb1LByY8
      And here: http://desperate-programmers.com/2016/01/24/name-resolving-demo-mdns-reponder/

      Delete