Closed ftosteve closed 4 years ago
I have the same setup as you. I think I have a fix for you that I must have forgotten to push.
Let me take a look tonight and hopefully we can get you up and running.
I find that after a few hours of running the PMS5003 becomes unresponsive for a bit (i.e. the errors you are posting) and then eventually recovers.
I think this might be a race condition. (multiple access on port - part of the error). I'll take a look how this can be fixed
I just updated the code. Give this a go and let me know if you still have the same errors. I'm not getting them on my test setup at the moment.
Not at desk right now. Will try updated code first thing in the morning and let you know. Thanks for the quick response.
Well it seems your update did the trick. Thanks so much for the updated code, much appreciated. It's now been running 5 hours straight with no errors :o) On a seperate note, I dont suppose you know of any code to use the MEMS microphone to get an overall A-weighted SPL value? Thanks again.
I had actually forgotten there was a mic on it. I don't know of any code that will do it out of the box, but it doesn't seem to hard. I'll take a look on the weekend as I will want to upgrade my deployment too. :)
Sounds good?
Lol. Easily done :o) Looking around it soounds sound is quite complex. If you get change to have a look that would be really appreciated. Sounds great :o)
Pimoroni do 2 examples but I believe the numbers output or amplitue rather than SPL. https://github.com/pimoroni/enviroplus-python/blob/master/examples/noise-profile.py https://github.com/pimoroni/enviroplus-python/blob/master/examples/noise-amps-at-freqs.py
If you get SPL working then I owe you a few drinks ;o) Thanks again.
Today I have been trying to run your code and keep getting numerous messages stated above. It's on a Pi1B(newest), with a Enviro+ and PMS5003, all brand new. If I run Pimoroni's particulates.py it runs fine and continuous with no errors so the equipment is fine.
After several of the warning's it sometimes crashes out with the following error: Process Process-1: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 501, in read 'device reports readiness to read but returned no data ' serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap self.run() File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run self._target(*self._args, *self._kwargs) File "/home/pi/.local/lib/python3.7/site-packages/enviro_mqtt/enviro.py", line 272, in __run_loop func(args, **kwargs) File "/home/pi/.local/lib/python3.7/site-packages/enviro_mqtt/enviro.py", line 256, in display_all pms = self.particulates File "/home/pi/.local/lib/python3.7/site-packages/enviro_mqtt/enviro.py", line 236, in particulates pms_data = self.pms5003.read() File "/usr/local/lib/python3.7/dist-packages/pms5003-0.0.5-py3.7.egg/pms5003/init__.py", line 125, in read sof = self._serial.read(1) File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 509, in read raise SerialException('read failed: {}'.format(e)) serial.serialutil.SerialException: read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
Any ideas? Thanks Steve