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

Channel mismatch #3

Open
alexander-thiesen opened this issue Jul 21, 2023 · 4 comments
Open

Channel mismatch #3

alexander-thiesen opened this issue Jul 21, 2023 · 4 comments

Comments

@alexander-thiesen
Copy link

Hello @felixdrp,
we have a problem with the communication to our ads1115 chip.
When we read out the chip using code similar to single-shot-example.js the channels get messed up.
We used the implementation of (https://github.com/meeki007/node-red-contrib-ads1x15_i2c).
That means that when we read out channel 2 and 3 the output of channel 2 has sometimes the value of channel 3, vice versa.
For easy demonstration purposes we set the input voltages of the ADC to 1, 2, 3, 4 V respectively.
We ask for the values every 200 ms. Input is single ended. Until now we used 128 Samples/sec.
Do you have a idea where the source of this problem might be and how to solve it?

Thank you in advance

Alexander Thiesen

A similar Issue has been reported under:
meeki007/node-red-contrib-ads1x15_i2c#6 (comment)

@felixdrp
Copy link
Owner

Hello @alexander-thiesen,

  1. Have you try with multiple ADC boards?
  2. Does It changes/replicates with different frequencies?
  3. Do you think it is the software/hardware issue?
  4. May be ambient conditions (cool, warm, etc)?
  5. Another alternative?

@alexander-thiesen
Copy link
Author

Hello @felixdrp,
Thank you for your suggestions.
I analyzed the transferred signal using an oscilloscope seeing, that the data was transmitted correctly, but with the old value.
My conclusion was that there is a timing issue.
The time defined in line 351 of your code was not enough.

const delay = (1000 / sps) + 1;

The ADC chip was not finished with its measurements before your code read out the old value, which has not been changed yet.
Adding another millisecond was sufficient in my case:
const delay = (1000 / sps) + 2;

Alternatively, one could add a read request to read the config register. The first bit tells if a conversion is still running. I was thinking about adding a "safe" function that requests this value before read out.

Greetings

@felixdrp
Copy link
Owner

Hello @alexander-thiesen,

Thank for your detail explanation.
We can add another parameter to the function so we can fine tune the delay time.

It sounds good 'to read the config register'. What about a mix where we have a smaller delay then 'read de register' and if it is not finish yet apply the delay again...?
Can you have a look to it?

Many thanks

felixdrp added a commit that referenced this issue Jul 25, 2023
Prevent #3

Increase delayFineTune to 2.
@felixdrp
Copy link
Owner

Updated version with delayFineTune option.

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

No branches or pull requests

2 participants