0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Raspberry Pi OS(Bullseye 64bit)でADPiを使う

Posted at

概要

手持ちのラズパイ4で、OSがBullseye 64bitの際に、
メカトラックス社のADPiの環境構築がうまくいかなかったので、
その対応方法の備忘録。

経緯

今、ラズパイを使ったセンシングシステムを構築する中で、
アナログセンサーからの出力のAD変換にADPiを準備。

セットアップを GitHub に記載の方法で試したけど、
404 Not Foundのエラーが出る。
実行したのは以下のコマンド。

curl https://mechatrax.github.io/setup.sh | sudo bash

Copilotさんに話を聞いたら、セットアップしなくてもPythonからADPi操作できるって言うから
いろいろ試したけどできず・・・。

手順

昔の記事を検索対象から外していたんですが、2018年の記事の手順で実施すれば問題なかったです💦。

SPIとI2Cを有効化

$ sudo raspi-config
  • Interface Options → I2C → Enable
  • Interface Options → SPI → Enable
    その後一旦再起動。

ユーティリティやライブラリをインストール

以下のコマンドを実行

$ sudo bash -c 'echo "deb http://mechatrax.github.io/raspbian/ stretch main contrib non-free" > /etc/apt/sources.list.d/mechatrax.list'
$ wget http://mechatrax.github.io/raspbian/pool/main/m/mechatrax-archive-keyring/mechatrax-archive-keyring_2016.12.19.1_all.deb
$ sudo dpkg -i mechatrax-archive-keyring_2016.12.19.1_all.deb

$ sudo apt update
$ sudo apt install python3-adpi adpi-utils-backend-spidev adpi-utils

$ sudo shutdown -r now

動作確認

以下のコマンドを実行して、SPIが認識されているか確認

ls /dev/spidev*

続いて以下のコマンドを実行して、I2Cが認識されているか確認

sudo i2cdetect -y 1

センサーに電源供給。
※今回はCH1にセンサーを接続しています。

$ adpictl set output 1 on

以下のコマンドを実行して、データが取れるか確認。
※今回はCH1にセンサーを接続しています。

$ python3 /usr/lib/adpi-utils-backend-spidev/adpi-utils-backend-spidev.py device=adpipro spi0.0 1-0x57 1-0x27  get voltage 1

余談

Copilotさんに半日振り回されたけど、検証することでライブラリ周りの知識が少し増えたのはよかった・・・のかな💦

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?