Home

Awesome

LOGO micrOS

"Simple, yet increadbly useful."

telnet esp32S2 tinypico esp32S3 esp32S3 PYQT raspberry-pico-w espCAM-esp-s esp32-c3 OTA GPIO clock async irq socket cron stable stable<br/>

Thanks for GitHub stars, follow us on:

Instagram YouTube Facebook Thingiverse DockerHub<br/>

PyPI Version

micrOS is a micropython based mini application execution platform with ShellCli (socket) and WebCli (http) servers and several other embedded features.

It uses direct wifi connection to access the exposed functionalities.<br/>

In case of any technical comments or requests, please use GitHub Discussions.

MICROSVISUALIZATION SHORTCUTS<br/> Example shortcut (usage of the API): link<br/> Access rest api over browser: http://<nodename>.local



๐Ÿ“ฒ ๐Ÿ’ป ShellCli: Generic session-based communication API <br/> ๐Ÿ“ฒ WebCli: Apple shortcuts compatible REST API and http homepage <br/> ย ย  โœ‰๏ธ Expose upython module functions - telnet TCP/IP and REST API <br/> โš™๏ธ ๐Ÿ“ Device initialization from user config <br/> ๐Ÿงฉ Codeless end user experience via phone client <br/> โš ๏ธ No external server or service required for client-device communication <br/> ย ย  โš ๏ธ ๐Ÿ›ก Works on Local Network (WiFi-WLAN) <br/> ๐Ÿ›  Easy to create custom application(s) aka create your own Load Modules: <br/> ๐Ÿฆพ Built-in scheduling (IRQs):<br/> ย ย  - Time stamp based <br/> ย ย  - Geolocation based clock setup + time tags: sunset, sunrise <br/> ย ย  - Simple periodic <br/> ๐Ÿ”„ Async task manager - start (&/&&) / list / kill / show <br/>

๐Ÿš€๐ŸŽˆLightweight and high performance core system that leaves you space ๐Ÿ˜Ž

โ—‰ Shortcuts:

  1. micrOS Client Application link
  2. micrOS Installer link
  3. micrOS Tutorials link
  4. micrOS System and features link
  5. Pin mapping - GPIO link
  6. micrOS Node configuration link
  7. micrOS create custom Load Modules: link
  8. micrOS Gateway server with Prometheus&Grafana: link
  9. Release notes: link


micrOS Client Application

AppStore ย ย ย ย ย ย ย  AppStore



Installing micrOS with DevToolKit #ESP32 and more

macOS / Windows / Linux to install any esp32 board

pypi

End-to-End solution for deployment, update, monitor and develop micrOS boards.

I would suggest to use micrOS GUI as a primary interface for micrOS development kit, but you can use cli as well if you prefer.

Note: The main purpose of the USB deployment scripts to install micropython on the board and put all micrOS resources from micrOs/toolkit/workspace/precompiled to the connected board.

<br/>

1. Install python3.9+

Link for python 3.9+ download

Note: Allow extend system path with that python version (installation parameter) </br> On Windows: RUN AS ADMINISTARTOR


2. Install micrOS devToolKit GUI

On macOS/Linux

ย Open command line on mac, press: commnd+space + type: terminal + press: enter

Download and install micrOS devToolKit python package:
pip3 install --upgrade pip; pip3 install micrOSDevToolKit

Later on you can update the package with

pip3 install --upgrade micrOSDevToolKit

<br/>

On Windows:

Download and install micrOS devToolKit python package:

Open Windows PowerShell, press windows+R + type: powershell + press enter

Copy the following lines to the PowerShell and press enter.

python -m pip install --upgrade pip
python -m pip install micrOSDevToolKit

Later on you can update the package with

python -m pip install --upgrade micrOSDevToolKit

<br/>

3. Start micrOS devToolKit GUI

Copy the following command to the command line and press enter to start.

devToolKit.py

It will open a graphical user interface for micrOS device management, like usb deploy, update, OTA operations, test executions, etc...


MICROSVISUALIZATION

1. Select BOARD TYPE
2. Click on [Deploy (USB)] button -> presss YES

It will install your board via USB with default settings. Continue with micrOS Client app...

Note: At the first USB deployment, devToolKit will ask to install SerialUSB driver and it will open the driver installer as well, please follow the steps and install the necessary driver.

โ•”โ•— โ•”โ•—                  โ•”โ•โ•โ•โ•—โ•”โ•— โ•”โ•—โ•”โ•โ•— โ•”โ•—       โ•”โ•โ•โ•โ•—
โ•‘โ•‘ โ•‘โ•‘                  โ•‘โ•”โ•โ•โ•โ•‘โ•‘ โ•‘โ•‘โ•‘โ•‘โ•šโ•—โ•‘โ•‘       โ•šโ•—โ•”โ•—โ•‘
โ•‘โ•šโ•โ•โ•‘โ•”โ•โ•โ•— โ•”โ•—โ•”โ•—โ•”โ•โ•โ•—     โ•‘โ•šโ•โ•โ•—โ•‘โ•‘ โ•‘โ•‘โ•‘โ•”โ•—โ•šโ•โ•‘    โ•”โ•โ•— โ•‘โ•‘โ•‘โ•‘
โ•‘โ•”โ•โ•—โ•‘โ•š โ•—โ•‘ โ•‘โ•šโ•โ•‘โ•‘โ•”โ•—โ•‘     โ•‘โ•”โ•โ•โ•โ•‘โ•‘ โ•‘โ•‘โ•‘โ•‘โ•šโ•—โ•‘โ•‘    โ•šโ•โ• โ•‘โ•‘โ•‘โ•‘
โ•‘โ•‘ โ•‘โ•‘โ•‘โ•šโ•โ•šโ•—โ•šโ•—โ•”โ•โ•‘โ•‘โ•โ•ฃ    โ•”โ•โ•šโ•—  โ•‘โ•šโ•โ•โ•‘โ•‘โ•‘ โ•‘โ•‘โ•‘    โ•”โ•โ•—โ•”โ•โ•šโ•โ•‘
โ•šโ• โ•šโ•โ•šโ•โ•โ•โ• โ•šโ• โ•šโ•โ•โ•    โ•šโ•โ•โ•  โ•šโ•โ•โ•โ•โ•šโ• โ•šโ•โ•    โ•šโ•โ•โ•šโ•โ•โ•โ•

micrOS Projects

RingLamp

RoboArm

RGB_CCT



micrOS Video Tutorials

YoutubeChannel


<br/>

micrOS System, message-function visualization

MICROSVISUALIZATION

Note: micrOS development kit contains command line interface for socket communication. Example: devToolKit.py --connect


micrOS Framework Features๐Ÿ’ก

MICROSARCHITECTURE

โŒ˜ DevToolKit CLI feature:


Boards and suggestions

There are multiple types of MCU-s (esp32, esp32s3, etc.) available to order, BUT to be able to enable more features (~2 Load Modules) and full capable WebUI interface you need to have more then 190-210kb of ram (basic boards)(โ„น๏ธ).

There is a solution โœ…, additinal psram: ~2-4-8Mb boards are available. It used to name as psram or spiram, even there is a type octo-psram, so check it before buy!!! Psram needs to be supported on micropython side as well !!!

Suggestions - ๐Ÿ”ฎfutureproof hardware:

esp32s3: Very fast new espressif module that supports psram detection, so you can freely select any module with this MCU with additinal ram, and micros will work with the best performance, typical ram sizes: 2Mb (more then enough for everage usage), 4-8Mb (capacble of image and sound processing tasks and load all GPIO-s ๐Ÿš€)

esp32s3-octo Same sa normal psram, just uses 8 pins to connect to the MCU, basically faster...

tinypico excellet hardware, bit pricy, with 4Mb of ram.

esp32cam it has a custom image and attached 8Mb of ram.

So prefer boards with more psram 2Mb-8Mb, minumum requirement for the full flatched setup ~400kb but smallest psram is 2Mb, in practive:

โ„น๏ธ With basic 190-210kb of ram you can use the system with ShellCli with no issue, just webUI dashboard cannot be load due to memory limitations..., under 140kb of system ram the system not reliable, so these boards are not supported.

Note:

esp32 also can be totally fine with ShellCli, WebCli and 1 load module or multiple modules based on module size... just can be limited by the available memory soonor the later ... (WebCli javascript, htmls are quite small but can be few tens of kilobytes, also multiple async tasks in the background can take same, and roughly around 80% of memory usage system can be instable and restarts.) So if you have a spare one try out micrOS with a range of features :)


Built in periphery support

#Sensors / inputes #Actuators / outputs

pheriphery-io-preview

[CLICK] Show micrOS Load Module functions</br>


Device Pinouts for wiring

Logical pin association handling

micrOS/source/microIO.py

LogicalPin lookup tables:

Note: Good idea to use costant variable for pin map declaration, check the files for more info, These files are also precompiled automatically into byte steams -> .mpy

MicrOStinyPicopinout

GENERAL CONTROLLER CONCEPT: microPLC

MicrOSESP23pinout

MicrOSESP23S2pinout

PYQT_PinOutESP32pinout


micrOS node configuration, parameters with description

These parameters controlls micrOS core functionalities, so you can define an entire system by setting your custom configurations via these values.

Basic parameters:

Config keysDefault value and typeReboot requiredDescription
devfidnode01 <str>YesDevice friendly "unique" ID - (1) defines AccessPoint (AP) network name and (2) in Station (STA) network mode the DHCP device name for IP address resolve also (3) this is the ShellCli prompt.
staessidyour_wifi_name <str>YesWifi router name to connect (for STA default connection mode). You can list multiple wifi names separated with ;
stapwdyour_wifi_passwd <str>YesWifi router password (for STA default connection mode). You can list multiple wifi passwords separated with ; connected in order to staessid wifi names.
appwdADmin123 <str>YesDevice system password.: Used in AP password (access point mode) + webrepl password + micrOS auth
boothookn/a <str>YesAdd Load Module execution(s) to the boot sequence. Separator ;. Examples: rgb load; cct load but you can call any load module function here if you want to run it at boot time.
webuiFalse boolYesLaunch http rest server on port 80 (in parallel with micrOS shell on port 9008 aka socport). It has 2 endpoints: / aka main page (index.html) and /rest aka rest (json) interface for load module execution. Example: <devfid>.local or <devfid>.local/rest + optional parameters: /rgb/toggle. Apple shortcuts compatible
cronFalse <bool>YesEnable timestamp based Load Module execution aka Cron scheduler (linux terminology), Timer(1) hardware interrupt enabler.
crontasksn/a <str>YesCron scheduler input, task format: WD:H:M:S!module function e.g.: 1:8:0:0!system heartbeat, task separator in case of multiple tasks: ;. [WD:0-6, H:0-23, M:0-59, S:0-59] in case of each use: *. Instead WD:H:M:S you can use suntime tags: sunset, sunrise, optional offset: sunset+-<minutes>, sunrise+-<minutes>, example: sunset-30!system heartbeat. Range of days: WD can be conrete day number or range like: 0-2 means Monday to Wednesday.
irq1False <bool>YesExternal event interrupt enabler - Triggers when desired signal state detected - button press happens / motion detection / etc.
irq1_cbfn/a <str>Yesirq1 enabled, calls the given Load Modules, e.x.: module function optional_parameter(s) when external trigger happens.
irq1_trign/a <str>YesSets trigger mode for external irq, signal phase detection, values up (default: n/a) or down or both.
irq2False <bool>YesExternal event interrupt enabler - Triggers when desired signal state detected - button press happens / motion detection / etc.
irq2_cbfn/a <str>Yesirq2 enabled, calls the given Load Modules, e.x.: module function optional_parameter(s) when external trigger happens.
irq2_trign/a <str>YesSets trigger mode for external irq, signal phase detection, values up (default: n/a) or down or both.
irq3False <bool>YesExternal event interrupt enabler - Triggers when desired signal state detected - button press happens / motion detection / etc.
irq3_cbfn/a <str>Yesirq3 enabled, calls the given Load Modules, e.x.: module function optional_parameter(s) when external trigger happens.
irq3_trign/a <str>YesSets trigger mode for external irq, signal phase detection, values up (default: n/a) or down or both.
irq4False <bool>YesExternal event interrupt enabler - Triggers when desired signal state detected - button press happens / motion detection / etc.
irq4_cbfn/a <str>Yesirq4 enabled, calls the given Load Modules, e.x.: module function optional_parameter(s) when external trigger happens.
irq4_trign/a <str>YesSets trigger mode for external irq, signal phase detection, values up (default: n/a) or down or both.
irq_prell_ms300 <int>Yes"Prell": contact recurrence (hw property), for fake event filtering... :D Time window to ignore external IRQ events in ms.
timirqFalse <bool>YesTimer(0) interrupt enabler - background "subprocess" like execution, timer based infinite loop for the LoadModule execution.
timirqcbfn/a <str>Yesif timirq enabled, calls the given Load Module(s), e.x.: module function optional_parameter(s), task separator: ;
timirqseq1000 <int>YesTimer interrupt period in ms, default: 3000 ms (for timirq infinite loop timer value)
telegramn/a strNoTELEGRAM_BOT_TOKEN to enable micrOS Notifications. Hint, to create bot with botfather: click. After enabling this, send /ping to telegram chat for chat ID sync.

Advanced parameter options:

Config keysDefault value and typeReboot requiredDescription
utc60 <int>YesNTP-RTC - timezone setup (UTC in minute) - it is automatically calibrated in STA mode based on geolocation.
cstmpmapn/a <str>YesDefault (n/a), select pinmap automatically based on platform (IO_<platform>). Manual control / customization of application pins, syntax: pin_map_name; pin_name:pin_number; etc. [1][optional] pin_map_name represented as IO_<pin_map_name>.py/.mpy file on device. [2+][optinal] dht:22 overwrite individual existing load module pin(s). Hint: <module> pinmap() to get app pins, example: neopixel pinmap()
boostmdTrue <bool>Yesboost mode - set up cpu frequency low or high 16Mhz-24MHz (depends on the board).
aioqueue3 <int>YesSystem async queue controller (resource limiter).: #1 Set asyc task queue limit (for soft tasks: &). Furthermore #2 Socker server-s (webCli, ShellCli) client number limiter. 3 means: 3 cooperative connection (queue) shared by webCli and shellCli. It can be increased based on available resources.
devipn/a <str>Yes(N/A)Device IP address, (first stored IP in STA mode will be the device static IP on the network), you can set specific static IP address here.
nwmdn/a <str>YesPrefered network mode - AP or STA, default is STA.
soctout30 <int>YesSocket server connection timeout. If user is passive for soctout sec, and new connection incoming, then close passive connection. So it is time limit per connection in the aioqueue.
socport9008 <int>YesSocket server service port (should not be changed due to client and API inconpatibility).
authFalse <bool>YesEnables socket password authentication, password: appwd. Passwordless functions: hello, version, exit. WARNING OTA upade not supported in this mode (yet).
dbgTrue <bool>YesDebug mode - enable micrOS system printout, server info, etc. + progress LED.
hwuidn/a <str>N/AUSED BY SYSTEM (state storage) - hardware address - dev uid
guimetan/a strNoUSED BY micrOS Client (state storage) - stores - offloaded parameter type in config. Clinet widget meta data storage.

Note: Default empty value: n/a in case of string parameter. Note: Cron is only available on devices with Timer(1): esp32



Networking - automatic network modes

MICROSNWMODES

micrOS Gateway in docker

MICROSVISUALIZATION

With prometheus database. Check the micrOS Gateway docker README for details.

