@M2@bigbuilder: The dust sensor returns values only once every 30 seconds or longer, other wise it just returns 0. If the first number is 1, that indicates that the there is a new value coming from the dust sensor. Can you try this out and see if it’s any better: https://github.com/karan259/GrovePi/blob/master/Software/Python/grove_dust_sensor.py . You should run it for a couple of minutes. Right now it returns low pulse occupancy in the last 30 seconds. There is a forumla to find the concentration from the low pulse occupancy. If the low pulse occupancy works well, I’ll add the code for finding the concentration.
Do you get a lot of nan’s with the dust sensor. Can you post the output with a couple of nan’s and the data before and after it.
Just to clarify what Karan said: the dust sensor itself, the actual sensor, will only return values about once every 30 seconds. It varies. But if you want to know more about this, please check the datasheet, linked above int he comments. You’re not being limited by the GrovePi or the Pi, but the dust sensor.
@karan, @John. We appreciate all your work on this. However, I just want to point out that since the update to the new firmware, using the program Karan posted above, this is all I get:
Reading from the dust sensor
0
0
0
0
0
0
0
0
Error
0
0
This goes on for hours… only the dust sensor program is running. It ran all night, and in the morning… still 0…
@karan, I don’t get any nans, just zeroes. As for the Air Quality, and the DHT, I do get nans, but no more 'random" stuff, but I need to test them some more. However, I think your other code fixes took care of the other two sensors. Thank You! I plan on downgrading the firmware tomorrow, and see if I get back my old values to make sure I didn’t break the dust sensor. I will let you know as soon as I get a chance to do that.
@bigbuilder: The GrovePi worked great for me when I had just a barometer sensor hooked up. Ran for weeks recording to an SQLite database. But, I was hoping to get a dust sensor, temp & humidity, and air quality all going at once. Is that what you are working on?
Downgraded firmware to 1.2.4: Sensor is back to where it was: Sample output from grove_dust_sensor from main repository:
Reading from the dust sensor
10297
17062
62
Error
62
14445
62
So, there is something odd with the 1.2.5 firmware that disables the dust sensor on my system. If I use 1.2.5, the dust sensor output is always 0 as stated in previous post.
@karan, I am using the older GrovePi, not the newer GrovePi+. Is that why we are getting different results? I’ve looked back through all the postings, and I don’t see any mention that this makes a different. I bought two a very long time ago. The one I have been testing seems to upgrade to the newer firmwares just fine.
Software: I have several directories. One directory I cloned github.com/karan259/GrovePi/ and I also have a directory for the normal GrovePi repository. But the main repository does not have the newer firmware, nor the update to grovepi.py. Is this correct? I have updated the grovepi.py in the main repository before running tests. I have been testing both locations…
Any suggestions? If I have misunderstood a previous post, please let me know.
Hey Guys,
Sorry for the confusion. I ended up rewriting the whole thing from scratch to make it work without causing unnecessary delays in the code.
How Seeed does it with the their Arduino code is that they use the pulseIn() function to measure the length when the pulse from the sensor goes low. This works only on D8 port but the problem with this is that everything pauses on the firmware when pulseIn() is running which can be from 10ms to 500ms or more.
I have tested the pulse duration but testing it with a logic analyzer to see if both the software and the logic analyzer report the same length and they do, but I have just tested it on the sensor that I have so it would be great if you guys can test and let me know if you face any problems.
Sorry for the confusion. I’ll update the docs on the python code so that it says the same.
Here are the results:
Reading from the dust sensor
3060750
97
172
1568
329
151
170
0
171
117
361
0
79
0
235
If I understand what you had said before, this “returns low pulse occupancy in the last 30 seconds”. So we still need to convert this to concentration, correct?
I am curious though, are you seeing such difference in values with your sensor?
And just to make sure we are on the same page, I can just clone your repository here: https://github.com/karan259/GrovePi/ and that should contain the update to firmware, grovepi.py, and grove_dust_sensor.py, correct?
Hey M2,
Looks like the sensor is indeed returning values. Everything looks correct. Can you run the grove_firmware_version_check.py to make sure that you are running 1.2.5.
You will have to calculate the conc from the lowoccupancy values. The wiki here: http://www.seeedstudio.com/wiki/Grove_-_Dust_sensor shows how you calculate the conc: ratio = lowpulseoccupancy/(sampletime_ms*10.0); // Integer percentage 0=>100 concentration = 1.1*pow(ratio,3)-3.8*pow(ratio,2)+520*ratio+0.62; // using spec sheet curve
I think the first value looks a bit odd but other looks fine. The values on my sensor look a bit more consistent. Reading from the dust sensor
10416
1782
2481
1864
2141
2224
1146
2291
1642
1311
I think the best thing to do would be plot it over a few hours and see how good it is.
Hi everyone I’m feeling like a total NOOB. Anyway - have been following this thread and what I can gather is the reason my Dust Sensor isn’t giving me any values is the same reason as many on this thread. To solve it seems
Upgrade to 1.2.5 firmware
Connect to D2 rather than D8
Try again
I’m using a RPI B.
Where I’m stuck is the firmware piece. I successfully upgraded to 1.2.2 using the auto scripts and went to Karan’s
however when I followed the commands to get ino installed when I run
sudo ino init -t grovepi
I get the following errors:
Traceback (most recent call last):
File “/usr/local/bin/ino”, line 6, in <module>
main()
File “/usr/local/lib/python2.7/dist-packages/ino/runner.py”, line 76, in main
args.func(args)
File “/usr/local/lib/python2.7/dist-packages/ino/commands/init.py”, line 46, in run
‘.’, ignore=lambda *args: [‘manifest.ini’])
File “/usr/local/lib/python2.7/dist-packages/ino/commands/init.py”, line 56, in copytree
names = os.listdir(src)
OSError: [Errno 2] No such file or directory: ‘/usr/local/lib/python2.7/dist-packages/ino/templates/grovepi’
Is there another way to get version 1.2.5 firmware onto my GrovePi so that I can test the interrupt driven version in order to get my dust sensor working? Any assistance appreciated.
However, you may want to wait to hear from karan to be sure.
As for the D2 versus the D8, that only is needed if you are using the repository from karan.
@karan: I have been using your new firmware, and code, and now have 4 sensors going at once, but I do have to have a delay of at least a minute between each one. I still get the occasional 0, IOError, or other mishap, but when I record them to a database, they seem to overall pretty good. I have not calibrated the dust sensor yet… but when I’m done, I will keep the thread updated.
I must have done something wrong - I have the GrovePi+ which ‘appears’ not to need the jumper. Following the instructions I now get the following error with version check:
pi@dex ~/Desktop/GrovePi/Software/Python $ sudo python grove_firmware_version_check.py
Traceback (most recent call last):
File “grove_firmware_version_check.py”, line 40, in <module>
print (“GrovePi has firmware version:”, grovepi.version())
File “/home/pi/Desktop/GrovePi/Software/Python/grovepi.py”, line 258, in version
return “%s.%s.%s” % (number[1], number[2], number[3])
TypeError: ‘int’ object has no attribute ‘getitem’
I ftp’ed the grove_pi_v1_2_5.cpp.hex file to the right directory and ran the:
@pieater: which port did you use? D2 or D8? Also, as @HumanCell talked about before, there is a “correct” orientation that seemed to help mine be more consistent. It needs to be facing up, which makes no sense without a picture, so in the cases of mine, I have it orientated so that the wires coming out of the sensor are pointing down. So, the sensor I am using is being help up in the air with a paperclip until I get a chance to 3D print something to hold it.
FYI: I am using the original GrovePi, and the sensor I am using is a PPD42
Thanks for that I did have the orientation so that the writing on the motherboard was the right way up and the leads were on the bottom.
I tried the other orientation just in case.
I’m using a GrovePi+ with a RPI B and I was testing on D8 but tried D2 anyway, also yes I am using the PPD42 grove dust sensor.