- Joined
- Aug 11, 2018
- Messages
- 677
- Reaction score
- 1,123
I've been working on adding drivers for ADS1015 and ADS1115 to reef-pi. I'm planning for it to only support single shot since reef-pi can't keep up with continuous conversions anyway. I have a few points that could use some community input.
Single Ended vs Differential
Does anyone have a use case for differential inputs? Driver configuration is easy for single ended since it just exposes 4 channels. Differential could be kind of easy by exposing 3 channels since they all have an option to pair with AIN3, but there's a fourth option for differential to pair AIN0 and AIN1. This makes the driver configuration much more complicated to present to users.
Gain settings
Should we go with a single gain setting, or the possibility of different gain on each channel? There are a handful of amplification settings available. It's possible to have the gain configured differently for each channel, but that gets much more complicated for differential readings since the channels would be more dynamic.
Comparator
Does anyone have a use case for the comparator functions? It could be exposed as a digital input, but I haven't really thought through this functionality.
Bad readings
I've got a test board hooked up and things are mostly running fine. I see the values change as I move the position of the potentiometer.
I occasionally see a sporadic conversion returned as 0. All those lines to the bottom are bad readings. The jump at the end is from me pushing the slider up.
I can't seem to find any reason for the bad conversions, but I do find that they are always correlated with the config register being reset to default. So it's not technically a bad conversion since the config is stating to read AIN0 with AIN1, but I haven't been able to pin down the root of this problem.
I thought it might be some other I2C traffic causing a problem, but nothing else has been captured on that bus using a logic analyzer. Only the intended messages are flowing. I also thought it might be a voltage sag causing the chip to reset. I've hooked up a scope on the power pins around this chip and set a trigger at 4.75v. It's never triggered (except at power on and power off). I've also searched for any mention of others having this kind of problem, but that turned up empty as well... I have an ADS1115 board showing up soon, so I'll repeat these tests with that module.
To work around this problem, I think I'll just read back the config register and discard the conversion if the config doesn't match what it should be. It can retry a few times in the event of a mismatch or failure. I don't see this kind of behavior in any other samples, though.
The analog reading also wiggles a bit. it's exaggerated by 16 times in my samples above since ADS1015 is 12 bit instead of 16 and I haven't shifted it to compensate. Is there an appetite to have the driver take multiple conversions and average the results?
Single Ended vs Differential
Does anyone have a use case for differential inputs? Driver configuration is easy for single ended since it just exposes 4 channels. Differential could be kind of easy by exposing 3 channels since they all have an option to pair with AIN3, but there's a fourth option for differential to pair AIN0 and AIN1. This makes the driver configuration much more complicated to present to users.
Gain settings
Should we go with a single gain setting, or the possibility of different gain on each channel? There are a handful of amplification settings available. It's possible to have the gain configured differently for each channel, but that gets much more complicated for differential readings since the channels would be more dynamic.
Comparator
Does anyone have a use case for the comparator functions? It could be exposed as a digital input, but I haven't really thought through this functionality.
Bad readings
I've got a test board hooked up and things are mostly running fine. I see the values change as I move the position of the potentiometer.
I occasionally see a sporadic conversion returned as 0. All those lines to the bottom are bad readings. The jump at the end is from me pushing the slider up.
I can't seem to find any reason for the bad conversions, but I do find that they are always correlated with the config register being reset to default. So it's not technically a bad conversion since the config is stating to read AIN0 with AIN1, but I haven't been able to pin down the root of this problem.
I thought it might be some other I2C traffic causing a problem, but nothing else has been captured on that bus using a logic analyzer. Only the intended messages are flowing. I also thought it might be a voltage sag causing the chip to reset. I've hooked up a scope on the power pins around this chip and set a trigger at 4.75v. It's never triggered (except at power on and power off). I've also searched for any mention of others having this kind of problem, but that turned up empty as well... I have an ADS1115 board showing up soon, so I'll repeat these tests with that module.
To work around this problem, I think I'll just read back the config register and discard the conversion if the config doesn't match what it should be. It can retry a few times in the event of a mismatch or failure. I don't see this kind of behavior in any other samples, though.
The analog reading also wiggles a bit. it's exaggerated by 16 times in my samples above since ADS1015 is 12 bit instead of 16 and I haven't shifted it to compensate. Is there an appetite to have the driver take multiple conversions and average the results?