-
Notifications
You must be signed in to change notification settings - Fork 25
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
different gain settings by channel? #19
Comments
Yes correct, there is no register for this to store the information. So you would have to work with an case/switch or if, like: if(channel == ADS1115_COMP_0_1){setVoltageRange_mV(range)} Another option is use setAutoRange(); when you change the channel. Or you modify the general function to read the channels in the example sketch:
to individual channels:
or you extend the function to read the channel:
and call readChannel accordingly, for example:
If I implement this in the library it will take some additional memory space for the variables. And the effort/complexity on your side does not differ much, since you still have to define somewhere which range you want to apply for which channel. But happy to hear your view. Maybe it would be an alternative to add this as another example sketch? |
Thank you. |
setVoltageRange shouldn't need a delay. Why don't you just try it? And yes, you can use setAutoRange() instead. It changes into the full range, measures the voltage and then selects the lowest range in which the measured is below 80% of the maximum (to have some buffer). The only disadvantage is that it takes some conversion cycles. But you don't need to add a delay. |
I need to correct myself: setVoltageRange() needs a delay. But if you first change the range and then the channel, the delays I have implemented for the change of the channel are sufficient. So do it this way round or take the setAutoRange() function. Sorry for the confusion. |
Thank you. I wrote here to share our experience and let others benefit as well |
Yes, let's add an example. I'm also considering to add an automatic delay for the change of range. |
@rin67630 I have modified the library a bit and now you can call setVoltageRange_mV and immediately request voltages. The necessary delays are added in the background. The delays are adjusted to the conversion rate. |
Apparently the ADS1115 is not conceived to memorise different gain settings by channel, is it?
A typical application would have been:
How would you proceed to achieve that?
Change the parameters in loop() on the fly and work with one shot conversions?
Could you imagine a solution in the library?
Thank you for any advice
Regards,
Laszlo
The text was updated successfully, but these errors were encountered: