I’ve just tested it on mine and it’s working perfectly. Maybe you’re still running a script that’s not up to date. Here’s how I did it:
import grovepi
import time
grovepi.dust_sensor_en() # it enables it on port D2
grovepi.set_dust_sensor_interval(10000) # set it to retrieve the values every 10 seconds
while True:
read, lpo_time = grovepi.dust_sensor_read()
if read == 1:
print('LPO time = {}'.format(lpo_time))
time.sleep(2)
And this is what I’m getting in return from it:
LPO time = 30
LPO time = 421
LPO time = 256
LPO time = 230
LPO time = 0
LPO time = 78
LPO time = 160
LPO time = 383
LPO time = 16
LPO time = 697
LPO time = 1939
LPO time = 855
LPO time = 639
If you look at the script, you’ll see that before using the dust sensor, I had to enable it, otherwise, it will only return zeros. The 2nd instruction, for setting the sensor interval to 10s is because the default one is at 35 seconds and that was a bit too much for what I needed to showcase.
And if you want to connect a different device to that port, you’ll consequently have to disable the dust sensor by calling dust_sensor_dis. You can check more about this here: https://dexterind.github.io/GrovePi/api/interrupt/
Let me know if that made your dust sensor device to work.
Interestingly, I have an old Jessie SD card with Grove Pi installed (not Raspbian for Robots). It has firmware 1.2.2.
Both sensors DHT11 and Dust Sensor are working properly. I saved the old codes on the desktop.
So where am I going wrong with 1.3.0? I installed Raspbian For Robots into a new SD card and upgraded the default firmware ( (1.2.7) to 1.3.0 but neither of the sensors give out any reading.
I used the code above as well as the old code for the dust sensor.