Dust Sensor no reading


#1

I just reinstalled Raspbian via Noobs on my RaspBerry Pi. Also reinstalled GrovePi. I had recently acquired a new Shinyei PPD42 dust sensor that I could not use as the SDcard had corrputed.

Now after reinstalling OS and GrovePi firmware, I tried connecting the GrovePi and sensor and running the grove_dust_sensor.py

There is no output other than “Reading from the dust sensor”. I waited more than 30 minutes yet there is no reading

Also the default firmware is 1.2.2 and am unable to change it. I followed the instructions as in here: http://www.dexterindustries.com/GrovePi/get-started-with-the-grovepi/updating-firmware/
the error I get is avrdude: Can’t find programmer id “gpio”.

I am able to use the DHT11 sensor, sound sensor, buzzer and the 4 Digit Display. Only the dust sensor is not giving any output.

What should I do?


#2

Hey reunny,
Can you follow the instructions here and run the troubleshooting script for the GrovePi and upload log here: https://www.youtube.com/watch?v=ZMadpIEYq5o.

-karan


#3

Karan, I have not installed Raspbian for Robots. I had in fact reinstalled the Debian distro published by Raspberry Pi after my SD card corrupted and tried to install GrovePi firmware as directed in http://www.dexterindustries.com/GrovePi/get-started-with-the-grovepi/updating-firmware.

Would this issue be resolved if I use the Dexter distro for Raspbian? I am not sure if I want to do that?


#4

Karan,
Here is the log for troubleshooting GrovePi:

Check space left

Filesystem Size Used Avail Use% Mounted on
/dev/root 7.3G 2.7G 4.3G 38% /
devtmpfs 427M 0 427M 0% /dev
tmpfs 432M 0 432M 0% /dev/shm
tmpfs 432M 12M 420M 3% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 432M 0 432M 0% /sys/fs/cgroup
/dev/mmcblk0p1 3.7G 21M 3.7G 1% /boot
tmpfs 87M 0 87M 0% /run/user/1000
/dev/sda1 60M 16K 60M 1% /media/pi/boot

Check for dependencies

python 2.7.9-1 install ok installed
python-pip 1.5.6-5 install ok installed
git 1:2.1.4-2.1+deb8u2 install ok installed
libi2c-dev 3.1.1+svn-2 install ok installed
python-serial 2.6-1.1 install ok installed
python-rpi.gpio 0.6.2~jessie-1 install ok installed
i2c-tools 3.1.1+svn-2 install ok installed
python-smbus 3.1.1+svn-2 install ok installed
arduino 2:1.0.5+dfsg2-4 install ok installed
minicom 2.7-1 install ok installed
scratch 1.4.0.6~dfsg1-5 install ok installed

wiringPi Found
wiringPi Found
I2C already removed from blacklist
SPI already removed from blacklist

Check for addition in /modules

I2C-dev already there
i2c-bcm2708 already there
spi-dev already there

Hardware revision

gpio version: 2.32
Copyright © 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
Type: Pi 2, Revision: 01, Memory: 1024MB, Maker: Embest

  • Device tree is enabled.
  • This Raspberry Pi supports user-level GPIO access.
    -> See the man-page for more details
    -> ie. export WIRINGPI_GPIOMEM=1

Check the /dev folder

i2c-1
spidev0.0
spidev0.1
ttyAMA0

USB device status

Bus 001 Device 006: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
Bus 001 Device 005: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 004: ID 04ca:0061 Lite-On Technology Corp.
Bus 001 Device 007: ID 1a2c:0c21 China Resource Semico Co., Ltd
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
|__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
|__ Port 2: Dev 7, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 2: Dev 7, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 3: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 4: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, 480M
|__ Port 5: Dev 6, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
Raspbian for Robots Version

V 6.9

This version of Raspbian was modified by Dexter Industries on the Jessie Raspbian Build.
This version was updated on 2016.03.20

Hostname

dex

Checking for Atmega chip

