Channel mismatch
Opened this issue · 4 comments
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)
Hello @alexander-thiesen,
- Have you try with multiple ADC boards?
- Does It changes/replicates with different frequencies?
- Do you think it is the software/hardware issue?
- May be ambient conditions (cool, warm, etc)?
- Another alternative?
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.
Line 351 in 42644aa
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
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
Updated version with delayFineTune option.