Memory issue with Blynk

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
mybigman
Posts: 4
Joined: Tue Jan 07, 2020 11:15 am

Memory issue with Blynk

Post by mybigman » Tue Jan 07, 2020 11:32 am

Hi Guys,

I am using Wemos D1 mini pro with latest MP flashed to it and have been playing around with different examples and am really enjoying tinkering again as python makes it alot easier then using C/C++.

I wanted to try out the blynk library from the offical repo, however as soon as I import it I get a memory error :/

Code: Select all

# main.py
from libs import blynklib_mp as BlynkLib

# serial
MemoryError: memory allocation failed, allocating 138 bytes
I assume its over the memory limit based on the error and that's the only thing I am importing other than the initial wifi setup.

I have had more item imported than this at once such as mqtt, weather api, dictionary parser and it hasn't been an issue.

Is there something I can do other than compile the library into the framework?

Thanks.

User avatar
jimmo
Posts: 1189
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Memory issue with Blynk

Post by jimmo » Wed Jan 08, 2020 12:41 am

blynklib_mp.py is quite a large piece of code, which the ESP8266 has to both load and compile. You might find more success to pre-compile it into a .mpy file and use that instead.

Here's a .mpy version of blynklib_mp -- https://www.dropbox.com/s/pjniddycmtnig ... p.mpy?dl=0 (Make sure you remove the .py file from your ESP first otherwise it'll use that instead).

Even better would be to freeze it into the firmware, but that will require building your own MicroPython firmware, but it will save a lot more RAM.

mybigman
Posts: 4
Joined: Tue Jan 07, 2020 11:15 am

Re: Memory issue with Blynk

Post by mybigman » Wed Jan 08, 2020 10:22 am

thanks... appreciate it.

Post Reply