ads1x15

1.2.0 • Public • Published

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: Image of Raspberry Pi wired to the ADS1015

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

Package Sidebar

Install

npm i ads1x15

Weekly Downloads

12

Version

1.2.0

License

GPLV2

Unpacked Size

52.1 kB

Total Files

10

Last publish

Collaborators

  • felixdrp