n-elia / MAX30102-MicroPython-driver

A Maxim MAX30102 driver ported to MicroPython. It should also work for MAX30105.
MIT License
58 stars 21 forks source link

Esp8266 based board has not enough RAM to load the module #17

Closed Cinmay2014 closed 1 year ago

Cinmay2014 commented 1 year ago

When I tried from max30102 import MAX30102, always got importError: no module named 'max30102.MAX30102' dir as below: lib -max30102 --circular_buffer.py --init.py I also tried from max30102.init import MAX30102, got another error: Traceback(most recent call last): File"", line1, in MemoryError: memory allocation failed,allocating 416 bytes

Please help me.

n-elia commented 1 year ago

Hi, which board are you using? And which tools are you using to copy the files on it? You can also attach some screenshots if you want. Also, post the code you're trying to execute, please!

Cinmay2014 commented 1 year ago

Thanks for your quick reply. I am using esp8266 And installed the driver as Thonny IDE plug-in, I also tried to install it directly to the board, and got the same issue.

from max30102 import MAX30102 Traceback (most recent call last): File "", line 1, in ImportError: no module named 'max30102'

n-elia commented 1 year ago

Hi, did you install the latest (v0.4.1) version? Are you absolutely sure that the files have been correctly written onto non-volatile memory? It seems like it cannot find the file.

May you provide a wifi internet connection to your board? If so, can you try the example suggested in the readme here ?

Cinmay2014 commented 1 year ago

Yes, I installed the latest version. I tried the manual way and got a memory error. I will try the wifi-enable method and let you know the result.

n-elia commented 1 year ago

Ok, try that way.

Remember to reset the board (Ctrl-D in Thonny) and let it run boot.py and main.py, do not play your scripts directly from Thonny.

The online installation works fine, so if you will get the memory error, then it means that you have not enough RAM on your board to run this driver, and you could try to precompile or frozen the driver or try to write a lighter one on your own.

Let me know what happens!

Cinmay2014 commented 1 year ago

Tried it and got the error:

Trying to connect to the Internet to download the module. network config: ('192.168.1.216', '255.255.255.0', '192.168.1.1', '192.168.1.98') Installing to: /lib/ Error installing 'micropython-max30102': memory allocation failed, allocating 15685 bytes, packages may be partially installed

Can you tell me how to frozen the driver?

n-elia commented 1 year ago

Hi, Then your board has not enough RAM to load the library. Take a look here for instructions on freezing modules.