Skip to content

Commit

Permalink
Add as5600
Browse files Browse the repository at this point in the history
  • Loading branch information
satakagi committed Aug 10, 2024
1 parent 0c87f80 commit 87f5445
Show file tree
Hide file tree
Showing 8 changed files with 220 additions and 0 deletions.
Binary file added pizero/src/esm-examples/as5600/AS5600.fzz
Binary file not shown.
Binary file added pizero/src/esm-examples/as5600/AS5600.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
122 changes: 122 additions & 0 deletions pizero/src/esm-examples/as5600/AS5600_drawing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions pizero/src/esm-examples/as5600/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// AS5600(磁気式角度センサ)を使う
import { requestI2CAccess } from "./node_modules/node-web-i2c/index.js";
import AS5600 from "./as5600.js";
const sleep = msec => new Promise(resolve => setTimeout(resolve, msec));

main();

var as5600;

async function main() {
const i2cAccess = await requestI2CAccess();
const port = i2cAccess.ports.get(1);
as5600 = new AS5600(port);
await as5600.init();
var stat = await as5600.getStatus();
console.log("stat:" , stat);
startMeasurement();
}

async function startMeasurement() {
for (; ;) {
var rawAngle = await as5600.getAngle();
console.log("rawA:",rawAngle);
await sleep(1000);
}
}
48 changes: 48 additions & 0 deletions pizero/src/esm-examples/as5600/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "myApp",
"private": true,
"type": "module",
"dependencies": {
"node-web-gpio": "latest",
"node-web-i2c": "latest",
"@chirimen/adt7410": "latest",
"@chirimen/tca9548a": "latest",
"@chirimen/grove-accelerometer": "latest",
"@chirimen/pca9685": "latest",
"@chirimen/vl53l0x": "latest",
"@chirimen/grove-light": "latest",
"@chirimen/grove-oled-display": "latest",
"@chirimen/ads1015": "latest",
"@chirimen/s11059": "latest",
"@chirimen/gp2y0e03": "latest",
"@chirimen/seesaw": "latest",
"@chirimen/grove-gesture": "latest",
"@chirimen/grove-touch": "latest",
"@chirimen/veml6070": "latest",
"@chirimen/sht30": "latest",
"@chirimen/hello-world": "latest",
"@chirimen/vl53l1x": "latest",
"@chirimen/mpu6050": "latest",
"@chirimen/tcs34725": "latest",
"@chirimen/bmp280": "latest",
"@chirimen/neopixel-i2c": "latest",
"@chirimen/mpu6500": "latest",
"@chirimen/pcf8591": "latest",
"@chirimen/amg8833": "latest",
"@chirimen/bh1750": "latest",
"@chirimen/canzasi": "latest",
"@chirimen/ina219": "latest",
"@chirimen/mlx90614": "latest",
"@chirimen/ak8963": "latest",
"@chirimen/bme280": "latest",
"@chirimen/bmp180": "latest",
"@chirimen/ads1x15": "latest",
"@chirimen/pca9685-pwm": "latest",
"@chirimen/arduino-stepping-motor": "latest",
"@chirimen/apds9960": "latest",
"@chirimen/microbit": "latest",
"@chirimen/ccs811": "latest",
"@chirimen/bme680": "latest",
"@chirimen/as5600": "latest"
}
}
22 changes: 22 additions & 0 deletions pizero/src/esm-examples/as5600/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## 磁気式角度センサ AS5600を使う

ブレークアウトボードを購入すると付属している円盤状の磁石をチップに近接配置。この磁石の回転角を非接触で検出できるセンサです
* 円盤状磁石の中心を回転軸とし、この角度を検出
* チップの中心と、円盤状磁石の中心を一致させる
* チップ表面と磁石の距離は0.5~3mm程度にする ([参照情報(データシート33ページ)](https://ams.com/documents/20143/36005/AS5600_DS000365_5-00.pdf#page=34))
* DIRピンをVCCに接続すると角度の方向が逆向きになる
* ブレークアウトボード
* https://electronicwork.shop/items/64205dc6cd92fe0096fb7d5c
* https://www.switch-science.com/products/3493

* ソフトウェア
* [as5600.js](as5600.js) : ドライバ
* [main-as5600.js](main-as5600.js) : サンプルアプリ
* 両方ともmyAppディレクトリ直下に置く

* AS5600データシート
* https://ams.com/documents/20143/36005/AS5600_DS000365_5-00.pdf

![AS5600.png](AS5600.png)

![AS5600_drawing.svg](AS5600_drawing.svg)
1 change: 1 addition & 0 deletions pizero/src/esm-examples/index_examples.csv
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ aht10,温度・湿度センサ,I2C接続の温度・湿度センサーAHT10の
adxl345,3軸加速度,I2C接続の3軸加速度センサーADXL345で取得した値を表示します。Grove-Accelerometerもしくはジェネリック品
amg8833,サーモグラフィ,I2C接続のサーモグラフィーデバイス AMG8833を使用します。
as3935,雷センサ,I2C接続の雷接近を検出するセンサ、AS3935を使用します。雷検出トリガーのためにGPIOも使用します。
as5600,回転角センサ,I2C接続の回転角を非接触で検出できるセンサ、AS5600を使用します。
#apds9960,近接・環境光・ジェスチャー,近接・環境光・ジェスチャーセンサーAPDS9960で取得した値を表示します。
bh1750,照度センサ,I2C接続の照度センサーBH1750の値を表示します。
bme280,温度・湿度・気圧,I2C接続の温度・湿度・気圧 複合センサーBME280で取得した値を表示します。スレーブアドレスが 0x76 のものと 0x77 のものがあるので注意
Expand Down
1 change: 1 addition & 0 deletions pizero/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@chirimen/apds9960": "latest",
"@chirimen/arduino-stepping-motor": "latest",
"@chirimen/as3935": "latest",
"@chirimen/as5600": "latest",
"@chirimen/bh1750": "latest",
"@chirimen/bme280": "latest",
"@chirimen/bme680": "latest",
Expand Down

0 comments on commit 87f5445

Please sign in to comment.