Hi Yall.
I’m trying to talk to a sharp GP2Y1010 dust sensor, using the existing dustsensor grove functions, which I’m guessing aren’t really what I need.
There’s precious little documentation about how it all works, I’m assuming the calls to the grove’s arduino kick off some polling, and return something from the arduino… but I’ve not quite sorted out what’s what.
I’ve bolted logging through the logger module into the grovepi.py script in the relevant functions to be able to get data out… and tried uncommenting the i2c funcs in the dustSensorRead func, as well as trying the existing bus route… here’s what I see:
2016-09-22T13:05:10.562Z <getDust> DEBUG: dust0 [GP2Y10] (8) 0: Initializing the dust sensor -1 5
2016-09-22T13:05:10.563Z <Grove.grovepi.dust_sensor_en> DEBUG: calling write_i2c_block with: address 4, [14, 0, 0, 0]
2016-09-22T13:05:10.769Z <getDust> DEBUG: dust0 [GP2Y10] (8) 0: inloop
2016-09-22T13:05:10.769Z <Grove.grovepi.dustSensorRead> DEBUG: calling write_i2c_block with: address 4, [10, 0, 0, 0]
2016-09-22T13:05:10.974Z <Grove.grovepi.dustSensorRead> DEBUG: using i2c funcs, we got this back: read_i2c_byte: 0 read_i2c_block: [0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
2016-09-22T13:05:10.978Z <getDust> WARNING: dust0 [GP2Y10] (8) 0: Didnt get a value. Incrementing error.
2016-09-22T13:05:10.978Z <getDust> DEBUG: dust0 [GP2Y10] (8) 1: inloop
2016-09-22T13:05:10.979Z <Grove.grovepi.dustSensorRead> DEBUG: calling write_i2c_block with: address 4, [10, 0, 0, 0]
2016-09-22T13:05:11.184Z <Grove.grovepi.dustSensorRead> DEBUG: using i2c funcs, we got this back: read_i2c_byte: 0 read_i2c_block: [0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
2016-09-22T13:05:11.188Z <getDust> WARNING: dust0 [GP2Y10] (8) 1: Didnt get a value. Incrementing error.
2016-09-22T13:05:11.189Z <getDust> DEBUG: dust0 [GP2Y10] (8) 2: inloop
2016-09-22T13:05:11.189Z <Grove.grovepi.dustSensorRead> DEBUG: calling write_i2c_block with: address 4, [10, 0, 0, 0]
2016-09-22T13:05:11.394Z <Grove.grovepi.dustSensorRead> DEBUG: using i2c funcs, we got this back: read_i2c_byte: 0 read_i2c_block: [0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
2016-09-22T13:05:11.398Z <getDust> WARNING: dust0 [GP2Y10] (8) 2: Didnt get a value. Incrementing error.
2016-09-22T13:05:11.399Z <getDust> DEBUG: dust0 [GP2Y10] (8) 3: inloop
2016-09-22T13:05:11.399Z <Grove.grovepi.dustSensorRead> DEBUG: calling write_i2c_block with: address 4, [10, 0, 0, 0]
2016-09-22T13:05:11.604Z <Grove.grovepi.dustSensorRead> DEBUG: using i2c funcs, we got this back: read_i2c_byte: 0 read_i2c_block: [0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
2016-09-22T13:05:11.608Z <getDust> WARNING: dust0 [GP2Y10] (8) 3: Didnt get a value. Incrementing error.
2016-09-22T13:05:11.608Z <getDust> DEBUG: dust0 [GP2Y10] (8) 4: inloop
2016-09-22T13:05:11.609Z <Grove.grovepi.dustSensorRead> DEBUG: calling write_i2c_block with: address 4, [10, 0, 0, 0]
2016-09-22T13:05:11.814Z <Grove.grovepi.dustSensorRead> DEBUG: using i2c funcs, we got this back: read_i2c_byte: 0 read_i2c_block: [0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
2016-09-22T13:05:11.818Z <getDust> WARNING: dust0 [GP2Y10] (8) 4: Didnt get a value. Incrementing error.
2016-09-22T13:05:11.818Z <getDust> DEBUG: dust0 [GP2Y10] (8) 5: Disconnecting the dust sensor
2016-09-22T13:05:11.819Z <Grove.grovepi.dust_sensor_dis> DEBUG: calling write_i2c_block with: address 4, [15, 0, 0, 0]
2016-09-22T13:05:12.020Z <parseDust> DEBUG: dust0: {'raw': -1, 'error': 5, 'IOerror': 0}
the dust sensor is attached to digital 8 on the grovepi, because I saw on some blog that this is the only supported port for the dust sensor.
Can anyone help me sort out what to do properly here?
I’ve been using these for reference:
#https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_dust_sensor.py
#http://www.pocketmagic.net/sharp-gp2y1010-dust-sensor/