Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatability and auto-detection for the Cubic PM1006 air quality sensor #13

Merged
merged 11 commits into from
Nov 16, 2023

Conversation

brentru
Copy link
Member

@brentru brentru commented Nov 15, 2023

This pull request adds compatibility for this library to work with the Cubic PM1006 LED Particle Sensor. This sensor is used in the IKEA VINDSTRYKKA.

  • Adds auto-detection for start-bytes to differentiate between the sensors
  • Modifies Adafruit_PM25AQI::read() to work with Adafruit's Air Quality Sensors or the Cubic PM1006
  • Added a demo sketch, PM1006_test.ino, to show usage
  • Note that this sensor doesn't have I2C and can only read PM 25 Environmental values. As a result, it can't write into all the members of the PM25_AQI_Data struct. Therefore, only the checksum and pm25_env values are written into this struct.

Tested on hardware with:

@tyeth
Copy link
Contributor

tyeth commented Nov 16, 2023

Tested on metro-s2, it was not behaving as I'd expect (with no prior knowledge), the Ikea board appears to ask the sensor for 5 readings and then sleeps for 20seconds before another set of readings. As we are just passively monitoring this sensor rather than initiating readings I think this is the best we can hope for.
Added prints (was hoping to peek at bad bytes), but it was just serial unavailable during those times which I guess is fair enough.

@brentru
Copy link
Member Author

brentru commented Nov 16, 2023

the Ikea board appears to ask the sensor for 5 readings and then sleeps for 20seconds before another set of readings. As we are just passively monitoring this sensor rather than initiating readings I think this is the best we can hope for.

Yeah, the sleep period of the sketch in the demo (https://github.com/Hypfer/esp8266-vindriktning-particle-sensor) was 30 seconds. We could sleep for this duration but the actual code is monitoring the sensor as readings are initiated by the MCU on the ikea sensor's mainboard.

@brentru
Copy link
Member Author

brentru commented Nov 16, 2023

After discussing with @tyeth on slack, I've changed the sampling interval to every 5 seconds. We also now wait 20 seconds between successful reads.

@caternuson
Copy link

Did not test, but LGTM.

@brentru brentru merged commit ba3f10c into adafruit:master Nov 16, 2023
1 check passed
@brentru brentru deleted the work-with-ikea-sensor branch November 16, 2023 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants