espurna icon indicating copy to clipboard operation
espurna copied to clipboard

Generic implementation of I2C ADC extenders like ADS1115, ADC121

Open hyteoo opened this issue 6 years ago • 3 comments

Although there is support for I2C ADC extenders, they are implemented for energy measurement.

Would it be a good idea to just have like a generic ADS1x15 with raw outputs (like the internal ESP8266 ADC), to be used for whatever (voltage measurement, NTC, etc)?

hyteoo avatar Jul 06 '18 07:07 hyteoo

Hi, the same issue here. I've bought an ADS1115 to use it as 4 Channel analog Input like the A0 from the ESP8266. It would be nice to get this feature. Thanks.

flashy02 avatar Nov 03 '18 09:11 flashy02

See also #199 and #1311

xoseperez avatar Dec 13 '18 12:12 xoseperez

As referenced in the commit, there is now EmonADS1X115Sensor::I2CPort: https://github.com/xoseperez/espurna/blob/44298d4077ffd146c61eea7424b394167093a5d0/code/espurna/sensor.cpp#L1871-L1872 where I2CPort::read(N) is effectively an analogRead(N)

Only noticed the issue after the fact though. I guess it could be further modified as something virtual once again so there's a generic virtual unsigned int Class::analogRead(int channel);, but not inheriting from the BaseSensor stuff. edit: or, make it chain with baseanalogsensor, and simply make another class

mcspr avatar Jun 23 '21 20:06 mcspr