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

Issues with accuracy and speed #15

Open
mkudlacek opened this issue Nov 25, 2016 · 1 comment · May be fixed by #40
Open

Issues with accuracy and speed #15

mkudlacek opened this issue Nov 25, 2016 · 1 comment · May be fixed by #40

Comments

@mkudlacek
Copy link

Hello,
I think there is a problem with how the getRawData() works and thus affecting the accuracy of the measurement.

The getRawData() first pulls data from the sensor and then waits for some time based on integration time. So far, it seems ok, but imagine this scenario

  • The sensor is in a dark box. Integration time is set to 154ms to get reasonable resolution and speed. The object of which we want to measure the color is also in the box
  • We enable LED illumination by asserting pin to LOW
  • We call the getRawData() immediatelly

Because of the short time between illuminating the object and taking the measurment, the actual data we will get will be before the illumination, thus R: 0 G: 0 B: 0 C:0. Next getRawData() call will return the correct values.

I propose to switch the delay and reading. First wait for the integration time, then read the values.

Moreover, the waiting is hardcoded, so the getRawData() is a blocking function. For example, I'm reading values from multiple sensors connected to I2C multiplexer. I illuminate the object, then read values from each sensor. The time to do this is NUMBER_OF_SENSORS x INTEGRATION_TIME. It would be more suitable to:

  1. illuminate
  2. wait the integration time
  3. read immediatelly current values from each sensor

I can implement this, but please give me some response first.

@ladyada
Copy link
Member

ladyada commented Nov 25, 2016

sure please try it out and submit a pull request :)

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 a pull request may close this issue.

2 participants