- KEYWORDS: Module,I2C,ADS1x15,ADS1015,ADS1115,ADC,Analog to Digital Converter,Programmable Gain
The ADS1015 (12 bit) / ADS1115 (16 bit) is a 4 channel, programmable gain Analog to Digital converter made by TI (datasheet).
Support is included in the [[ADS1X15.js]] module.
If you're using the Adafruit modules, connect them as per Adafruit's documentation, making sure you connect SDA and SCL to I2C-capable pins on Espruino.
Just 'connect' the module to the correct I2C port and call getADC
to get a value. Because conversion can take around 8ms, getADC
uses a callback - which allows Espruino to do other things in the background.
I2C1.setup({ scl : ..., sda: ...} );
var ads = require("ADS1X15").connect(I2C1);
ads.setGain(256); // +/- 0.256mV
ads.getADC(0, function(val) {
console.log("Read ADC value: "+val);
});
- APPEND_JSDOC: ADS1X15.js
- APPEND_USES: ADS1X15
The ADS1015 is available in chip form, however: