Skip to main content

Configure MicroPython WLAN/AP/WebRepl startup with your own code

Project description


Configure automatic startup of MicroPython WLAN / AP / WebRepl / NTP time during boot

General information

Use this together with mpycntrl for automation of the setup/deployment and configuration of MicroPython base interfaces. see also mpycntrl on github


The information given in the files wlan.cfg, softap.cfg and are used for configuration.

wlan.cfg and softap.cfg are text files containing ESSID and password in 2 lines is a python file containing a single line like

PASS = '123456'

During wlan start the time from NTP is fetched by default.

Best practice

  • send cntrl+c
  • upload the module file along with the configuration files directly (the config files are wlan.cfg, softap.cfg and
  • send reset

Sample Code (in

from mpyconfigbase import *
    configbase = MPyConfigBase()
except Exception as ex:
    print( "error:", ex )

print("set ntp time", configbase.ntp )

import time
while True:
    print( "->", time.localtime( time.time() ) )

Installation during deployment

The python class code can be retrieved by calling:

fnam, src = MPyConfigBase.get_class_source() # get the module code
cfgbootcode = MPyConfigBase.get_boot_install_code() # get the minimal autconfig code

Sample Code (deployment)

Some sample code for automatic deployment and configuration. In case of timeouts (error message: could not enter raw-repl) consider to use with mpyc.timeout(1) as tout: code block.

The code is also available here on github

Reset the board during the deployment is required since MicroPython needs to bring in the new code before the configuration can take place. If you follow the best practice given above this dont needs to be done.


on esp8266 the combined startup with start will probably fail.

on esp32 it will work :-)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mpyconfigbase-0.0.4.tar.gz (5.1 kB view hashes)

Uploaded source

Built Distribution

mpyconfigbase-0.0.4-py3-none-any.whl (7.0 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page