Closed bastelbuud closed 1 year ago
Hi,
It sounds like newest changes are breaking something out there.
I will take a look to latest micropython changes as soon as I have some spare time. Meanwhile, feel free of sharing your ideas here.
Maybe the lib
directory is no more used? May you try to just put the max30102
folder into the root directory, next to boot.py
and main.py
?
thanks for your quick reply.
putting the 3 files in a folder called max30102 under root does not help.
import max30102 returns no error,
from max30102 import MAX30102 returns
Traceback (most recent call last):
File "
Hi i now have installed circular_buffer.py and max30102.py directly under lib, and not under lib/max30102 and this works. However, the data from the example seems to be strange. I will have to check in more detail
Hi, thank you very much for taking the time for trying! It is always a pain when breaking changes occur. I will setup my board with the latest MicroPython version and look into it as soon as possible!
For what concerns the data you're obtaining, what do you mean with "strange"? I can suggest a pair of things: 1 - check if your sensor has swapped LED channels as explained here 2 - check that the sensor setup is optimized for your use-case. The default settings are OK if you want to see the heartbeat, compute the bmp value or compute the SpO2 value.
well I do not get a haertbeat , I get values, who are moire or less identcal if I put the finger on the sensor. the acquisition frequency is varying between 49 and 50. the values for red are around 15700 and ir around 13700 if i use ledmode=1 in the setup, nothing happens,
Hi bastelbuud,
I added support to the new package manager mip
. Provided that you insert your wifi credentials and the correct I2C pins, the example provided into the repository should now be working out-of-the-box with latest MicroPython versions, too.
FYI, these are the mip
commands to install the driver.
I also fixed the issue of the import not working: for a manual installation, you can now create max30102
folder into lib
folder, and put the two __init__.py
and circular_buffer.py
files into it.
I hope that everything works well now, and I would really appreciate a feedback from you, before closing this issue.
trying with a fresh new raspberry pi pico with MicroPython v1.19.1-724-gfb7d21153 on 2022-12-01; Raspberry Pi Pico W with RP2040 executing import mip mip.install("github:n-elia/MAX30102-MicroPython-driver") creates a folder max30102 in lib with the 2 files curcular_buffer.py and init.py it is strange that the max30102 class is now defined in the init.py, but there is probably a reason for that
There is one thing still not working in this version of micopython, sleep is not in machine , but in time, so this line has the be changed from machine import sleep, SoftI2C, Pin to from machine import SoftI2C, Pin and this line has to be added from time import sleep
Many thanks for the prompt correction (in my config)
Good to hear that!
Yes, i moved everything into the init, so you can just import the MAX30102 class from max30102 module.
Thank you for pointing the sleep error out! I thought that this function worked the same on all micropython ports... I will add a warning into the code!
I will close this issue as we've solved the problem. Please feel free to open new ones, or to open a new discussion if you have more things to discuss!
Thanks again, Nicola
Hi, I wanted to use the library on a pico w with version v1.19.1-724-gfb7d21153 of micropython installed. First problem : upip is no more used in this version of micropython, but a new toool called mip However, trying to run mip.install("micropython - max30102") returns Installing micropython - max30102 (latest) from https://micropython.org/pi/v2 to /lib Traceback (most recent call last): File "", line 1, in
File "mip/init.py", line 1, in install
File "mip/init.py", line 1, in _install_package
File "mip/init.py", line 1, in _install_json
File "urequests.py", line 180, in get
File "urequests.py", line 76, in request
OSError: -6
I then copied the files into the lib folder and tried
from max30102 import MAX30102
but got the following error
Traceback (most recent call last): File "", line 1, in
ImportError: no module named 'max30102.MAX30102'
any thoughts about how to resolve the problem ?