Resources:

modify prometheus.yml regarding what sensors on which endpoint do you want to scrapre data from.

cd ./env/docker
docker-compose -p gateway up -d

Official DockerHub

micrOS Customization

app_templates



FUTURE RELEASE PLANS

Version 3.0.0-0

    Core:
    - Async SSL/TLS integration (micropython 1.22+ required)
        - urequest module async redesign for rest clients
            - Notify (telegram) + server (listener - chatbot)
            - Time (ntp location + sunset/sunrise api)

Version 3.1.0-0

    Core:
    - Async socket SSL/TLS integration (with auth.)
        - WebCli (http), ShellCli (terminal) and InterCon
        - Study of ESP-NOW (peer-to-peer communication) integration into InterCon (micropython requirements?)

Version 4.0.0-0

    Core:
    - Network stack redesign
        - Network
            - wifi (defualt, current interfaces)
            - Study of BLE (Shell)
    - Low power mode (with BLE) and soft-sleep / deep-sleep
VERSION (TAG)RELEASE INFOMICROS CORE MEMORY USAGESUPPORTED DEVICE(S)APP PROFILESLoad ModulesNOTE
v0.1.0-0release_Info-0.1.0-078,4% 29 776 byteesp8266App ProfilesLM manualStable Core with applications - first release
v0.4.0-0release_Info-0.4.0-081,0% 30768 byteesp8266App ProfilesLM manualmicrOS multi device support with finalized core and so more. OTA update feature.
v0.4.0-0release_Info-0.4.0-047,1% 52 416 byteesp32App ProfilesLM manualmicrOS multi device support with finalized core and advanced task scheduler based on time, and and so more. OTA update feature.
v1.0.0-0release_Info-1.0.0-047,9% 53 280 byteesp32App ProfilesLM manualRelease of v1 micrOS, timer and event based irqs, cron task scheduling, realtime communication, multiple device support. OTA, etc.
v1.2.2-0release_Info-1.2.2-048,6% 54 032 byteesp32App ProfilesLM manualPublic Release of v1 micrOS, timer and event based irqs, cron task scheduling, realtime communication, multiple device support. OTA update, thread from socket shell (beta) etc.
v light-1.3.0-0--esp8266lightweight branch-remove esp8266 due to memory limitation - BUT still supported with limited functionalities on lightweight branch. Hint: Change branch on github and download zip file, then start micrOSDevToolKit dashboard GUI
v 1.5.0-1release_Info-1.5.0-158,2% 64 704 byteesp32 (tinyPico)App ProfilesLM manualAdvanced Timer IRQ based scheduling (cron & timirq), Geolocation based timing features, External IRQs with 4 channel (event filtering), finalized light controls, Device-Device comminucation support, etc.
v 1.21.0-4release_Info-1.21.0-457.3% 63 728 byteesp32 (tinyPico, esp32s2, esp32s3)App ProfilesLM manualFull async core system with advanced task management and device to device communication, task scheduling and much more ... with more then 30 application/pheriphery support.
v 2.0.0-0release_Info-2.0.0-045.4% 68.7 kbesp32 (tinyPico, esp32s2, esp32s3)App ProfilesLM manualOptimizations, WebCli with web frontends, Camera support. Micropython 1.21 async maxed out :D
v 2.6.0-0release_Info-2.6.0-048.3% 72.6 kbesp32 (tinyPico, esp32s2, esp32s3)App ProfilesLM manualWebCli http server enhancements. New webapps: dashboard. Core system official interface finalization towards Load Modules: Common.py, Types.py (frontend generation), microIO.py (pinout handling).


Developer Quick guide

Note:

Secure Core (OTA static modules) (GUI): boot.py, micrOSloader.mpy, Network.mpy, ConfigHandler.mpy, Debug.mpy

Erase device & Deploy micropython & Install micrOS

Go to micrOS repo, where the devToolKit.py located.

devToolKit.py --make

Note: Follow the steps :)

Search and Connect to the device

devToolKit.py -s -c

User commands

devToolKit.py -h

optional arguments:
  -h, --help            show this help message and exit

Base commands:
  -m, --make            Erase & Deploy & Precompile (micrOS) & Install (micrOS)
  -r, --update          Update/redeploy connected (usb) micrOS. - node config will be restored
  -s, --search_devices  Search devices on connected wifi network.
  -o, --OTA             OTA (OverTheArir update with webrepl)
  -c, --connect         Connect via socketclinet
  -p CONNECT_PARAMETERS, --connect_parameters CONNECT_PARAMETERS
                        Parameters for connection in non-interactivve mode.
  -a APPLICATIONS, --applications APPLICATIONS
                        List/Execute frontend applications. [list]
  -stat, --node_status  Show all available micrOS devices status data.
  -cl, --clean          Clean user connection data: device_conn_cache.json

Search devices

devToolKit.py --search_devices

or

devToolKit.py -s

List discovered devices with status updates

devToolKit.py -stat

or

devToolKit.py --node_status

Output:

       [ UID ]                [ FUID ]		[ IP ]		[ STATUS ]	[ VERSION ]	[COMM SEC]
__localhost__                 __simulator__     127.0.0.1	OFFLINE		<n/a>		n/a
micr<ID>OS            TinyDevBoard      10.0.1.72	ONLINE		1.16.2-2		0.072
micr<ID>OS            LivingKitchen     10.0.1.200	ONLINE		1.16.2-2		0.076
micr<ID>OS            RoboArm           10.0.1.232	ONLINE		1.15.4-0		0.072
micr<ID>S            Cabinet           10.0.1.204	ONLINE		1.16.2-2		0.074
micr<ID>4OS            TestBird          10.0.1.179	ONLINE		1.16.2-1		0.083
micr<ID>OS            RingLamp          10.0.1.75	ONLINE		1.16.2-2		0.099
micr<ID>OS            CatFeeder         10.0.1.111	OFFLINE		<n/a>		n/a
micr<ID>OS            ImpiGamePro       10.0.1.23	OFFLINE		<n/a>		n/a
micr<ID>S            micrOSPublic02    10.0.1.47	ONLINE		1.16.2-2		0.101
micr<ID>cOS            micrOSPublic01    10.0.1.197	ONLINE		1.16.2-2		0.099
micr<ID>cOS            experipurple      10.0.1.94	OFFLINE		<n/a>		n/a

Other Developer commands

Development & Deployment & Connection:
  -f, --force_update    Force mode for -r/--update and -o/--OTA
  -e, --erase           Erase device
  -d, --deploy          Deploy micropython
  -i, --install         Install micrOS on micropython
  -l, --list_devs_n_bins
                        List connected devices & micropython binaries.
  -ls, --node_ls        List micrOS node filesystem content.
  -u, --connect_via_usb
                        Connect via serial port - usb
  -b, --backup_node_config
                        Backup usb connected node config.
  -sim, --simulate      start micrOS on your computer in simulated mode
  -cc, --cross_compile_micros
                        Cross Compile micrOS system [py -> mpy]
  -gw, --gateway        Start micrOS Gateway rest-api server
  -v, --version         Get micrOS version - repo + connected device.

Socket terminal example - non interactive

Identify device

devToolKit.py -c -p '--dev slim01 hello'
Load MicrOS device cache: /Users/bnm/Documents/NodeMcu/MicrOs/tools/device_conn_cache.json
Activate MicrOS device connection address
[i]         FUID        IP               UID
[0] Device: slim01 - 10.0.1.73 - 0x500x20x910x680xc0xf7
Device was found: slim01
hello:slim01:0x500x20x910x680xc0xf7

Get help

devToolKit.py -c -p '--dev BedLamp help'

[MICROS]   - built-in shell commands
   hello   - hello msg - for device identification
   version - returns micrOS version
   exit    - exit from shell socket prompt
   reboot  - system soft reboot (vm), hard reboot (hw): reboot -h
   webrepl - start webrepl, for file transfers use with --update
[CONF] Configure mode - built-in shell commands
  conf       - Enter conf mode
    dump       - Dump all data
    key        - Get value
    key value  - Set value
  noconf     - Exit conf mode
[TASK] postfix: &x - one-time,  &&x - periodic, x: wait ms [x min: 20ms]
  task list         - list tasks with <tag>s
  task kill <tag>   - stop task
  task show <tag>   - show task output
[EXEC] Command mode (LMs):
   help lm  - list ALL LoadModules
   cct
      help
   co2
      help
   dht22
        help
   intercon
           help
   robustness
             help
   system
         help

Embedded config handler

devToolKit.py -c -p '--dev BedLamp conf <a> dump'
  
  staessid  :        <your-wifi-passwd>
  devip     :        10.0.1.204
  version   :        1.11.0-1
  devfid    :        BedLamp
  cron      :        True
  cronseq   :        3000
  soctout   :        10
  irq2_cbf  :        n/a
  stapwd    :        <your-wifi-name>
  dbg       :        False
  irq2      :        False
  irq1      :        False
  irq1_cbf  :        n/a
  appwd     :        ADmin123
  irq2_trig :        n/a
  hwuid     :        micr7c9ebd623ff8OS
  crontasks :        sunset!cct toggle True;*:0:30:0!cct toggle False;*:5:0:0!cct toggle False
  timirq    :        True
  irq3      :        False
  irq3_cbf  :        n/a
  irq4      :        False
  irq4_cbf  :        n/a
  irq4_trig :        n/a
  nwmd      :        STA
  timirqcbf :        system ha_sta
  irq_prell_ms:      300
  boothook  :        cct load
  aioqueue  :        3
  auth      :        False
  timirqseq :        60000
  utc       :        60
  boostmd   :        True
  socport   :        9008
  irq3_trig :        n/a
  irq1_trig :        n/a
  guimeta   :        ...
  cstmpmap  :        n/a

Load Modules - User defined functions

devToolKit.py -c -p '--dev BedLamp system info'

CPU clock: 24 [MHz]
Mem usage: 71.0 %
FS usage: 14.6 %
upython: v1.19.1 on 2022-06-18
board: ESP32 module with ESP32
mac: 7c:9e:bd:62:3f:f8
uptime: 0 1:29:19

SocketClient

Config:

micrOS/toolkit/user_data/device_conn_cache.json

{
    "__devuid__": [
        "192.168.4.1",
        9008,
        "__device_on_AP__"
    ],
    "__localhost__": [
        "127.0.0.1",
        9008,
        "__simulator__"
    ],
    "micr500291863428OS": [
        "10.0.1.72",
        9008,
        "BedLamp"
    ]
}

