Using mqtt_as on ESP vs PicoW?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

Using mqtt_as on ESP vs PicoW?

Post by Jibun no kage » Sat Aug 13, 2022 5:59 pm

Using mqtt_as on ESP vs PicoW? To test the mqtt_as implementation on PicoW, it was pretty straight-forward, just upload the mqtt_as.py and config.py files to PicoW file system (via Thonny). And use.

I tried the same with an ESP module with 1MB, and sure enough, memory error on module load of the MQTTClient. I recalled the mqtt_as module is to big to compile directly, so the question is how do I get it in a usable state on an ESP module? It is not core to MicroPython downloadable images, right? So I need to compile/freeze it?

Just to test I tried the same with Thonny download of micropython-mqtt-async, and it the same basic wall, memory error when I tried to load the micropython-mqtt-async module.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Using mqtt_as on ESP vs PicoW?

Post by pythoncoder » Sun Aug 14, 2022 7:44 am

Please see the docs re use on ESP8266. I have not tested on ESP8266 versions with < 4MiB of Flash: it is possible that it is not usable on the 1MiB versions.

It is much easier to use platforms with more RAM such as a Pico W, ESP32 or Pyboard D.
Peter Hinch
Index to my micropython libraries.

Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

Re: Using mqtt_as on ESP vs PicoW?

Post by Jibun no kage » Sun Aug 14, 2022 2:07 pm

I asked this above... how does one add it and mark it as frozen or otherwise compiled? I suspect I will need to create a custom firmware at some point, so how do I start down that path? Per your documentation "The module is too large to compile on the ESP8266 and should be precompiled or preferably frozen as bytecode." That makes sense, I just need some assistance on how to do that correctly.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Using mqtt_as on ESP vs PicoW?

Post by pythoncoder » Mon Aug 15, 2022 7:24 am

Peter Hinch
Index to my micropython libraries.

Post Reply