@iiot2k/mcp3424

2.1.1 • Public • Published

@iiot2k/mcp3424

platform

mcp3424 analog to digital converter library

Installation

npm install @iiot2k/mcp3424

or add in your package.json:

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

View on npm
View on GitHub

mcp3424 18bit analog to digital converter

  • 12..18bit Conversion Resolution.
  • Four Analog Inputs.
  • Internal Voltage Reference.
  • Internal Oscillator.
  • Programmable Resolution with Data Rate 3.75 SPS (18bits) to 240 SPS (12bits).
  • The PGA offers input ranges from ±256 mV to ±2048 V.
  • I2C Interface with eight Pin-Selectable Addresses.
  • Works also for mcp3421..mcp3428

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.

API

API functions are explained in documents API.md

C++ libraries and examples

Report any issues here

Address Pin Connection

I2C Address ADR0 Pin ADR1 Pin
68H Open Open
68H GND GND
69H GND Open
6AH GND VCC
6BH VCC GND
6CH VCC Open
6DH VCC VCC
6EH Open GND
6FH Open VCC

Supported Devices

Type # Channel Max. Resol. Address-Range
mcp3421 1 18bit 68H
mcp3422 2 18bit 68H
mcp3423 2 18bit 68H-6FH
mcp3424 4 18bit 68H-6FH
mcp3425 1 16bit 68H
mcp3426 2 16bit 68H
mcp3427 2 16bit 68H-6FH
mcp3428 4 16bit 68H-6FH

Example

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

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

mcp3424.read(
    1, // i2c-1
    mcp3424.ADR_68, // address 0x68
    mcp3424.CH_1, // CH1
    mcp3424.AI_12BIT, // 12 bit res.
    mcp3424.GAIN_2048, // 2048mV input
    false, // no rawdata
    function(data) {
        if (data === undefined)
            console.log(ads1115.error_text());
        else
            console.log(data, "mV");
    });

Examples are on examples folder.

Package Sidebar

Install

npm i @iiot2k/mcp3424

Weekly Downloads

11

Version

2.1.1

License

Apache-2.0

Unpacked Size

235 kB

Total Files

19

Last publish

Collaborators

  • iiot2k