npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@iiot2k/ads1115

v2.1.1

Published

ads1115 analog to digital converter library

Downloads

60

Readme

@iiot2k/ads1115

platform

ads1115 analog to digital converter library

Developing software is a hard job. Thanks for the coffee !! 😁

Installation

npm install @iiot2k/ads1115

or add in your package.json:

"dependencies": {
    "@iiot2k/ads1115": "latest"
},

View on npm📌 View on GitHub📌 Report any issues here📌

ads1115📌 16bit analog to digital converter

  • 16bit Conversion Resolution.
  • Four Analog Inputs.
  • Each input can be selected Single-Ended, Differential.
  • Internal Voltage Reference.
  • Internal Oscillator.
  • Programmable Data Rate 8 SPS to 860 SPS.
  • The PGA offers input ranges from ±256 mV to ±6144 mV.
  • I2C Interface with four pin-selectable addresses.

Usage

  • This library works on Raspberry Pi with 32bit or 64bit OS.
  • The output value is mV or adc raw data.
  • Enable I2C with raspi-config.
  • In this case i2c-1 is enabled (port=1).
  • If you use i2c-0 port add dtparam=i2c_vc=on to /boot/config.txt, then Pin27=SDA, Pin28=SCK.
  • For other ports add this to /boot/config.txt.

Address Pin Connection

|I2C Address|ADDR Pin| |:----|:---| |48H|GND or open| |49H|VCC| |4AH|SDA| |4BH|SCL|

Node.js API

Node.js API functions are explained in document API.md Node.js examples are on examples folder.

// example reads single adc input
"use strict";

const ads1115 = require("@iiot2k/ads1115");

ads1115.read(
    1, // i2c-1
    ads1115.ADR_48, // address 0x48
    ads1115.MUX_I0_GND, // AIN0 - GND
    ads1115.GAIN_4096, // 4096 mV
    ads1115.RATE_128, // 128 SPS
    false, // no rawdata
    function(data) {
        if (data === undefined)
            console.log(ads1115.error_text());
        else
            console.log(data, "mV");
    });

C++ API

This library uses C++ addon modules as interface to hardware. Therefore, there is also a C++ interface to the drivers. Unfortunately the C++ addon modules are not open source. I provide the C++ static link libraries. But if you are interested in the sources, I can send them to you. Please send me an email with your name to [email protected] I can only provide limited support for the C++ addon modules sources.

I have shown some C++ examples in the cpp directory and on GitHub📌 The C++ API functions are described in the header file ads1115_lib.h

// example reads single adc input

#include <stdio.h>

#include "ads1115_lib.h"

#define PORT 1 // i2c-1

int main()
{
    double value;

    bool ret = ads1115::read(
        PORT,
        ads1115::ADR_48, // address 0x48
        ads1115::MUX_I0_GND, // AIN0 - GND
        ads1115::GAIN_4096, // 4096 mV
        ads1115::RATE_128, // 128 SPS
        false, // no rawdata
        value);

    if (ret)
        printf("%.0fmV\n", value);
    else
        printf("%s\n", ads1115::error_text());

    return 0;
}