paulvha / sps30

Sensirion SPS30 driver for ESP32, SODAQ, MEGA2560, UNO,UNO-R4 ESP8266, Particle-photon on UART OR I2C coummunication
GNU General Public License v3.0
67 stars 27 forks source link

auto-clean on esp8266 not working #8

Closed HyperDevil closed 4 years ago

HyperDevil commented 4 years ago

10:53:26.255 -> Serial number : 79D40290B4DFxxxx 10:53:26.255 -> Product name : not available 10:53:26.255 -> Article code : not available 10:53:26.255 -> could not get clean interval.Protocol error 10:53:26.255 -> No Auto Clean interval change requested. 10:53:27.251 -> Measurement started 10:53:27.251 -> 10:53:27.251 -> Hit to continue reading 10:53:29.263 -> Hit to continue reading 10:53:31.248 -> Hit to continue reading 10:53:33.259 -> -------------Mass ----------- ------------- Number -------------- -Average- 10:53:33.259 -> Concentration [μg/m3] Concentration [#/cm3] [μm] 10:53:33.293 -> P1.0 P2.5 P4.0 P10 P0.5 P1.0 P2.5 P4.0 P10 PartSize 10:53:33.293 -> 10:53:33.293 -> 0.74 2.94 4.69 5.04 0.40 3.55 5.73 6.15 6.21 1.63 10:53:36.299 -> 0.79 1.49 2.01 2.12 3.92 5.58 6.26 6.39 6.41 0.89 10:53:39.297 -> 0.87 1.52 2.01 2.11 4.58 6.29 6.93 7.05 7.07 0.92

Using I2c on ESP8266.

paulvha commented 4 years ago

HI

Have just compiled and checked example 2 to be sure. All works fine.

Do you have pull-up resistors on both SCL and SDA to 3V3? Do you power the SPS30 with 5V external ? the xxx behind the serial number did you add those manual ?

regards, Paul


Van: HyperDevil notifications@github.com Verzonden: woensdag 12 februari 2020 10:54 Aan: paulvha/sps30 sps30@noreply.github.com CC: Subscribed subscribed@noreply.github.com Onderwerp: [paulvha/sps30] auto-clean on esp8266 not working (#8)

10:53:26.255 -> Serial number : 79D40290B4DFxxxx 10:53:26.255 -> Product name : not available 10:53:26.255 -> Article code : not available 10:53:26.255 -> could not get clean interval.Protocol error 10:53:26.255 -> No Auto Clean interval change requested. 10:53:27.251 -> Measurement started 10:53:27.251 -> 10:53:27.251 -> Hit to continue reading 10:53:29.263 -> Hit to continue reading 10:53:31.248 -> Hit to continue reading 10:53:33.259 -> -------------Mass ----------- ------------- Number -------------- -Average- 10:53:33.259 -> Concentration [μg/m3] Concentration [#/cm3] [μm] 10:53:33.293 -> P1.0 P2.5 P4.0 P10 P0.5 P1.0 P2.5 P4.0 P10 PartSize 10:53:33.293 -> 10:53:33.293 -> 0.74 2.94 4.69 5.04 0.40 3.55 5.73 6.15 6.21 1.63 10:53:36.299 -> 0.79 1.49 2.01 2.12 3.92 5.58 6.26 6.39 6.41 0.89 10:53:39.297 -> 0.87 1.52 2.01 2.11 4.58 6.29 6.93 7.05 7.07 0.92

Using I2c on ESP8266.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpaulvha%2Fsps30%2Fissues%2F8%3Femail_source%3Dnotifications%26email_token%3DAD2GBPGZVTV7KRZO2HN4MFLRCPBOFA5CNFSM4KTWKQ32YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IM4EGOQ&data=02%7C01%7C%7Cf6cd47070bba4aff680108d7afa19595%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637170980835214948&sdata=Y6MQvZlzpDylGj5PV18giZVBdtcJ3bHFZGr%2FsMjgZTI%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAD2GBPGNL7TQ2JZQCQ2UZ3LRCPBOFANCNFSM4KTWKQ3Q&data=02%7C01%7C%7Cf6cd47070bba4aff680108d7afa19595%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637170980835214948&sdata=fOzD8UWooPiX%2Bay7gEFxvYjwKLSkOmog%2FMpHGU%2Bw%2FpE%3D&reserved=0.

HyperDevil commented 4 years ago

Hi Paul,

Yes the pullups are there 10K to 3v3. I use the VIN pin on the ESP8266 which is 5V (from usb), my USB port can supply 3A. I checked with a multimeter, just also tried external 5v, no change in behavior. And yes i added the xxx (although it is not sensitive information).

HyperDevil commented 4 years ago

11:13:38.032 -> SPS30-Example2: Basic reading + clean. press to start 11:13:40.012 -> SPS30-Example2: Basic reading + clean. press to start 11:13:42.021 -> Trying to connect 11:13:42.021 -> I2C Sending: 0xD0 0x33 11:13:42.021 -> I2C Received: 0x37 0x39 0x44 0x34 0x30 0x32 0x39 0x30 0x42 0x34 0x44 0x46 0x33 0x33 0x33 0x37 0x00 0x00 length: 18 11:13:42.055 -> 11:13:42.055 -> Detected SPS30. 11:13:42.055 -> I2C Sending: 0xD3 0x04 11:13:44.031 -> I2C Sending: 0xD0 0x33 11:13:44.031 -> I2C Received: 0x37 0x39 0x44 0x34 0x30 0x32 0x39 0x30 0x42 0x34 0x44 0x46 0x33 0x33 0x33 0x37 0x00 0x00 length: 18 11:13:44.065 -> 11:13:44.065 -> Serial number : 79D40290B4DF3337 11:13:44.065 -> Product name : not available 11:13:44.065 -> I2C Sending: 0xD0 0x25 11:13:44.065 -> I2C Received: 0x00 0x00 length: 2 11:13:44.065 -> 11:13:44.065 -> Article code : not available 11:13:44.065 -> I2C Sending: 0x80 0x04 11:13:44.065 -> Error: Received NO bytes 11:13:44.065 -> I2C Received: length: 0 11:13:44.065 -> 11:13:44.065 -> Error during reading from I2C: 0x51 11:13:44.065 -> could not get clean interval.Protocol error 11:13:44.065 -> No Auto Clean interval change requested. 11:13:44.098 -> I2C Sending: 0x00 0x10 0x03 0x00 0xAC 11:13:45.085 -> Measurement started

paulvha commented 4 years ago

It is clear the connection is working as you get the serial number and can read the results. I have just connected the ESP8266 and did the same test example2. and added some comments in between. My SPS30 answers to the request: I2C Sending: 0x80 0x04, where yours is not.

Try this : remove both power source, count to 10 and reconnect (5V first). Maybe the SPS30 is in state of flux. What happens if you try to set the autocleaning ?

regards, Paul

SPS30-Example2: Basic reading + clean. press to start Trying to connect

I2C Sending: 0xD0 0x33 I2C Received: 0x33 0x36 0x31 0x44 0x34 0x46 0x44 0x33 0x41 0x41 0x39 0x34 0x31 0x41 0x37 0x36 0x00 0x00 length: 18 PROBE = SAME AS ASKING SERIAL NUMBER

Detected SPS30.

I2C Sending: 0xD3 0x04 RESET

I2C Sending: 0xD0 0x33 I2C Received: 0x33 0x36 0x31 0x44 0x34 0x46 0x44 0x33 0x41 0x41 0x39 0x34 0x31 0x41 0x37 0x36 0x00 0x00 length: 18 Serial number : 361D4FD3AA941A76

Product name : not available NEVER AVAILABLE ON I2C

I2C Sending: 0xD0 0x25 I2C Received: 0x00 0x00 length: 2 Article code : not available

I2C Sending: 0x80 0x04 I2C Received: 0x00 0x09 0x3A 0x80 length: 4 Current Auto Clean interval: 604800 seconds

I2C Sending: 0x80 0x04 0x00 0x00 0x81 0x02 0x30 0x9D I2C Sending: 0xD3 0x04 RESET Auto Clean interval now set : 560 seconds

I2C Sending: 0x80 0x04 I2C Received: 0x00 0x00 0x02 0x30 length: 4 Current Auto Clean interval: 560 seconds

I2C Sending: 0x00 0x10 0x03 0x00 0xAC Measurement started


Van: HyperDevil notifications@github.com Verzonden: woensdag 12 februari 2020 11:14 Aan: paulvha/sps30 sps30@noreply.github.com CC: paulvha paulvha@outlook.com; Comment comment@noreply.github.com Onderwerp: Re: [paulvha/sps30] auto-clean on esp8266 not working (#8)

11:13:38.032 -> SPS30-Example2: Basic reading + clean. press to start 11:13:40.012 -> SPS30-Example2: Basic reading + clean. press to start 11:13:42.021 -> Trying to connect 11:13:42.021 -> I2C Sending: 0xD0 0x33 11:13:42.021 -> I2C Received: 0x37 0x39 0x44 0x34 0x30 0x32 0x39 0x30 0x42 0x34 0x44 0x46 0x33 0x33 0x33 0x37 0x00 0x00 length: 18 11:13:42.055 -> 11:13:42.055 -> Detected SPS30. 11:13:42.055 -> I2C Sending: 0xD3 0x04 11:13:44.031 -> I2C Sending: 0xD0 0x33 11:13:44.031 -> I2C Received: 0x37 0x39 0x44 0x34 0x30 0x32 0x39 0x30 0x42 0x34 0x44 0x46 0x33 0x33 0x33 0x37 0x00 0x00 length: 18 11:13:44.065 -> 11:13:44.065 -> Serial number : 79D40290B4DF3337 11:13:44.065 -> Product name : not available 11:13:44.065 -> I2C Sending: 0xD0 0x25 11:13:44.065 -> I2C Received: 0x00 0x00 length: 2 11:13:44.065 -> 11:13:44.065 -> Article code : not available 11:13:44.065 -> I2C Sending: 0x80 0x04 11:13:44.065 -> Error: Received NO bytes 11:13:44.065 -> I2C Received: length: 0 11:13:44.065 -> 11:13:44.065 -> Error during reading from I2C: 0x51 11:13:44.065 -> could not get clean interval.Protocol error 11:13:44.065 -> No Auto Clean interval change requested. 11:13:44.098 -> I2C Sending: 0x00 0x10 0x03 0x00 0xAC 11:13:45.085 -> Measurement started

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpaulvha%2Fsps30%2Fissues%2F8%3Femail_source%3Dnotifications%26email_token%3DAD2GBPEFSY2LQMLNFQOXATLRCPDXFA5CNFSM4KTWKQ32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELQGSEQ%23issuecomment-585132306&data=02%7C01%7C%7Cefb131e7ba9c4ecbae2608d7afa44e0d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637170992520768279&sdata=nMKVezfUPYlHUd72WWm2%2FUPh7PLEXMfWTpogKvyMCBI%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAD2GBPB5COBF3CKIYL45EBLRCPDXFANCNFSM4KTWKQ3Q&data=02%7C01%7C%7Cefb131e7ba9c4ecbae2608d7afa44e0d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637170992520768279&sdata=UDwG0qtWcydTqnBq%2BlZkEyo4wuTfUBw8vPqS7oDX3sQ%3D&reserved=0.

HyperDevil commented 4 years ago

Ok i did that now:

define AUTOCLEANINTERVAL 604800

define PERFORMCLEANNOW 0

define DEBUG 2

11:49:10.725 -> SPS30-Example2: Basic reading + clean. press to start 11:49:12.727 -> Trying to connect 11:49:12.727 -> I2C Sending: 0xD0 0x33 11:49:12.727 -> I2C Received: 0x37 0x39 0x44 0x34 0x30 0x32 0x39 0x30 0x42 0x34 0x44 0x46 0x33 0x33 0x33 0x37 0x00 0x00 length: 18 11:49:12.760 -> 11:49:12.760 -> Detected SPS30. 11:49:12.760 -> I2C Sending: 0xD3 0x04 11:49:14.729 -> I2C Sending: 0xD0 0x33 11:49:14.763 -> I2C Received: 0x37 0x39 0x44 0x34 0x30 0x32 0x39 0x30 0x42 0x34 0x44 0x46 0x33 0x33 0x33 0x37 0x00 0x00 length: 18 11:49:14.763 -> 11:49:14.763 -> Serial number : 79D40290B4DF3337 11:49:14.763 -> Product name : not available 11:49:14.763 -> I2C Sending: 0xD0 0x25 11:49:14.763 -> I2C Received: 0x00 0x00 length: 2 11:49:14.763 -> 11:49:14.763 -> Article code : not available 11:49:14.763 -> I2C Sending: 0x80 0x04 11:49:14.763 -> Error: Received NO bytes 11:49:14.763 -> I2C Received: length: 0 11:49:14.763 -> 11:49:14.763 -> Error during reading from I2C: 0x51 11:49:14.797 -> could not get clean interval.Protocol error 11:49:14.797 -> I2C Sending: 0x80 0x04 0x00 0x09 0x09 0x3A 0x80 0xA7 11:49:15.783 -> I2C Sending: 0xD3 0x04 11:49:17.791 -> Auto Clean interval now set : 604800 seconds 11:49:17.791 -> I2C Sending: 0x80 0x04 11:49:17.791 -> Error: Received NO bytes 11:49:17.791 -> I2C Received: length: 0 11:49:17.791 -> 11:49:17.791 -> Error during reading from I2C: 0x51 11:49:17.791 -> could not get clean interval.Protocol error 11:49:17.791 -> I2C Sending: 0x00 0x10 0x03 0x00 0xAC 11:49:18.777 -> Measurement started 11:49:18.777 -> 11:49:18.777 -> Hit to continue reading 11:49:20.784 -> Hit to continue reading 11:49:22.790 -> Hit to continue reading 11:49:24.799 -> Hit to continue reading 11:49:26.803 -> Hit to continue reading

I also tried another ESP8266 in case my board is faulty, but the same behaviour.

HyperDevil commented 4 years ago

As discussed by email, add this to the sps30.cpp file on line 1144 ofter I2C_Setpointer() function. delay(5);