2
2

More than 3 years have passed since last update.

Raspberry Pi で ADS1115 を使う

Posted at

Adafruit のライブラリーを使って、A/D コンバーター ADS1115 を使う方法です。

参考ページ
Adafruit_CircuitPython_ADS1x15

インストール

sudo pip3 install adafruit-circuitpython-ads1x15

コードのクローン

git clone https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15

サンプルコードのあるフォルダーに移動

cd Adafruit_CircuitPython_ADS1x15/examples

サンプルプログラムを実行

$ python3 ./ads1115_simpletest.py 
  raw       v
   -1   -0.000
    0   -0.000
    0   -0.000
   -1   -0.000
   -1   -0.000
   -1   -0.000

この時の I2C のアドレス

$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- 
2
2
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
2
2