-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
220 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters