-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Observation on fast differential example #87
Comments
Thanks for this info, appreciated. Also great you added the scope-shots!👍 [ ] check examples too |
Rob, the TI data sheet was revised December 2024 and can be found here: See page 17 for diagram. Text is still a bit nebulous, "The COMP_POL bit continues to function as expected". Daryl |
Your remark is about this table in the readme.md if I understand correctly. ALERT RDY table
See issue #76 for some screenshots. |
(downloaded the latest datasheets, thanks for the link) Your screen shots seems in line with the discussion in #76 , From datasheet Reading that section again and again and again and thinking out loud (always dangerous ;) "provides a pulse at the end of conversion", that sounds to me as the pulse starts when the conversion is done.
What "effect" do you see in your measurements when using the rising edge? HypothesisAn hypothesis is that at the start of the pulse, the result of the measurement is copied to the output register. |
Excellent question: I have two calibrated TRMS AC current meters in series with the load. When I set the interrupt to the beginning of the pulse, the output of the software TRMS calculation tends to be inaccurate (+/- 20%) and wanders dramatically from reading to reading. When I set the interrupt to the end of the pulse, I get much better accuracy (+/- 2%) and stable results. Yes. I have only tested with COMP_POL 0 (see register settings), but it appears the table may not follow actual. I suspect during the 8uS pulse, conversion is occurring. The only thing alluding to that is the timing diagram I sent previously where it shows "Conversion Ready" at the end of the pulse. |
Remarkable difference 20% vs 2%, as if the last bits of the ADC are "finalized" during that moment between RISING and FALLING. (thinking out loud again) Gave it some more thoughts and it might have to do with the sample rate (7 == 860 SPS) which does less averaging than e.g. sample rate 4. So I searched the datasheet for noise and yes at sample rate 7 it is more sensitive for noise but it cannot explain all of the large difference you see. From datasheet 7.4.3 The math used for determining TRMS (finding peak and a multiply crest factor) is identical (I assume) and could thus not cause / amplify the existing noise. Intriguing problem, but no clue at the moment Follow up
Yes, noticed that so I will add a section of text telling people to use the end of the ready pulse and refer to this issue. |
Note: currently all my (interrupt) example sketches use RISING edge and none the FALLING edge. |
This is the text I propose to add to the readme.md, any additions? The examples of this library all use the RISING edge for the interrupt detection of the ALERT / RDY pin. In #87 it is observed that the FALLING edge gave far better results for the application used (determine True RMS) although this could not be explained. Thus changing the edge to FALLING might improve your measurements too. If anybody could explain the observed effect, please let me know. |
I plan to do some more research and testing this week. Your text sounds good. While they don't explain it, the diagram in the latest data sheet does indicate that the 'Conversion Ready' is at the end of the pulse. I will test setting COMP_POL to 1, if it inverts the alert/rdy signal then your examples will be correct. :-) |
Added a reference to the picture too.
Created a develop branch (for 0.5.2) with the note and some minor edits in the examples. Thanks for the testing! |
New insights? |
@RobTillaart sorry, got side tracked on another project. Just bringing it up now and will advise. |
I was able to verify the effects of setComparatorPolarity() on the ALERT/PIN function when in Continuous conversion mode:
“Active” refers to the state or condition that triggers an action or indicates that an event has occurred. I would then submit that setComparatorPolarity(0) is therefore an "Active High" signal. When in setComparatorPolarity(1), the signal is "Active Low". |
I would submit based on the Rev. D data sheet Figure 7-8 that you might choose to update this part of the main text: In short: if COMP_POL = 0,
if COMP_POL = 1,
Don't forget, ALERT/RDY requires a pull-up resistor as it is an open-drain output. |
Thanks for all testing and the screen shots, really appreciated! Will look into it asap update and adding 2 line s... |
Anecdotally, I added some debounce to my interrupt handler and noticed it mitigates the issue that started this conversation (setting IRQ trigger on leading versus trailing edge of ALERT/RDY). I surmise that somewhere within the 8us pulse the data is actually valid. When I get this project wrapped up, I'll go back and revisit and provide you with code that demonstrates the errant behavior. Also, perhaps there is someone at TI who might have the details as well (seeing they are still updating the datasheet). Thanks! |
decoder ring: italics were changed or added, |
Updated the readme.md in the develop branch, also updated the table above the section you referred to. update: |
Rob, it looks good, thanks! Question for you, in single-ended mode with an ADS1115 set for data rate 7, you get 860 SPS. I am using both differential pairs in each 1115. It uses a mux to switch between them. Is it reasonable to conclude the effective sample rate is 430 SPS when using both differential pairs on the chip? The data-sheet doesn't specifically say this. It is important to me as I want to make sure I capture x full cycles of an AC waveform. |
You know the frequency of the AC waveform, so you know so the duration of a full wave, so you know when to stop sampling. |
Hi Daryl, Is there anything you would add to the PR at the moment, otherwise I will merge it asap. R. |
Hi Rob, Good to go. Thanks. D |
Rob, thanks for an excellent library. Recently I designed a system with 2 ADS1115 connected to an ESP32-S3. I used differential mode to capture multiple cycles of an AC waveform from a Current Transformer. I found it necessary to set the interrupt to trigger on the falling edge of the Alert/Ready pin output. Here is how I have things setup:
You will notice in the attached scope pictures, that with the setup above the pulses are positive going. I found it necessary to set the interrupt to the falling edge of the pulse to get the most accurate readings (I am calculating TRMS). That seems to go contrary to what you state in your documentation. In the TI AD1115 data sheet, it states the data is ready on the falling edge of the positive going 8uS pulse. Anyway, you might want to revisit this, and I am happy to share additional info.
The text was updated successfully, but these errors were encountered: