Package: micropython-esp-wifi-manager
ESP WiFi ManagerMicroPython WiFi Manager to configure and connect to networksInstallationInstall required toolsFlash firmwareUpload files to boardInstall packageGeneralHook the WiFi Manager boot logicSpecific versionTest versionManuallyUpload files to boardInstall additional MicroPython packagesUsageInstallationInstall required toolsPython3 must be installed on your system. Check the current Python version
with the following commandpython--version
python3--versionDepending on which commandPython 3.x.y(with x.y as some numbers) is
returned, use that command to proceed.python3-mvenv.venvsource.venv/bin/activate

pipinstall-rrequirements.txtTest both tools by showing their man/help info description.esptool.py--help
rshell--helpFlash firmwareTo flash themicropython firmwareas described on
the micropython firmware download page, use theesptool.pyto erase the
flash before flashing the firmware.esptool.py--chipesp32--port/dev/tty.SLAB_USBtoUARTerase_flash
esptool.py--chipesp32--port/dev/tty.SLAB_USBtoUART--baud460800write_flash-z0x1000esp32-20210623-v1.16.binIf the Micropython board is equipped with an external PSRAM chip, theesp32spiram-20210623-v1.16.bincan also be used for ESP32 devices. If there
is no external PRSAM only the non SPIRAM version is working.Upload files to boardInstall packageConnect your MicroPython board to a networkimportnetworkstation=network.WLAN(network.STA_IF)station.active(True)station.connect('SSID','PASSWORD')station.isconnected()GeneralInstall the latest package version of this lib on the MicroPython deviceimportmipmip.install("github:brainelectronics/micropython-esp-wifi-manager")# maybe install the dependencies manually afterwards# mip.install("github:brainelectronics/micropython-modules")For MicroPython versions below 1.19.1 use theupippackage instead ofmipimportupipupip.install('micropython-esp-wifi-manager')# dependencies will be installed automaticallyHook the WiFi Manager boot logicTheboot.pyandmain.pyfiles of this package are installed into/libof
the MicroPython device bymip. They are fully functional and without any
other dependencies or MicroPython port specific commands. Simply add the
following line to theboot.pyfile of your device.The following commands
are not working if this package got installed byupipimportwifi_manager.bootAnd also add this line to yourmain.py, before your application codeimportwifi_manager.mainSpecific versionInstall a specific, fixed package version of this lib on the MicroPython deviceimportmip# install a verions of a specific branchmip.install("github:brainelectronics/micropython-esp-wifi-manager",version="feature/support-mip")# install a tag versionmip.install("github:brainelectronics/micropython-esp-wifi-manager",version="1.7.0")Test versionInstall a specific release candidate version uploaded toTest Python Package Indexon every PR on the
MicroPython device. If no specific version is set, the latest stable version
will be used.importmipmip.install("github:brainelectronics/micropython-esp-wifi-manager",version="1.7.0-rc5.dev22")For MicroPython versions below 1.19.1 use theupippackage instead ofmipimportupip# overwrite index_urls to only take artifacts from test.pypi.orgupip.index_urls=['https://test.pypi.org/pypi']upip.install('micropython-esp-wifi-manager')See alsobrainelectronics Test PyPi Server in Dockerfor a test PyPi server running on Docker.ManuallyUpload files to boardCopy the module(s) to the MicroPython board and import them as shown below
usingRemote MicroPython shellOpen the remote shell with the following command. Additionally use-b 115200in case no CP210x is used but a CH34x.rshell-p/dev/tty.SLAB_USBtoUART--editornanoCreate compressed CSS and JS files as described in thesimulation static files READMEto save disk space on the
device and increase the performance (webpages are loading faster)mkdir/pyboard/lib/
mkdir/pyboard/lib/microdot/
mkdir/pyboard/lib/utemplate/
mkdir/pyboard/lib/wifi_manager/
mkdir/pyboard/lib/static/
mkdir/pyboard/lib/static/css
mkdir/pyboard/lib/static/js

cpstatic/css/*.gz/pyboard/lib/static/css
cpstatic/js/*.gz/pyboard/lib/static/js# around 24kB compared to uncompressed 120kB# optional, not used so far# mkdir /pyboard/lib/static/js# cp static/js/*.gz /pyboard/lib/static/js# around 12kB compared to uncompressed 40kBmkdir/pyboard/lib/templates/
cptemplates/*/pyboard/lib/templates/# around 20kBcpwifi_manager/*/pyboard/lib/wifi_manager/
cpmicrodot/*/pyboard/lib/microdot/
cputemplate/*/pyboard/lib/utemplate/
cpmain.py/pyboard
cpboot.py/pyboard# around 40kBInstall additional MicroPython packagesAs this package has not been installed withupipadditional modules are
required, which are not part of this repo.Connect the board to a network and install the package like this for
MicroPython 1.20.0 or neverimportmipmip.install("github:brainelectronics/micropython-modules")For MicroPython versions below 1.19.1 use theupippackage instead ofmipimportupipupip.install('micropython-brainelectronics-helper')UsageAfter all files have been transfered or installed open a REPL to the device.The device will try to load and connect to the configured networks based on an
encrypted JSON file.In case no network has been configured or no connection could be established
to any of the configured networks within the timeout of each 5 seconds an
AccessPoint at192.168.4.1is created.A simple Picoweb webserver is hosting the webpages to connect to new networks,
to remove already configured networks from the list of connections to
establish and to get the latest available networks as JSON.This is a list of available webpagesURLDescription/Root index page, to choose from the available pages/selectSelect and configure a network/configureManage already configured networks/scan_resultJSON of available networks/shutdownShutdown webserver and return fromrunfunctionTo leave from the Webinterface, just press CTRL+C and wait until all threads
finish running. This takes around 1 second. The device will return to its REPL