I thought it would be there when I looked on GitHub but the __init__.py
file I have found, in the enviroplus folder on my PI, does not contain that line. In fact I can’t even find a folder relating to PMS5003, despite having run the Enviroplus board with it attached for several weeks???
I like the idea of adding pin_enable=x, pin_reset=y
to my code that would save a lot faff. Thanks for that suggestion.
If I remember right installed modules go off somewhere else that Python knows to look in, so it might not be somewhere obvious. I should be getting one of these sensors by the weekend, if you’ve not got it sorted by then I’ll have a poke at it, but adding the pin definitions when initialising the sensor definitely seems like it would be the easiest method.
Have a look in
/etc/systemd/system/
and
/usr/bin/
Thanks both.
Alphanumeric: I couldn’t find it in those locations.
Shoe: This is the code I currently have, it comes from nopheads
EnviroPlusWeb.py app, where he has add fan speed control on GPIO 4. It was what I was running with the EnviroPlus board before I deconstructed the project to individual sensors. Which has been interesting!
from pms5003 import PMS5003, ReadTimeoutError as pmsReadTimeoutError pms5003 = PMS5003() # PMS5003 particulate sensor IO.setmode(IO.BCM) # Set pin numbering IO.setup(4,IO.OUT) # Fan controller on GPIO 4 pwm = IO.PWM(4,1000) # PWM frequency pwm.start(100) # Duty cycle
It was a bit of a shot in the dark, those two locations are where Pimoroni’s Plasma software stored config files. I figured it couldn’t hurt to look there.
Yes, but first I’d simply try modifying your script to read;
pms5003 = PMS5003(pin_enable=x, pin_reset=y)
It’ll be safer and will avoid potential complications in the future.
Thanks I will try that. It will give me more flexibility if I ever want to back to the EnviroPlus.
Another GPIO question I am afraid!
Can a pin that has been designated a PI function be ‘downgraded’ to a simple On/Off GPIO pin?
The Mini Garden has a limited number of un-designated connections that I can use for my Rain and Wind sensors, a mixture of Reed switches and an ADC for wind direction. I would like to change a couple of these. GPIO pin 33 (PWM1), pin 19 (PCM_FS) and pin 24 (CE0)
Thanks
All of the pins which aren’t grounds, 5V and 3v3 except GPIO27/28 can act as simple on/off pins. The special fuctions which some of them can do are optional, if you want to use it as a normal I/O pin then you just have to set it up like it is a normal I/O pin (e.g. see the GPIO Zero examples).
Thanks Shoe, I will start to experiment!