Interactive mode

devToolKit.py -c 
or
devToolKit.py -connect

[i]         FUID        IP               UID
[0] Device: __device_on_AP__ - 192.168.4.1 - __devuid__
[1] Device: __simulator__ - 127.0.0.1 - __localhost__
[2] Device: BedLamp - 10.0.1.72 - micr500291863428OS

Choose a device index: 5
Device was selected: ['10.0.1.204', 9008, 'Cabinet']
BedLamp $ help
[MICROS]   - built-in shell commands
   hello   - hello msg - for device identification
   version - returns micrOS version
   exit    - exit from shell socket prompt
   reboot  - system soft reboot (vm), hard reboot (hw): reboot -h
   webrepl - start webrepl, for file transfers use with --update
[CONF] Configure mode - built-in shell commands
  conf       - Enter conf mode
    dump       - Dump all data
    key        - Get value
    key value  - Set value
  noconf     - Exit conf mode
[TASK] postfix: &x - one-time,  &&x - periodic, x: wait ms [x min: 20ms]
  task list         - list tasks with <tag>s
  task kill <tag>   - stop task
  task show <tag>   - show task output
[EXEC] Command mode (LMs):
   help lm  - list ALL LoadModules
   cct
      help
   co2
      help
   dht22
        help
   intercon
           help
   robustness
             help
   system
         help
BedLamp $  exit
Bye!

Project structure

micrOS resources library

micrOS Core

Core micrOS resources
1	154	Time.py                  (mlint: True)	(pylint: 9.17)	(ref.: 6)
2	104	micrOSloader.py          (mlint: True)	(pylint: 7.59)	(ref.: 1)
3	50	Hooks.py                 (mlint: True)	(pylint: 9.68)	(ref.: 1)
4	418	Server.py                (mlint: True)	(pylint: 9.29)	(ref.: 4)
5	454	Tasks.py                 (mlint: True)	(pylint: 9.71)	(ref.: 13)
6	185	Config.py                (mlint: True)	(pylint: 9.44)	(ref.: 13)
7	9	reset.py                 (mlint: True)	(pylint: 8.75)	(ref.: 0)
8	225	Shell.py                 (mlint: True)	(pylint: 9.61)	(ref.: 1)
9	179	Notify.py                (mlint: True)	(pylint: 9.55)	(ref.: 2)
10	77	Types.py                 (mlint: True)	(pylint: 9.69)	(ref.: 11)
11	157	Common.py                (mlint: True)	(pylint: 9.1)	(ref.: 24)
12	153	InterConnect.py          (mlint: True)	(pylint: 9.4)	(ref.: 1)
13	177	Debug.py                 (mlint: True)	(pylint: 8.72)	(ref.: 22)
14	164	Network.py               (mlint: True)	(pylint: 9.71)	(ref.: 10)
15	183	Scheduler.py             (mlint: True)	(pylint: 9.61)	(ref.: 1)
16	113	microIO.py               (mlint: True)	(pylint: 9.08)	(ref.: 38)
17	49	micrOS.py                (mlint: True)	(pylint: 9.3)	(ref.: 1)
18	113	Interrupts.py            (mlint: True)	(pylint: 9.05)	(ref.: 2)
19	15	main.py                  (mlint: True)	(pylint: 8.89)	(ref.: 0)
20	117	urequests.py             (mlint: True)	(pylint: 8.9)	(ref.: 4)

SUM CODE LINES (WITH COMMENTS, WITHOUT EMPTY LINES): 3096

micrOS Load Modules

