ads1x15
v1.2.0
Published
Ultra-Small, Low-Power, BitAnalog-to-Digital Converter with Internal Reference
Downloads
107
Readme
ads1x15
A javascript library for the DS101x Ultra-Small,Low-Power, I2C-Compatible, 3.3-kSPS, 12-Bit ADCs With Internal Reference, Oscillator and Programmable Comparator.
Installation
npm install ads1x15
Common Usage
Here's the Raspberry Pi wired to the ADS1015 with I2C:
This example read all ports voltages.
const ads1x15 = require('ads1x15');
const main = async () => {
const adc = new ads1x15();
// open i2c bus. 0 for /dev/i2c-0 and 1 for /dev/i2c-1
await adc.openBus(1);
// Reading in Single shot mode channels 0-3
console.log('Reading Single shot:');
for await (let channel of [0, 1, 2, 3]) {
const measure = await adc.readSingleEnded({channel});
console.log(`Channel ${channel}: ${measure / 1e3} (V) Volts, ${measure} (mV) mili Volts`);
}
}
main()
Examples
You can run all the examples by:
npm run examples
Please, visit the examples folder where you can find some use cases for this module.
The examples was tested with ads1015.
Related content
- TI datasheet for ads1015
- Adafruit-4-channel-adc-breakouts wiring
- Adafruit I2c sensors and devices
- Adafruit_ADS1X15
Acknowledgment
- @rpsoft Jesus Rodriguez for support.
- @alphacharlie Alpha Charlie for the repository node-ads1x15.