-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with i2c setup #4
Comments
It seems both if __name__ == "__main__":
pm_sensor = SPS30() # leave the argument blank if the sensor is connected to bus 1
print(f"Firmware version: {pm_sensor.firmware_version()}") Please give it a try and see whether it fixes the problem. |
Leaving the argument blank got it working! Here is the output of the initial checks:
What do you make of the CRC mismatch message? Also wondering how easy it will be to update the firmware to v2. Here is a print out of the measurements:
The values seem very high! This is in a very clean office environment. |
Now getting this ...
and this:
|
Your sensor still functions well, but it seems there is data conversion or perhaps a wiring issue that may cause this problem. About the firmware version upgrade, I have never tried it, but if I recall it correctly, my firmware should be >1.0. I will compare it with my sensor, gather more info, and keep you posted once I get a possible fix. |
I am going over the wiring today - to make sure its not flakey. However do you think the values are ok? They seem so high. And I confirmed from another source the firmware is not upgradable. |
The values are not okay, but I still believe the sensor functions properly. I encountered a similar issue when I converted raw to actual values. I guess that data conversion may be the cause, though in my case, there was no CRC mismatch; a pure conversion issue. This time, however, was a slightly different scenario, so I have to check the other possibilities. Not sure if it is conflicting with the Adafruit library... |
I think you are right it is a wiring issue. Let me redo everything and get back to you. Don't spend too much time on this. Many thanks for your help! Will report back shortly! |
I got it to work. Now getting this:
But still having CRC mismatch
|
Glad to hear it works now. The result also seems correct if the sensor data reading does not return CRC mismatch. Regarding the status register, it is caused by the firmware version. I check the datasheet and confirm the status register reading requires minimum firmware version 2.2. Please go to page 18 table 8 for details. You can still use the sensor for measurement, but you may want to ignore the status register reading for now. I may add the version-checking logic later to resolve the compatibility issue. |
Hi there - sorry to come back to this. Just wanted to check if this will work with circuitpython ? I got it to work on a raspberrypi but now looking at some of the boards that support circuitpython. |
Hi, I think it won't work because some built-in libraries/ modules used in this code are Python libraries. I'm not quite sure if MicroPython built-in libraries exist in CircuitPython. If they do, I have an example of I2C communication using Next, you may have to rewrite the I2C-related codes in the MicroPython way. |
Hello
I am trying to use this cool library on a raspberrypi 4b with circuitpython. I have two other sensors connected on the i2c working ok. My circuitpython i2c interface is setup like so:
So adding the code for sps30 looks like this:
This throws an error, because I guess its referencing a different I2C setup in your files?
Any ideas how to use circuitpythons i2c setup?
The text was updated successfully, but these errors were encountered: