Error in Grove Dust Sensor code (Solved)

grovepi
dust-sensor

#1

Hi.
I have been trying to run the grove dust sensor, set it up properly and updated the framework version as well. Still, when I connect dust sensor to grovepi+(on port D2) and run the script provided, I get the following error:

AttributeError: module object has no attribute ‘dustSensorRead’

I assume, this is telling me that grovepi+ has no function for dustSensor. And what to do in this case?


#2

I think you need to update the library (and most likely the firmware too) on the GrovePi.

To update the library, execute this:

curl -kL dexterindustries.com/update_grovepi | bash

And after that, flash the firmware onto your GrovePi by doing these:

cd /home/pi/Dexter/GrovePi/Firmware
bash firmware_update.sh

Once the firmware gets flashed, launch a Python shell, import the grovepi module and check the version of the firmware:

import grovepi
grovepi.version()

Also, make sure you read the documentation for it too:
https://dexterind.github.io/GrovePi/

Thank you!


#3

Hi Robert,

I have exactly the same issue. I used the DI image and GrovePi is running smoothly with the other sensors. I followed your advise concerning updating as well. I have Firmware version 1.3.0 installed.

Do you have an idea? I need this sensor for an upcoming project.

Thanks,
Adrian


#4

On 1.3.o I think the firmware grovepi.py was changed. Try replacing DustSensorRead() with dust_sensor_read()


#5

Worked like a charm. Thanks @reunny


#6

Good for you. Mine is not showing any readings at all.


#7

Hi @adrian.schoene, @reunny, @nashezzubair and for everyone else.

For those that visit this thread, maybe you can try out the suggestion I have come up in this post:

Or you can have a look at the documentation and see if there’s anything missing out of your scripts:
https://dexterind.github.io/GrovePi/

Which by the way, were you not aware of the documentation? I’m wondering if we somehow have put the documentation in some hidden place where nobody can find it. If so, please let us know.

And speaking of which, where do you usually go to find instructions/information regarding the GrovePi?

Thank you!