micrOS Load Module resources
1	231	LM_roboarm.py            (mlint: True)	(pylint: 9.11)	(ref.: 0)
2	122	LM_stepper.py            (mlint: True)	(pylint: 8.9)	(ref.: 1)
3	118	LM_genIO.py              (mlint: True)	(pylint: 7.26)	(ref.: 1)
4	498	LM_oled_ui.py            (mlint: False)	(pylint: 8.83)	(ref.: 0)
5	190	LM_system.py             (mlint: True)	(pylint: 7.57)	(ref.: 3)
6	63	LM_robustness.py         (mlint: True)	(pylint: 7.5)	(ref.: 0)
7	115	LM_co2.py                (mlint: True)	(pylint: 8.42)	(ref.: 3)
8	34	LM_rest.py               (mlint: False)	(pylint: 7.0)	(ref.: 0)
9	266	LM_oled.py               (mlint: True)	(pylint: 9.23)	(ref.: 3)
10	72	LM_tinyrgb.py            (mlint: True)	(pylint: 7.95)	(ref.: 0)
11	96	LM_aht10.py              (mlint: True)	(pylint: 8.73)	(ref.: 0)
12	293	LM_bme280.py             (mlint: True)	(pylint: 8.03)	(ref.: 0)
13	37	LM_ph_sensor.py          (mlint: True)	(pylint: 5.79)	(ref.: 0)
14	241	LM_buzzer.py             (mlint: True)	(pylint: 8.83)	(ref.: 0)
15	199	LM_switch.py             (mlint: True)	(pylint: 8.56)	(ref.: 2)
16	113	LM_servo.py              (mlint: True)	(pylint: 7.73)	(ref.: 4)
17	53	LM_rgbcct.py             (mlint: True)	(pylint: 8.62)	(ref.: 0)
18	284	LM_oled_sh1106.py        (mlint: True)	(pylint: 8.79)	(ref.: 1)
19	150	LM_ld2410.py             (mlint: True)	(pylint: 9.07)	(ref.: 0)
20	273	LM_neopixel.py           (mlint: True)	(pylint: 7.59)	(ref.: 2)
21	274	LM_cct.py                (mlint: True)	(pylint: 8.83)	(ref.: 1)
22	38	LM_L9110_DCmotor.py      (mlint: True)	(pylint: 7.69)	(ref.: 0)
23	256	LM_neoeffects.py         (mlint: True)	(pylint: 6.91)	(ref.: 0)
24	30	LM_i2c.py                (mlint: True)	(pylint: 5.71)	(ref.: 0)
25	69	LM_dht22.py              (mlint: True)	(pylint: 8.0)	(ref.: 0)
26	59	LM_L298N_DCmotor.py      (mlint: True)	(pylint: 8.78)	(ref.: 0)
27	37	LM_esp32.py              (mlint: True)	(pylint: 4.38)	(ref.: 0)
28	56	LM_pet_feeder.py         (mlint: True)	(pylint: 7.88)	(ref.: 0)
29	82	LM_rencoder.py           (mlint: True)	(pylint: 8.92)	(ref.: 0)
30	247	LM_keychain.py           (mlint: False)	(pylint: 9.14)	(ref.: 0)
31	69	LM_dht11.py              (mlint: True)	(pylint: 8.0)	(ref.: 0)
32	74	LM_telegram.py           (mlint: False)	(pylint: 8.94)	(ref.: 0)
33	177	LM_OV2640.py             (mlint: False)	(pylint: 9.06)	(ref.: 0)
34	249	LM_rgb.py                (mlint: True)	(pylint: 8.66)	(ref.: 1)
35	62	LM_distance.py           (mlint: True)	(pylint: 8.14)	(ref.: 0)
36	313	LM_VL53L0X.py            (mlint: True)	(pylint: 9.07)	(ref.: 0)
37	107	LM_light_sensor.py       (mlint: True)	(pylint: 8.94)	(ref.: 0)
38	12	LM_rp2w.py               (mlint: True)	(pylint: 4.44)	(ref.: 0)
39	190	LM_presence.py           (mlint: True)	(pylint: 8.75)	(ref.: 4)
40	29	LM_dashboard_be.py       (mlint: True)	(pylint: 6.5)	(ref.: 0)
41	170	LM_dimmer.py             (mlint: True)	(pylint: 8.22)	(ref.: 0)
42	66	LM_demo.py               (mlint: False)	(pylint: 8.21)	(ref.: 0)
43	105	LM_lmpacman.py           (mlint: True)	(pylint: 8.38)	(ref.: 0)
44	176	LM_gameOfLife.py         (mlint: True)	(pylint: 9.29)	(ref.: 2)
45	58	LM_catgame.py            (mlint: True)	(pylint: 8.46)	(ref.: 0)
46	42	LM_intercon.py           (mlint: True)	(pylint: 8.18)	(ref.: 3)
47	43	LM_ds18.py               (mlint: True)	(pylint: 5.0)	(ref.: 2)
48	250	LM_i2s_mic.py            (mlint: False)	(pylint: 8.71)	(ref.: 1)
49	34	LM_sdcard.py             (mlint: True)	(pylint: 7.88)	(ref.: 0)

SUM CODE LINES (WITH COMMENTS, WITHOUT EMPTY LINES): 6822

LM (Load Modules) - Application logic - accessable over socket server as a command

micrOS devToolkit resources

DevToolKit Dashboard apps

You can easly copy the Template_app.py, and create a new socket based app. Template_app.py

micrOS/toolkit/dashboard_apps
โ”‚ย ย  โ”œโ”€โ”€ AirQualityBME280_app.py
โ”‚ย ย  โ”œโ”€โ”€ AirQualityDHT22_CO2_app.py
โ”‚ย ย  โ”œโ”€โ”€ AnalogCCT_app.py
โ”‚ย ย  โ”œโ”€โ”€ AnalogRGB_app.py
โ”‚ย ย  โ”œโ”€โ”€ CatGame_app.py
โ”‚ย ย  โ”œโ”€โ”€ Dimmer_app.py
โ”‚ย ย  โ”œโ”€โ”€ GetVersion_app.py
โ”‚ย ย  โ”œโ”€โ”€ GetVersion_app.pyc
โ”‚ย ย  โ”œโ”€โ”€ NeopixelTest_app.py
โ”‚ย ย  โ”œโ”€โ”€ RoboArm_app.py
โ”‚ย ย  โ”œโ”€โ”€ SysCheck_app.py
โ”‚ย ย  โ”œโ”€โ”€ Template_app.py

Stored connection data and default node configs

