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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@chirimen/drv8830

v1.1.2

Published

Driver for DRV8830 with WebI2C

Readme

DRV8830

DRV8830は、I2Cで制御する低電圧モータードライバーICです。

このCHIRIMENドライバーはブラシ付きDCモーター1個をHブリッジで駆動します。APIには電圧(V)を指定するだけで、IC内蔵のPWMレギュレーターがその電圧になるよう自動調整するため、電源電圧が変動してもモーター速度を一定に保てます(正転・逆転・ブレーキ・停止)。フォルト状態の読み取りにも対応しています。

仕様

  • デバイス: DRV8830
  • インターフェイス: I2C
  • デフォルトI2Cアドレス: 0x64(アドレスピンA0・A1の設定により0x60〜0x68の範囲で変更可能)
  • 動作電源電圧: 2.75V〜6.8V
  • 出力電圧範囲: 約0V〜5.06V(64段階、約0.08V刻み)
  • 最大出力電流: 1A(連続)

インストール

npm install @chirimen/drv8830

使用方法

import { requestI2CAccess } from "node-web-i2c";
import DRV8830 from "@chirimen/drv8830";

const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

const i2cAccess = await requestI2CAccess();
const motor = new DRV8830(i2cAccess.ports.get(1));
await motor.init();
await motor.forward(); // 正転
await sleep(1000);
await motor.reverse(); // 逆転
await sleep(1000);
await motor.stop(); // 停止
await motor.clearFault();

API

constructor(i2cPort, slaveAddress)

DRV8830ドライバーのインスタンスを生成します。

  • i2cPort: I2Cポートのインスタンス
  • slaveAddress: I2Cスレーブアドレス。省略時は 0x64

init()

I2C接続を開始します。

forward(voltage = 3)

モーターを正転方向に駆動します。

  • voltage: 出力電圧を0以上の数値(V)で指定します。デフォルト値は 3 です。内部で最も近い64段階のいずれかに丸められ、最大値(約5.06V)を超える値は最大値にクランプされます。

例:

await motor.forward(3);

reverse(voltage = 3)

モーターを逆転方向に駆動します。

  • voltage: 出力電圧を0以上の数値(V)で指定します。デフォルト値は 3 です。内部で最も近い64段階のいずれかに丸められ、最大値(約5.06V)を超える値は最大値にクランプされます。

例:

await motor.reverse(3);

brake()

モーターの両出力をHighにしてショートブレーキをかけます。

例:

await motor.brake();

stop()

モーターの出力をハイインピーダンス状態にして停止(コースト)します。

例:

await motor.stop();

readFault()

FAULTレジスタを読み取り、フォルト状態を返します。

戻り値は次のプロパティを持つオブジェクトです。

  • fault: いずれかのフォルトが発生している場合true
  • ocp: 過電流(Overcurrent Protection)が発生した場合true
  • uvlo: 低電圧誤動作防止(Undervoltage Lockout)が発生した場合true
  • ots: 過熱(Overtemperature Shutdown)が発生した場合true
  • ilimit: 電流制限状態が継続した場合true

例:

const fault = await motor.readFault();
if (fault.fault) {
  console.log(fault);
}

clearFault()

FAULTレジスタのフォルト状態をクリアします。

例:

await motor.clearFault();

データシート

Texas Instruments DRV8830:

https://www.ti.com/lit/ds/symlink/drv8830.pdf