# @chirimen/grove-accelerometer

> Driver for ADXL345 with WebI2C

Latest version **2.0.0** (published 2025-12-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @chirimen/grove-accelerometer
pnpm add @chirimen/grove-accelerometer
yarn add @chirimen/grove-accelerometer
bun add @chirimen/grove-accelerometer
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2025-12-27 |
| First published | 2019-10-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 5 |
| Maintainers | kou029w, krunaru, sizuhiko, akihiko.kigure, saxallan, satakagi, dynamis, rasp753 |

## Links

- npm: https://www.npmjs.com/package/@chirimen/grove-accelerometer
- Repository: https://github.com/chirimen-oh/chirimen-drivers
- Homepage: https://github.com/chirimen-oh/chirimen-drivers#readme
- Issues: https://github.com/chirimen-oh/chirimen-drivers/issues
- npm.io page: https://npm.io/package/@chirimen/grove-accelerometer

## Recent versions

- 2.0.0 (latest) — 2025-12-27
- 1.0.4 — 2020-12-19
- 1.0.3 — 2020-12-11
- 1.0.2 — 2020-06-25
- 1.0.1 — 2020-06-19
- 1.0.0 — 2020-02-05
- 1.0.0-alpha.1 — 2020-01-30
- 1.0.0-alpha.0 — 2019-10-27

## README

[データシート]: https://www.analog.com/media/jp/technical-documentation/data-sheets/ADXL345_jp.pdf

# Grove 3 軸加速度センサー

ADXL345 を使用した 3 軸加速度センサーモジュールです

## センサー仕様

- 測定可能加速度
  - ±16 G (重力加速度)
- 加速度解像度
  - 3.9mg
- I2C スレーブアドレス
  - 0x53

詳細な仕様は[データシート][]を参照してください。（ANALOG DEVICES 社のサイトにリンクします。）

## ドライバー

### 初期化

```javascript
const groveaccelerometer = new GROVEACCELEROMETER(i2cPort, slaveAddress);
await groveaccelerometer.init();
```

I2C ポートの取得とセンサーの初期化をします。
センサーを使う前に必ず 1 回実行してください。
|引数|型|説明|
|:---|:---|:---|
|i2cPort|I2CSlaveDevice|使用する I2C ポートの port オブジェクトです。|
|slaveAddress|Number|センサーの I2C スレーブアドレスです。[センサー仕様](#センサー仕様)を参照してください。|

### 加速度の読み取り read()

```js
await groveaccelerometer.read();
```

加速度を測定します。
返り値は 1 軸毎の値が格納されたオブジェクトです
|返り値|型|説明|
|:---|:---|:---|
|acceleration.x|Number|x 軸方向の加速度です。単位は G（重力加速度）です。|
|acceleration.y|Number|y 軸方向の加速度です。単位は G（重力加速度）です。|
|acceleration.z|Number|z 軸方向の加速度です。単位は G（重力加速度）です。|

## 参考リンク

- [ADXL345 データシート（日本語）（ANALOG DEVICES 社）][データシート]
- [ADXL345 データシート（英語）（ANALOG DEVICES 社）](https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf)
- [GROVE - I2C 3 軸加速度センサ ADXL345 搭載（SWITCH SCIENCE 社）](https://www.switch-science.com/catalog/972/)
- [製造元資料](http://wiki.seeedstudio.com/Grove-3-Axis_Digital_Accelerometer-16g/)

---
_Source: https://npm.io/package/@chirimen/grove-accelerometer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
