Friday 18 September 2015

New CaptiveIntraweb release V3 - ESP8266 / NodeMCU based captive portal

After a few hours of brushing things up, I released a new version of my CaptiveIntraweb on  my GitHub repo.
Apart from a few bug fixes, an all-new init.lua now does the Wifi Setup, compiles the LUA files and starts the servers. It also features an option to prevent the TCP and UDP servers from starting.

I did most of the development on my new, very user friendly V3 NodeMcu Lua WIFI Development Board I got directly from the PRC from Banggood. That board has 4MByte of flash memory. (Yes. I mean MBytes here, not MBit)

Looks a lot like a ESP-12E module on the board

If you don't know about CaptiveIntraweb, here is the original video from May 2015, although quite a bit of progress has been made since then.

With the new CaptiveIntraweb  loaded, the module startup now looks like this:
 ---------------------  
 Setting up WiFi AP...  
 Done.  
 ---------------------  
 Flash size is 4096 kBytes.  
 File system:  
  Total : 3360 kBytes  
  Used : 124 kBytes  
  Remain: 3236 kBytes  
 ---------------------  
 Compiling LUA files...  
 No need to compile   dns-liar.lua  
 No need to compile   server.lua  
 Compiling done.  
 ---------------------  
 Send some xxxx Keystrokes now to abort startup.  
 Will launch servers in 5 seconds...  
 > ---------------------  
 Starting HTTP Server  
 HTTP Server listening. Free Heap:    13080  
 Starting DNS Server  
 DNS Server listening. Free Heap:    10008  
 ---------------------  

17 comments:

  1. Hello, I am very interested in your project, however I have zero experience for uploading the nodemcu based code to these EPS boards. I have the exact same board you mention in this project page the V3 NodeMcu Lua WIFI Development Board. I have watched you original video, what is the software you are using to upload the code to the board? Any further help you could give a newbie would be oh so appreciated. I have only worked with the esp boards using the Arduino IDE platform.

    ReplyDelete
  2. If you have that board, things are really easy, provided you have the driver for the usb/serial chip installed ( https://paradisetronic.com/de/treiber ).
    To flash the firmware, you need the firmware uploader from here: https://github.com/nodemcu/nodemcu-flasher
    Once the firmware ist running, you can run LUA code on the module. To upload code and interact with the module, I use esplorer ( http://esp8266.ru/esplorer/ )
    Once you start esplorer, you have to chose the right COM-port from the dropdown-list and hit the "Open" button.
    You can now interact with the module.

    ReplyDelete
  3. Hello, I have just started getting into the esp8266 module as well as some arduino projects. I am mainly interested to create fun puzzle geocaches. I am sure if you have ever heard of it but its worth looking up online. My goal was to build a Geocache that someone will find hidden somewhere in my town. Once they find it they will have to connect a battery to power the esp8266 inside. Then using their phone or wifi device they would load the web page and be able to fill in there name to sign a built in log book (write name to text file). I would then like to display the text file of all previous people that filled in there name. I know how to do this via PHP and I have been able to use your code to get my esp8266 running a WiFi AP and play some of the games. Do you have any suggestions on how to file to a text file using only the esp8266 chip?

    ReplyDelete
    Replies
    1. Hi Wayne, great idea. I've actually used the portal in outdoor scouting games. The main problem will be a good power supply. While it runs ok for about two days on a good quality 18650 cell, you'll need a solar panel for a permanent installation. The size of that will make it hard to hide.
      About leaving a message / name:
      If you look at the source code of the server, you can see how the counter variable is written to / read from the file system. So storing data permanently on the portal is not a problem.
      But in its current implementation, the server the server is not too bright. It can send a html form easily like described here: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms/Sending_and_retrieving_form_data
      But when you hit the "send" button, you'll have to parse the get-request and extract the form content from it.
      I know that this guy: http://iotests.blogspot.fr/2015/10/wifi-throwie-improved-version-faster.html did just that. Unfortunately I haven't seen that part of his code.

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Thanks for sharing this project. can you please specify the start address for flashing the firmware in the ESP-01 module?

    ReplyDelete
    Replies
    1. The single .bin file is simply written from 0x00000. Nothing special to to it. Baudrate then in 9k6. Does say it flashes the firmware ok?

      Delete
  6. Thanks for the info, it is working now!

    Would it be possible to provide a version of the firmware with WS2812 support?
    #define LUA_USE_MODULES_WS2812

    I also had to format() the NodeMCU file system before I could write files to it, I got "open a file first" errors on the write commands.

    ReplyDelete
  7. Yes, reformatting is necessary, because the size of the file system depends on the size of the firmware image.
    I'll look into the WS2812 thing. Do you have a specific project in mind? If so I'd like to hear about it.

    ReplyDelete
  8. I would like to use the captive proxy with the dual strip WiFI Lights on my son's rc-car:
    http://dangerousprototypes.com/2015/02/11/wifi-led-light-esp8266-ws2812b-lua/

    Currently I'm trying to install the Dev kit so I will be able to customize the Lua firmware.

    ReplyDelete
    Replies
    1. Sounds interesting. Try that: https://www.dropbox.com/s/zfetsyn5i97jx5e/NodeMCU095-ARe-2812-dns.bin?dl=0

      Delete
  9. Hi Andreas.I have a question. But first, I want to thank you for the excellent video that posted https://www.youtube.com/watch?v=fQM-GHY6VJ8. I have lost a few hours to study the LUA language. But I'm still very raw. I liked using the captiveIntraweb and DHT22 sensor + nodemcu v3. I have done some testing but without success. I can not find anything on the web that talk about it. I would appreciate to give me a hand on this. Thank you very much

    ReplyDelete
    Replies
    1. There is a DHT-library in the newer NodeMCU builds that supports the DHT22. What are you trying to do with it?
      About LUA in general: It is very easy to get started with simple projects, but at some point the "event driven" nature of NodeMCU makes things confusing.
      Depending on your requirements, a native application made with the Arduino IDE for the ESP8266 might be an alternative.

      Delete
    2. Yes. I think that a native application made with the Arduino IDE, It is the easi way for me to start. tks 73´s

      Delete
  10. Can the GPIO's be used with your custom NodeMCU firmware from your release 03?

    ReplyDelete
    Replies
    1. Yes, I am pretty sure I had GPIO enabled in that build.

      Delete
  11. Hello
    I wanna get RSSI from esp8266 (using it as a arduino module)
    Signal goes from a smartphone to esp8266 (connected to a arduino uno)

    How is it possible to make it simple way?

    ReplyDelete