avrdude: Version 5.10, compiled on Jun 18 2012 at 12:38:29
Copyright © 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright © 2007-2009 Joerg Wunsch

     System wide configuration file is "/etc/avrdude.conf"
     User configuration file is "/root/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : unknown
     Using Programmer              : gpio
     AVR Part                      : ATMEGA328P
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PC2
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
       flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
       lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : GPIO
     Description     : Use sysfs interface to bitbang GPIO lines

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f

avrdude done. Thank you.

Checking I2C bus for devices

Checking I2C bus 0

Error: Could not open file /dev/i2c-0’ or/dev/i2c/0’: No such file or directory

Checking I2C bus 1

 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00: – 04 – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

Checking for firmware version

GrovePi has firmware version: 1.2.2


#5

Hey,
You need firmware version 1.2.5 for the dust sensor to work. Go to the firmware/v1.2.5 folder on the GrovePi folder on the desktop on Raspbian via the terminal here: https://github.com/DexterInd/GrovePi/tree/master/Firmware/Source/v1.2/grove_pi_v1_2_5 and make sure you can see grove_pi_v1_2_5.cpp.hex in there. Then run: avrdude -c gpio -p m328p -U flash:w:grove_pi_v1_2_5.cpp.hex to upload the firmware.

After this try running https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_firmware_version_check.py and check if it reports that the firmware version is 1.2.5. Try the dust sensor example after that.

-Karan


#6

Karan,

I had upgraded to 1.2.5 but I posted the log before rebooting.

After rebooting I am able to see 1.2.5 in the log test I re-ran as well (could not post it here) as when I ran grove_firmware_version_check.py. So no issues with version.

Despite having 1.2.5 running, the dust sensor is only giving an output of 0 or Error or occasionally [1,0]. No other readings. I am keeping the sensor in upright position, connected it to the GrovePi on D8 and did not touch the blue widgets as warned on the sensor’s wiki literature. I am also testing it in a dark room without any draft from a fan or window. Yet the readings do not suggest anything significant. Am I missing something?


#7

Karan, here is the latest troubleshooting script log :

Check space left

Filesystem Size Used Avail Use% Mounted on
/dev/root 7.3G 2.7G 4.3G 39% /
devtmpfs 427M 0 427M 0% /dev
tmpfs 432M 0 432M 0% /dev/shm
tmpfs 432M 6.1M 425M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 432M 0 432M 0% /sys/fs/cgroup
/dev/mmcblk0p1 3.7G 21M 3.7G 1% /boot
tmpfs 87M 4.0K 87M 1% /run/user/1000
/dev/sda1 60M 16K 60M 1% /media/pi/boot

Check for dependencies

python 2.7.9-1 install ok installed
python-pip 1.5.6-5 install ok installed
git 1:2.1.4-2.1+deb8u2 install ok installed
libi2c-dev 3.1.1+svn-2 install ok installed
python-serial 2.6-1.1 install ok installed
python-rpi.gpio 0.6.2~jessie-1 install ok installed
i2c-tools 3.1.1+svn-2 install ok installed
python-smbus 3.1.1+svn-2 install ok installed
arduino 2:1.0.5+dfsg2-4 install ok installed
minicom 2.7-1 install ok installed
scratch 1.4.0.6~dfsg1-5 install ok installed

wiringPi Found
wiringPi Found
I2C already removed from blacklist
SPI already removed from blacklist

Check for addition in /modules

I2C-dev already there
i2c-bcm2708 already there
spi-dev already there

Hardware revision

gpio version: 2.32
Copyright © 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
Type: Pi 2, Revision: 01, Memory: 1024MB, Maker: Embest

  • Device tree is enabled.
  • This Raspberry Pi supports user-level GPIO access.
    -> See the man-page for more details
    -> ie. export WIRINGPI_GPIOMEM=1

Check the /dev folder

i2c-1
spidev0.0
spidev0.1
ttyAMA0

USB device status

Bus 001 Device 005: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 004: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
|__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
|__ Port 3: Dev 4, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
|__ Port 4: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, 480M
Raspbian for Robots Version

V 6.9

