ads1x15

Ultra-Small, Low-Power, BitAnalog-to-Digital Converter with Internal Reference


Keywords
ads1x15, ads1015, ads1115, adc
License
GPL-2.0
Install
npm install ads1x15@1.2.0

Documentation

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

Import options:

import {default as ads1x15} from 'ads1x15';
const ads1x15 = require('ads1x15');

Common Usage

Here's the Raspberry Pi wired to the ADS1015 with I2C: Image of Raspberry Pi wired to the ADS1015

Note

Raspi + ADS1015 image info link Owner Liz Clark, Attribution-ShareAlike Creative Commons by-sa

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

Acknowledgment