-
1Get the required hardware.
Check the component list
-
3Using the PyMark console, connect the WeMos to the Internet.Install the captive-portal dependencies (picoweb, micropython-logging, utemplate, micropython-pkg_resources, micropython-btreedb). I included the file `setup_sta_upip.py`. You need to change the `your_ssid`, and the `wpa2_password` to the corresponding of your network and execute the file on the PyMark console (click on the run button).
-
4Check the configuration variables in `config.py` and modified them if you want to.The configuration variables are located in this file. The logged data will be save on a file on the WeMos. To do that, you can choose between 3 possibilities (btree, filedb or sqlite). I tested only btree ;). This can be selected using the variable `DB_BACKEND`. The variable `DB_PASSWORD` is the admin password. I included an admin section to read the database. The user is admin, the password is defined using `DB_PASSWORD`. The DNS service only responds to the requests that contain at least of the words from the array `DNS_ANSWERS`. This reduces the CPU workload. The words listed per default are the required in order to get the "connect to a network" message (you should not remove any of them). You can add others to this array. The problems with sockets that I described in the Wemos-Alexa blog article has also consequences here. The number of opened sockets is limited. You can expect some fatal error from the picoweb service.
-
5Modify the captive portal webpage included in the `template` folder.The `homepage.html` is the web page that the users see after clicking on the "connect to a network" message. You can include some JavaScript files, images and CSS style files in the static folder too. The WiFi speed is slow. The portal should be not to big (I included one sample portal, but it should be a lighter one - optimization is required here!). If you are an advanced user, you can also modified the `admin.html` and `login.html` pages. These two files are only for you to see the logged data (administrator section).
-
6Load the captive_portal folder using the FTP server included (`ftp.py`), or using the `ampy`.
Check the tutorial here: https://lemariva.com/blog/2017/10/micropython-getting-started
-
7Configure the name of the access point in the file `boot.py` and load this file to the root folder.
-
8Reset the Wemos.
-
9Connect to the access point network and wait for the "connect to a network" message. Click on it and wait for the portal.
-
10Go to `http://<ip wemos>/admin.html` enter the `admin` as user and the password from `config.py` and you will see the logged data.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.