micrOS/toolkit/user_data
โ”‚ย ย  โ”œโ”€โ”€ device_conn_cache.json        <- connection cache
โ”‚ย ย  โ””โ”€โ”€ node_config_archive
โ”‚ย ย      โ”œโ”€โ”€ BigRGB-node_config.json
โ”‚ย ย      โ”œโ”€โ”€ Chillight-node_config.json
โ”‚ย ย      โ”œโ”€โ”€ Kapcsolo230-node_config.json
โ”‚ย ย      โ”œโ”€โ”€ LampController-node_config.json
โ”‚ย ย      โ”œโ”€โ”€ MeasureNode-node_config.json
โ”‚ย ย      โ”œโ”€โ”€ MrGreen-node_config.json
โ”‚ย ย      โ”œโ”€โ”€ RingLamp-node_config.json
โ”‚ย ย      โ””โ”€โ”€ test-node_config.json

Virtaulenv for development and stored USB-Serial drivers

micrOS/env/
โ”œโ”€โ”€ __init__.py
โ”œโ”€โ”€ driver_cp210x
โ”‚ย ย  โ”œโ”€โ”€ CP210x_Universal_Windows_Driver
โ”‚ย ย  โ””โ”€โ”€ macOS_VCP_Driver
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ venv
    โ”œโ”€โ”€ bin
    โ”œโ”€โ”€ include
    โ”œโ”€โ”€ lib
    โ””โ”€โ”€ pyvenv.cfg

Precompiled resources for easy install

micrOS/toolkit/workspace/precompiled
    โ”‚ย ย  โ”œโ”€โ”€ BgJob.mpy
    โ”‚ย ย  โ”œโ”€โ”€ Common.mpy
    โ”‚ย ย  โ”œโ”€โ”€ ConfigHandler.mpy
    โ”‚ย ย  โ”œโ”€โ”€ Debug.mpy
    โ”‚ย ย  โ”œโ”€โ”€ Hooks.mpy
    โ”‚ย ย  โ”œโ”€โ”€ InterConnect.mpy
    โ”‚ย ย  โ”œโ”€โ”€ InterpreterCore.mpy
    โ”‚ย ย  โ”œโ”€โ”€ InterpreterShell.mpy
    โ”‚ย ย  โ”œโ”€โ”€ InterruptHandler.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_L298N_DCmotor.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_L9110_DCmotor.py
    โ”‚ย ย  โ”œโ”€โ”€ LM_VL53L0X.py
    โ”‚ย ย  โ”œโ”€โ”€ LM_bme280.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_buzzer.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_catgame.py
    โ”‚ย ย  โ”œโ”€โ”€ LM_cct.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_co2.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_dht11.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_dht22.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_dimmer.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_distance_HCSR04.py
    โ”‚ย ย  โ”œโ”€โ”€ LM_ds18.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_esp32.py
    โ”‚ย ย  โ”œโ”€โ”€ LM_genIO.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_i2c.py
    โ”‚ย ย  โ”œโ”€โ”€ LM_intercon.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_light_sensor.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_neoeffects.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_neopixel.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_oled.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_oled_ui.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_pet_feeder.py
    โ”‚ย ย  โ”œโ”€โ”€ LM_ph_sensor.py
    โ”‚ย ย  โ”œโ”€โ”€ LM_rgb.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_roboarm.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_robustness.py
    โ”‚ย ย  โ”œโ”€โ”€ LM_servo.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_stepper.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_switch.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_system.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LM_tinyrgb.mpy
    โ”‚ย ย  โ”œโ”€โ”€ IO_esp32.mpy
    โ”‚ย ย  โ”œโ”€โ”€ IO_tinypico.mpy
    โ”‚ย ย  โ”œโ”€โ”€ LogicalPins.mpy
    โ”‚ย ย  โ”œโ”€โ”€ Network.mpy
    โ”‚ย ย  โ”œโ”€โ”€ Scheduler.mpy
    โ”‚ย ย  โ”œโ”€โ”€ SocketServer.mpy
    โ”‚ย ย  โ”œโ”€โ”€ Time.mpy
    โ”‚ย ย  โ”œโ”€โ”€ TinyPLed.mpy
    โ”‚ย ย  โ”œโ”€โ”€ boot.py
    โ”‚ย ย  โ”œโ”€โ”€ micrOS.mpy
    โ”‚ย ย  โ”œโ”€โ”€ micrOSloader.mpy
    โ”‚ย ย  โ””โ”€โ”€ reset.mpy

Note: From the micrOS/source/ by default the LMs are not compiling, to extend complied LM list add LM explicitly to the following file:

micrOs/toolkit/LM_to_compile.dat

HINTS

devToolKit.py -lint
OR
devToolKit.py --linter

micrOS gateway - Linux service template

[BETA] service setup tool: toolkit/helper_scripts/linux_service/make.bash

[Unit]
Description=micrOS gateway REST API service
After=network-online.target

[Service]
Environment="API_AUTH=<usr_name>:<password>"  <-- replace
ExecStart=/usr/bin/python3 -m devToolKit -gw  <-- check (depends on deployment) OR /bin/bash
WorkingDirectory=/home/gateway                <-- replace
StandardOutput=inherit
StandardError=inherit
Restart=always
User=<user>                                   <-- replace

[Install]
WantedBy=multi-user.target

GIT

gource \
    --highlight-users \
    --hide filenames \
    --file-idle-time 0 \
    --max-files 0 \
    --seconds-per-day 0.01 \
    --auto-skip-seconds 1 \
    --title "micrOS Evolution" \
    --output-ppm-stream - \
    | ffmpeg -y -r 30 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 1 -threads 0 -bf 0 output.mp4

git push -u origin master