Skip to content

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

License

Notifications You must be signed in to change notification settings

felixdrp/ads1x15

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published