This version of Raspbian was modified by Dexter Industries on the Jessie Raspbian Build.
This version was updated on 2016.03.20

Hostname

dex

Checking for Atmega chip

avrdude: Version 5.10, compiled on Jun 18 2012 at 12:38:29
Copyright © 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright © 2007-2009 Joerg Wunsch

     System wide configuration file is "/etc/avrdude.conf"
     User configuration file is "/root/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : unknown
     Using Programmer              : gpio
     AVR Part                      : ATMEGA328P
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PC2
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
       flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
       lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : GPIO
     Description     : Use sysfs interface to bitbang GPIO lines

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f

avrdude done. Thank you.

Checking I2C bus for devices

Checking I2C bus 0

Error: Could not open file /dev/i2c-0’ or/dev/i2c/0’: No such file or directory

Checking I2C bus 1

 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00: – 04 – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

Checking for firmware version

GrovePi has firmware version: 1.2.5


#8

This is how the dust sensor script outputs:

>>>
Reading from the dust sensor
0
0
0
0


#9

Karan, when I changed the socket from D8 to D2 this is what I got

>>>
Reading from the dust sensor
28378
6632
5940
6759
6199
6795
6421
5298
4649
Error
2928
3133
3535
3815
5626
5966
5800
5910
4772
2852
3613
2387
3584
3309
3055
3131

How do I interpret these?


#10

First let the sensor run for some time so that the values become consistent. The number you see here is the lowpulseoccupancy (Read more about this herehttp://www.seeedstudio.com/wiki/Grove_-_Dust_Sensor). With the low pulse occupancy, you calculate the concentration by using this: ratio = lowpulseoccupancy/(sampletime_ms10.0); // Integer percentage 0=>100 concentration = 1.1pow(ratio,3)-3.8pow(ratio,2)+520ratio+0.62; // using spec sheet curve. The concentration you get would be in pieces/0.01 cubic feet.

-Karan


#11

Thanks Karan -I think that will fix things for me. Just one more question:

What is sampletime_ms? I am assuming it is the time taken for each sample which is 30 seconds converted to microseconds?
Why does the Arduino demo code on the Sensor’s wiki (http://www.seeedstudio.com/wiki/Grove_-Dust_Sensor) assume a value of 2000 for sampletime ms:

int pin = 8;
unsigned long duration;
unsigned long starttime;
unsigned long sampletime_ms = 2000;//sampe 30s ;
unsigned long lowpulseoccupancy = 0;
float ratio = 0;
float concentration = 0;


#12

Not really sure why the default is 2000 and the time you get is in millisecond.

-Karan


#13

Chris Nafts used 30,000 which seems more like it http://www.howmuchsnow.com/arduino/airquality/grovedust/


#14

MY home weather monitor is up with Temperature, humidity and dust (LPO levels) https://thingspeak.com/channels/99634


#15

Hi there,
@reunny, could you share your code for the concentration calculation, I am still doubting about the correct time units, cause LPO is in microseconds, then ratio sampletime_ms has to be converted to micro, is int so?

Thanks in advance
Pawel


#16

Hi there,

I seem to be having the same problem as reunny. The sensor is just giving me zero values. I originally had the sensor connected to the D8 port, but changed at to D2 after reading this. This has however not made a difference. I am running firmware version 1.2.7 at the moment, I had assumed that later versions of the firmware would also work, however to test this I tried to install 1.2.5, but all I get now is Error printed out repeatedly. I’m a tad stuck here, it would be really good to get this working as I am quickly running out of time for a university project.

EDIT: when running the grove_firmware_version_check.py script with v1.2.5 i get,TypeError: int object has no attribute _getitem__

EDIT2: I set the sleep time to 35 seconds in the grove_dust_sensor.py script and I initially got some values, however it returned to giving zero after about 10 readings.


#17

Hi @maxthorpe,

I’ve got an issue on my table that’s about the Grove Dust Sensor.
It was posted by a user a couple of days ago on github.

Here’s the link to the github issue #365 - link here.
I think it might be related to this guy’s issue, so, please give me some time in order to figure it out.

Thank you!