Skip to content
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

SerialTimeoutError in example particulates code #18

Open
davetisyan95 opened this issue Aug 7, 2023 · 5 comments
Open

SerialTimeoutError in example particulates code #18

davetisyan95 opened this issue Aug 7, 2023 · 5 comments

Comments

@davetisyan95
Copy link

Hello,

I am encountering an error when running the particulates.py example.

Traceback (most recent call last):
  File "particulates.py", line 26, in <module>
    readings = pms5003.read()
  File "/usr/local/lib/python3.7/dist-packages/pms5003/__init__.py", line 127, in read
    raise SerialTimeoutError("PMS5003 Read Timeout: Failed to read start of frame byte")
pms5003.SerialTimeoutError: PMS5003 Read Timeout: Failed to read start of frame byte

Things I have tried:

  • ran install.sh and verified /boot/config.txt
  • validated that check-install.py looks ok
  • new enviro+ and PMS5003 sensor
  • verified connection is good (I hear the fan in the sensor speed up when I start the script)
  • Tried both bullseye and buster

All other scripts work fine, it is just when trying to use the PM sensor in particulates.py.

Context:
I have successfully run this before maybe around 2021? I have since lost that version of the code and recently tried re-using it. Initially i was using the latest OS (Bullseye), now am on Buster and still no luck.

@hstaab
Copy link

hstaab commented Nov 23, 2023

I can confirm that a fresh setup with the sensor on a new Raspberry Pi Zero with Enviro+, will not work as instructed. I also had this setup working in 2021.

@prutsky
Copy link

prutsky commented Nov 27, 2023

Me too. Pick-up my EnviroPlus board with a RPI Zero.

I get this error:

python3 particulates.py 
2023-11-27 14:41:35.527 INFO     particulates.py - Print readings from the PMS5003 particulate sensor.

Press Ctrl+C to exit!


Traceback (most recent call last):
  File "/home/pi/enviroplus-python/examples/particulates.py", line 18, in <module>
    pms5003 = PMS5003()
              ^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/pms5003/__init__.py", line 109, in __init__
    self._pin_enable, self._pin_reset = gpiodevice.get_pins_for_platform(PLATFORMS)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 0)

@JollyJokr
Copy link

Sadly I can +1 the problem with a fresh setup and the PMS5003 sensor. Everything else is working fine.

Traceback (most recent call last):
  File "/home/pi/Pimoroni/enviroplus/examples/mqtt-all.py", line 278, in <module>
    main()
  File "/home/pi/Pimoroni/enviroplus/examples/mqtt-all.py", line 243, in main
    pms5003 = PMS5003()
  File "/usr/local/lib/python3.9/dist-packages/pms5003/__init__.py", line 109, in __init__
    self._pin_enable, self._pin_reset = gpiodevice.get_pins_for_platform(PLATFORMS)
ValueError: not enough values to unpack (expected 2, got 0)

@Gadgetoid
Copy link
Member

Recent errors - eg: ValueError: not enough values to unpack (expected 2, got 0) - appear to be related to the migration to gpiod/Bookworm OS. Some more details and tips for how to debug what's happening are available here: pimoroni/enviroplus-python#126

@Black616Angel
Copy link

A workaround would be installing the last working version via pip install pms5003==0.0.5 this worked for me.
In the mean time pimoroni should try not setting the version to 1.0 if things break so regularly on the examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants